diff --git a/mbed_lstools/lstools_darwin.py b/mbed_lstools/lstools_darwin.py index 5c179ed..1bc3412 100644 --- a/mbed_lstools/lstools_darwin.py +++ b/mbed_lstools/lstools_darwin.py @@ -96,16 +96,26 @@ def get_mbed_volumes(self): ''' returns a map {volume_id: {serial:, vendor_id:, product_id:, tty:}''' # to find all the possible mbed volumes, we look for registry entries - # under the USB bus which have a "BSD Name" that starts with "disk" + # under all possible USB bus which have a "BSD Name" that starts with "disk" # (i.e. this is a USB disk), and have a IORegistryEntryName that # matches /\cmbed/ # Once we've found a disk, we can search up for a parent with a valid # serial number, and then search down again to find a tty that's part # of the same composite device - # ioreg -a -r -n "AppleUSBXHCI" -l - ioreg_usb = subprocess.Popen(['ioreg', '-a', '-r', '-n', 'AppleUSBXHCI', '-l'], stdout=subprocess.PIPE) - usb_bus = plistlib.readPlist(ioreg_usb.stdout) - ioreg_usb.wait() + # ioreg -a -r -n -l + usb_controllers = ['AppleUSBXHCI', 'AppleUSBUHCI', 'AppleUSBEHCI', 'AppleUSBOHCI'] + usb_bus = [] + + for usb_controller in usb_controllers: + ioreg_usb = subprocess.Popen(['ioreg', '-a', '-r', '-n', usb_controller, '-l'], stdout=subprocess.PIPE) + + try: + usb_bus = usb_bus + plistlib.readPlist(ioreg_usb.stdout) + except: + # Catch when no output is returned from ioreg command + pass + + ioreg_usb.wait() r = {}