diff --git a/stepmania/src/arch/MemoryCard/MemoryCardDriver.h b/stepmania/src/arch/MemoryCard/MemoryCardDriver.h index fb98d88b15..cf06e9aa3c 100644 --- a/stepmania/src/arch/MemoryCard/MemoryCardDriver.h +++ b/stepmania/src/arch/MemoryCard/MemoryCardDriver.h @@ -19,6 +19,7 @@ struct UsbStorageDevice bWriteTestSucceeded = false; sName = ""; idVendor = 0; + idProduct = 0; sVendor = ""; sProduct = ""; }; @@ -33,6 +34,7 @@ struct UsbStorageDevice bool bWriteTestSucceeded; // only valid if bNeedsWriteTest == false CString sName; // Name in the profile on the memory card. int idVendor; + int idProduct; CString sVendor; CString sProduct; diff --git a/stepmania/src/arch/MemoryCard/MemoryCardDriverThreaded_Linux.cpp b/stepmania/src/arch/MemoryCard/MemoryCardDriverThreaded_Linux.cpp index 481b80c38f..0c031bea14 100644 --- a/stepmania/src/arch/MemoryCard/MemoryCardDriverThreaded_Linux.cpp +++ b/stepmania/src/arch/MemoryCard/MemoryCardDriverThreaded_Linux.cpp @@ -334,41 +334,45 @@ void MemoryCardDriverThreaded_Linux::MountThreadDoOneUpdate() CHECKPOINT; } -static const int g_iAllowedVendorIds[] = +struct WhiteListEntry +{ + int idVendor; // -1 = "always match" + int idProduct; // -1 = "always match" + const char *szVendorRegex; // empty string matches all + const char *szProductRegex; // empty string matches all +}; +static const WhiteListEntry g_AllowedEntries[] = { - 0x0781, // SanDisk Corp. - //0x045a, // Diamond Multimedia Systems (Rio) + { 0x0781, -1, "", "" }, // all SanDisk Cruizer drives // Disallow the Rio Carbon. After several mounts, usb-storage gets into a state where mounting will fail. - 0x04e8, // Samsung Electronics Co., Ltd. (Kingston) - 0x05dc, // Lexar Media, Inc. + // { 0x045a, -1, "", "" }, // Diamond Multimedia Systems (Rio) + { 0x04e8, -1, "Kingston|KINGSTON", "" }, // Kingston pen drives manufactured by Samsung + { 0x05dc, -1, "", "" }, // All Lexar flash drives + { 0x041e, -1, "", "^NOMAD MuVo$|^NOMAD MuVo .X" }, // Creative Labs Nomad MuVo flash drives (hard drive players excluded) }; -static const CString g_sAllowedVendorRegex[] = - { - "Kingston", - "KINGSTON", - }; -bool IsDeviceAllowed( int idVendor, CString sVendor, CString sProduct ) +bool IsDeviceAllowed( int idVendor, int idProduct, CString sVendor, CString sProduct ) { bool bAllowed = false; - vector vAllowedVendorIds( &g_iAllowedVendorIds[0], &g_iAllowedVendorIds[ARRAYSIZE(g_iAllowedVendorIds)-1] ); - vector::const_iterator iter = find( vAllowedVendorIds.begin(), vAllowedVendorIds.end(), idVendor ); - bAllowed = iter != vAllowedVendorIds.end(); - - if( !bAllowed ) + for( unsigned i=0; iTrace( "Device '%X':'%s':'%s' is %sallowed.", idVendor, sVendor.c_str(), sProduct.c_str(), bAllowed?"":"not " ); + LOG->Trace( "idVendor 0x%04X, idDevice 0x%04X, Vendor '%s', Product '%s' is %sallowed.", idVendor, idProduct, sVendor.c_str(), sProduct.c_str(), bAllowed?"":"not " ); return bAllowed; } @@ -416,7 +420,7 @@ bool ReadUsbStorageDescriptor( CString fn, int iScsiIndex, vector& vDevicesOut ) usbd.idVendor = idVendor; continue; // stop processing this line } + + // idProduct 0x4106 + int idProduct; + iRet = sscanf( sLine.c_str(), " idProduct 0x%x", &idProduct ); + if( iRet == 1 ) + { + usbd.idProduct = idProduct; + continue; // stop processing this line + } // iSerial 3 1125198948886 char szSerial[1024];