diff --git a/src/arch/MemoryCard/MemoryCardDriverThreaded_Linux.cpp b/src/arch/MemoryCard/MemoryCardDriverThreaded_Linux.cpp index 03445081ae..177df7ce1a 100644 --- a/src/arch/MemoryCard/MemoryCardDriverThreaded_Linux.cpp +++ b/src/arch/MemoryCard/MemoryCardDriverThreaded_Linux.cpp @@ -8,6 +8,8 @@ #include #include #include +#include +#include #include #include @@ -169,6 +171,9 @@ void MemoryCardDriverThreaded_Linux::GetUSBStorageDevices( vectorWarn( "error reading '%s': %s", fn.c_str(), f.GetError().c_str() ); return; } - + char szScsiDevice[1024]; char szMountPoint[1024]; int iRet = sscanf( sLine, "%s %s", szScsiDevice, szMountPoint ); if( iRet != 2 ) continue; // don't process this line - - + + /* Get the real kernel device name, which should match + * the name from /sys/block, by following symlinks in + * /dev. This allows us to specify persistent names in + * /etc/fstab using things like /dev/device/by-path. */ + char szUnderlyingDevice[PATH_MAX]; + if( realpath(szScsiDevice, szUnderlyingDevice) == NULL ) + { + LOG->Warn( "realpath(\"%s\"): %s", szScsiDevice, strerror(errno) ); + continue; + } + RString sMountPoint = szMountPoint; TrimLeft( sMountPoint ); TrimRight( sMountPoint ); - + // search for the mountpoint corresponding to the device for( unsigned i=0; i