Added recognition of /dev/mmcblk* SD/MMC devices

svn path=/trunk/; revision=1079
This commit is contained in:
Curtis Gedak 2009-02-25 20:42:44 +00:00
parent 93bacdc1bc
commit 14363d96f4
2 changed files with 39 additions and 30 deletions

View File

@ -1,3 +1,8 @@
2009-02-25 Curtis Gedak <gedakc@gmail.com>
* src/GParted_Core.cc: Added recognition of /dev/mmcblk* SD/MMC devices.
- Closes GParted bug #564985
2009-02-23 Curtis Gedak <gedakc@gmail.com> 2009-02-23 Curtis Gedak <gedakc@gmail.com>
* include/Utils.h, * include/Utils.h,

View File

@ -173,36 +173,40 @@ void GParted_Core::set_devices( std::vector<Device> & devices )
// //
//try to find all available devices //try to find all available devices
std::ifstream proc_partitions( "/proc/partitions" ) ; std::ifstream proc_partitions( "/proc/partitions" ) ;
if ( proc_partitions ) if ( proc_partitions )
{ {
//parse device names from /proc/partitions //parse device names from /proc/partitions
std::string line ; std::string line ;
std::string device ; std::string device ;
while ( getline( proc_partitions, line ) ) while ( getline( proc_partitions, line ) )
{ {
//Whole disk devices are the ones we want. //Whole disk devices are the ones we want.
//Device names without a trailing digit refer to the whole disk. //Device names without a trailing digit refer to the whole disk.
device = Utils::regexp_label(line, "^[\t ]+[0-9]+[\t ]+[0-9]+[\t ]+[0-9]+[\t ]+([^0-9]+)$") ; device = Utils::regexp_label(line, "^[\t ]+[0-9]+[\t ]+[0-9]+[\t ]+[0-9]+[\t ]+([^0-9]+)$") ;
//Device names that end with a #[^p]# are HP Smart Array Devices (disks) //Recognize /dev/mmcblk* devices.
//E.g., device = /dev/cciss/c0d0, partition = /dev/cciss/c0d0p1 //E.g., device = /dev/mmcblk0, partition = /dev/mmcblk0p1
if ( device == "" ) if ( device == "" )
device = Utils::regexp_label(line, "^[\t ]+[0-9]+[\t ]+[0-9]+[\t ]+[0-9]+[\t ]+(.*[0-9]+[^p]{1}[0-9]+)$") ; device = Utils::regexp_label(line, "^[\t ]+[0-9]+[\t ]+[0-9]+[\t ]+[0-9]+[\t ]+(mmcblk[0-9]+)$") ;
if ( device != "" ) //Device names that end with a #[^p]# are HP Smart Array Devices (disks)
{ //E.g., device = /dev/cciss/c0d0, partition = /dev/cciss/c0d0p1
//try to have libparted detect the device and add it to the list if ( device == "" )
device = "/dev/" + device; device = Utils::regexp_label(line, "^[\t ]+[0-9]+[\t ]+[0-9]+[\t ]+[0-9]+[\t ]+(.*[0-9]+[^p]{1}[0-9]+)$") ;
/*TO TRANSLATORS: looks like Scanning /dev/sda */ if ( device != "" )
set_thread_status_message( String::ucompose ( _("Scanning %1"), device ) ) ; {
ped_device_get( device .c_str() ) ; //try to have libparted detect the device and add it to the list
} device = "/dev/" + device;
} /*TO TRANSLATORS: looks like Scanning /dev/sda */
proc_partitions .close() ; set_thread_status_message( String::ucompose ( _("Scanning %1"), device ) ) ;
} ped_device_get( device .c_str() ) ;
else }
{ }
//file /proc/partitions doesn't exist so use libparted to probe devices proc_partitions .close() ;
ped_device_probe_all(); }
} else
{
//file /proc/partitions doesn't exist so use libparted to probe devices
ped_device_probe_all();
}
lp_device = ped_device_get_next( NULL ); lp_device = ped_device_get_next( NULL );
while ( lp_device ) while ( lp_device )