2003-12-17 10:20:53 +00:00
|
|
|
#ifndef MEMORY_CARD_ENUMERATOR_H
|
|
|
|
|
#define MEMORY_CARD_ENUMERATOR_H 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct UsbStorageDevice
|
|
|
|
|
{
|
2003-12-18 07:46:21 +00:00
|
|
|
UsbStorageDevice() { MakeBlank(); }
|
|
|
|
|
|
|
|
|
|
void MakeBlank()
|
2003-12-17 10:20:53 +00:00
|
|
|
{
|
|
|
|
|
iBus = -1;
|
|
|
|
|
iDeviceOnBus = -1;
|
|
|
|
|
iPortOnHub = -1;
|
|
|
|
|
iUsbStorageIndex = -1;
|
|
|
|
|
};
|
|
|
|
|
int iBus;
|
|
|
|
|
int iDeviceOnBus;
|
|
|
|
|
int iPortOnHub;
|
|
|
|
|
CString sSerial;
|
|
|
|
|
int iUsbStorageIndex;
|
|
|
|
|
CString sOsMountDir; // WITHOUT trailing slash
|
|
|
|
|
|
2003-12-18 07:46:21 +00:00
|
|
|
bool IsBlank() { return sOsMountDir.empty(); }
|
|
|
|
|
|
2003-12-17 10:20:53 +00:00
|
|
|
bool operator==(const UsbStorageDevice& other)
|
|
|
|
|
{
|
2003-12-18 07:46:21 +00:00
|
|
|
// ugly...
|
|
|
|
|
#if _WINDOWS
|
|
|
|
|
// we don't have hub/port number info on Windows
|
|
|
|
|
return sOsMountDir==other.sOsMountDir; // every time a device is plugged in, it gets a unique device number
|
|
|
|
|
#else // LINUX or other
|
|
|
|
|
return iBus==other.iBus &&
|
|
|
|
|
iDeviceOnBus==other.iDeviceOnBus; // every time a device is plugged in, it gets a unique device number
|
|
|
|
|
#endif
|
2003-12-17 10:20:53 +00:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class MemoryCardDriver
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
MemoryCardDriver() {};
|
|
|
|
|
virtual ~MemoryCardDriver() {};
|
|
|
|
|
virtual bool StorageDevicesChanged() = 0;
|
|
|
|
|
virtual void GetStorageDevices( vector<UsbStorageDevice>& vStorageDevicesOut ) = 0;
|
|
|
|
|
virtual bool MountAndTestWrite( UsbStorageDevice* pDevice ) = 0; // return false if mount or write fails
|
|
|
|
|
virtual void Unmount( UsbStorageDevice* pDevice ) = 0;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2003 by the person(s) listed below. All rights reserved.
|
|
|
|
|
* Chris Danford
|
|
|
|
|
*/
|