diff options
author | Daid <Daid303@gmail.com> | 2013-05-17 16:01:22 +0400 |
---|---|---|
committer | Daid <Daid303@gmail.com> | 2013-05-17 16:01:22 +0400 |
commit | 9b26b5b9330fd5fa1462e9d1792e3c9f8bc589ad (patch) | |
tree | 045b6416afc6f24395464a02d75d02a0b8e95746 | |
parent | 45ff62465105653b312a9ae05290afaadf729d25 (diff) |
Detect internal SDCard readers.
-rw-r--r-- | Cura/util/removableStorage.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Cura/util/removableStorage.py b/Cura/util/removableStorage.py index daf5dbb5e7..1eb807d9a0 100644 --- a/Cura/util/removableStorage.py +++ b/Cura/util/removableStorage.py @@ -88,6 +88,21 @@ def getPossibleSDcardDrives(): if 'mount_point' in vol: volume = vol['mount_point'] drives.append((os.path.basename(volume), volume, os.path.basename(volume))) + + p = subprocess.Popen(['system_profiler', 'SPCardReaderDataType', '-xml'], stdout=subprocess.PIPE) + xml = ElementTree.fromstring(p.communicate()[0]) + p.wait() + + xml = _parseStupidPListXML(xml) + for entry in xml: + if '_items' in entry: + for item in entry['_items']: + for dev in item['_items']: + if 'removable_media' in dev and dev['removable_media'] == 'yes' and 'volumes' in dev and len(dev['volumes']) > 0: + for vol in dev['volumes']: + if 'mount_point' in vol: + volume = vol['mount_point'] + drives.append((os.path.basename(volume), volume, os.path.basename(volume))) else: for volume in glob.glob('/media/*'): drives.append((os.path.basename(volume), volume, os.path.basename(volume))) |