From 9b26b5b9330fd5fa1462e9d1792e3c9f8bc589ad Mon Sep 17 00:00:00 2001 From: Daid Date: Fri, 17 May 2013 14:01:22 +0200 Subject: [PATCH] Detect internal SDCard readers. --- Cura/util/removableStorage.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Cura/util/removableStorage.py b/Cura/util/removableStorage.py index daf5dbb5..1eb807d9 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))) -- 2.30.2