From 14363d96f4069365ce49d6fd39b7ad9cf1bf493e Mon Sep 17 00:00:00 2001 From: Curtis Gedak Date: Wed, 25 Feb 2009 20:42:44 +0000 Subject: [PATCH] Added recognition of /dev/mmcblk* SD/MMC devices svn path=/trunk/; revision=1079 --- ChangeLog | 5 ++++ src/GParted_Core.cc | 64 ++++++++++++++++++++++++--------------------- 2 files changed, 39 insertions(+), 30 deletions(-) diff --git a/ChangeLog b/ChangeLog index 63f40759..61d6a431 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-02-25 Curtis Gedak + + * src/GParted_Core.cc: Added recognition of /dev/mmcblk* SD/MMC devices. + - Closes GParted bug #564985 + 2009-02-23 Curtis Gedak * include/Utils.h, diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc index 420f9e48..fa6179b3 100644 --- a/src/GParted_Core.cc +++ b/src/GParted_Core.cc @@ -173,36 +173,40 @@ void GParted_Core::set_devices( std::vector & devices ) // //try to find all available devices std::ifstream proc_partitions( "/proc/partitions" ) ; - if ( proc_partitions ) - { - //parse device names from /proc/partitions - std::string line ; - std::string device ; - while ( getline( proc_partitions, line ) ) - { - //Whole disk devices are the ones we want. - //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 names that end with a #[^p]# are HP Smart Array Devices (disks) - //E.g., device = /dev/cciss/c0d0, partition = /dev/cciss/c0d0p1 - if ( device == "" ) - device = Utils::regexp_label(line, "^[\t ]+[0-9]+[\t ]+[0-9]+[\t ]+[0-9]+[\t ]+(.*[0-9]+[^p]{1}[0-9]+)$") ; - if ( device != "" ) - { - //try to have libparted detect the device and add it to the list - device = "/dev/" + device; - /*TO TRANSLATORS: looks like Scanning /dev/sda */ - set_thread_status_message( String::ucompose ( _("Scanning %1"), device ) ) ; - ped_device_get( device .c_str() ) ; - } - } - proc_partitions .close() ; - } - else - { - //file /proc/partitions doesn't exist so use libparted to probe devices - ped_device_probe_all(); - } + if ( proc_partitions ) + { + //parse device names from /proc/partitions + std::string line ; + std::string device ; + while ( getline( proc_partitions, line ) ) + { + //Whole disk devices are the ones we want. + //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]+)$") ; + //Recognize /dev/mmcblk* devices. + //E.g., device = /dev/mmcblk0, partition = /dev/mmcblk0p1 + if ( device == "" ) + device = Utils::regexp_label(line, "^[\t ]+[0-9]+[\t ]+[0-9]+[\t ]+[0-9]+[\t ]+(mmcblk[0-9]+)$") ; + //Device names that end with a #[^p]# are HP Smart Array Devices (disks) + //E.g., device = /dev/cciss/c0d0, partition = /dev/cciss/c0d0p1 + if ( device == "" ) + device = Utils::regexp_label(line, "^[\t ]+[0-9]+[\t ]+[0-9]+[\t ]+[0-9]+[\t ]+(.*[0-9]+[^p]{1}[0-9]+)$") ; + if ( device != "" ) + { + //try to have libparted detect the device and add it to the list + device = "/dev/" + device; + /*TO TRANSLATORS: looks like Scanning /dev/sda */ + set_thread_status_message( String::ucompose ( _("Scanning %1"), device ) ) ; + ped_device_get( device .c_str() ) ; + } + } + proc_partitions .close() ; + } + else + { + //file /proc/partitions doesn't exist so use libparted to probe devices + ped_device_probe_all(); + } lp_device = ped_device_get_next( NULL ); while ( lp_device )