memory card work (linux update in a few minutes)

This commit is contained in:
Glenn Maynard
2005-02-06 05:11:57 +00:00
parent ca4589a8c3
commit 7a21e95ede
2 changed files with 25 additions and 8 deletions
@@ -1,5 +1,5 @@
#ifndef MEMORY_CARD_DRIVER_H #ifndef MEMORY_CARD_DRIVER_H
#define MEMORY_CARD_DRIVER_H 1 #define MEMORY_CARD_DRIVER_H
struct UsbStorageDevice struct UsbStorageDevice
{ {
@@ -13,10 +13,9 @@ struct UsbStorageDevice
iLevel = -1; iLevel = -1;
iScsiIndex = -1; iScsiIndex = -1;
sScsiDevice = ""; sScsiDevice = "";
sSerial = ""; sSerial = "<none>"; // be different than a card with no serial
sOsMountDir = ""; sOsMountDir = "";
bNeedsWriteTest = true; m_State = STATE_NONE;
bWriteTestSucceeded = false;
bIsNameAvailable = false; bIsNameAvailable = false;
sName = ""; sName = "";
idVendor = 0; idVendor = 0;
@@ -31,8 +30,26 @@ struct UsbStorageDevice
int iScsiIndex; int iScsiIndex;
CString sScsiDevice; CString sScsiDevice;
CString sOsMountDir; // WITHOUT trailing slash CString sOsMountDir; // WITHOUT trailing slash
bool bNeedsWriteTest; enum State
bool bWriteTestSucceeded; // only valid if bNeedsWriteTest == false {
/* Empty device. This is used only by MemoryCardManager. */
STATE_NONE,
/* The card has been detected, but we havn't finished write tests, loading
* the quick profile information, etc. yet. We can display something on
* screen, in order to appear responsive, show that something's happening and
* aid diagnostics, though. */
STATE_CHECKING,
/* We can't write to the device; it may be write-protected, use a filesystem
* that we don't understand, unformatted, etc. */
STATE_WRITE_ERROR,
/* The device is ready and usable. sName is filled in, if available. */
STATE_READY,
};
State m_State;
bool bIsNameAvailable; // Name in the profile on the memory card. bool bIsNameAvailable; // Name in the profile on the memory card.
CString sName; // Name in the profile on the memory card. CString sName; // Name in the profile on the memory card.
int idVendor; int idVendor;
@@ -40,7 +57,7 @@ struct UsbStorageDevice
CString sVendor; CString sVendor;
CString sProduct; CString sProduct;
bool IsBlank() const { return sOsMountDir.empty(); } bool IsBlank() const { return m_State == STATE_NONE; }
void SetOsMountDir( const CString &s ); void SetOsMountDir( const CString &s );
bool operator==(const UsbStorageDevice& other) const; bool operator==(const UsbStorageDevice& other) const;
@@ -89,7 +89,7 @@ bool MemoryCardDriverThreaded_Windows::DoOneUpdate( bool bMount, vector<UsbStora
UsbStorageDevice usbd; UsbStorageDevice usbd;
usbd.SetOsMountDir( sDrive ); usbd.SetOsMountDir( sDrive );
usbd.bWriteTestSucceeded = TestWrite( sDrive ); usbd.m_State = TestWrite( sDrive )? UsbStorageDevice::STATE_READY:UsbStorageDevice::STATE_WRITE_ERROR;
// read name // read name
this->Mount( &usbd ); this->Mount( &usbd );