Preference<int>("MemoryCardUsbLevelP2", -1)
};
+Preference<bool> MemoryCardManager::m_bUsePmount( "UsePmount", false );
+
Preference<CString> MemoryCardManager::m_sEditorMemoryCardOsMountPoint( "EditorMemoryCardOsMountPoint", "" );
const CString MEM_CARD_MOUNT_POINT[NUM_PLAYERS] =
if( m_iMemoryCardUsbLevel[p] != -1 &&
m_iMemoryCardUsbLevel[p] != d->iLevel )
continue; // not a match
-
+
+ if( !m_bUsePmount && d->bUsePmount )
+ continue; // pmount disabled
+
LOG->Trace( "Player %i: matched %s", p+1, d->sDevice.c_str() );
assigned_device = *d; // save a copy
}
}
+ usbd.sPmountLabel = "openitg-"+sDevice;
+
vDevicesOut.push_back( usbd );
}
}
}
}
}
-
- for( unsigned i=0; i<vDevicesOut.size(); i++ )
- {
- UsbStorageDevice& usbd = vDevicesOut[i];
- LOG->Trace( " sDevice: %s, iBus: %d, iLevel: %d, iPort: %d, id: %04X:%04X, Vendor: '%s', Product: '%s', sSerial: \"%s\", sOsMountDir: %s",
- usbd.sDevice.c_str(), usbd.iBus, usbd.iLevel, usbd.iPort, usbd.idVendor, usbd.idProduct, usbd.sVendor.c_str(),
- usbd.sProduct.c_str(), usbd.sSerial.c_str(), usbd.sOsMountDir.c_str() );
- }
/* Remove any devices that we couldn't find a mountpoint for. */
for( unsigned i=0; i<vDevicesOut.size(); i++ )
UsbStorageDevice& usbd = vDevicesOut[i];
if( usbd.sOsMountDir.empty() )
{
- LOG->Trace( "Ignoring %s (couldn't find in /etc/fstab)", usbd.sDevice.c_str() );
-
- vDevicesOut.erase( vDevicesOut.begin()+i );
- --i;
+ if( usbd.iBus != -1 )
+ {
+ LOG->Trace( "Using pmount for USB device %s", usbd.sDevice.c_str() );
+
+ usbd.bUsePmount = true;
+ usbd.sOsMountDir = "/media/"+usbd.sPmountLabel;
+ }
+ else
+ {
+ LOG->Trace( "Ignoring %s (couldn't find in /etc/fstab)", usbd.sDevice.c_str() );
+
+ vDevicesOut.erase( vDevicesOut.begin()+i );
+ --i;
+ }
}
}
+
+ for( unsigned i=0; i<vDevicesOut.size(); i++ )
+ {
+ UsbStorageDevice& usbd = vDevicesOut[i];
+ LOG->Trace( " sDevice: %s, iBus: %d, iLevel: %d, iPort: %d, id: %04X:%04X, Vendor: '%s', Product: '%s', sSerial: \"%s\", sOsMountDir: %s, bUsePmount: %d",
+ usbd.sDevice.c_str(), usbd.iBus, usbd.iLevel, usbd.iPort, usbd.idVendor, usbd.idProduct, usbd.sVendor.c_str(),
+ usbd.sProduct.c_str(), usbd.sSerial.c_str(), usbd.sOsMountDir.c_str(), usbd.bUsePmount );
+ }
LOG->Trace( "Done with GetUSBStorageDevices" );
}
{
ASSERT( !pDevice->sDevice.empty() );
- CString sCommand = "mount " + pDevice->sDevice;
- bool bMountedSuccessfully = ExecuteCommand( sCommand );
+ CString sCommand;
+ if( pDevice->bUsePmount )
+ sCommand = "pmount " + pDevice->sDevice + " " + pDevice->sPmountLabel;
+ else
+ sCommand = "mount " + pDevice->sDevice;
+ bool bMountedSuccessfully = ExecuteCommand( sCommand );
return bMountedSuccessfully;
}
* by new devices until those are closed. Without this, if something
* causes the device to not unmount here, we'll never unmount it; that
* causes a device name leak, eventually running us out of mountpoints. */
- CString sCommand = "sync; umount -l \"" + pDevice->sDevice + "\"";
+ CString sCommand = "sync; ";
+ if( pDevice->bUsePmount )
+ sCommand += "pumount \"" + pDevice->sDevice + "\"";
+ else
+ sCommand += "umount -l \"" + pDevice->sDevice + "\"";
ExecuteCommand( sCommand );
}