diff --git a/trezorlib/transport_hid.py b/trezorlib/transport_hid.py index a93d12bb76..bb1f9adf9e 100644 --- a/trezorlib/transport_hid.py +++ b/trezorlib/transport_hid.py @@ -31,7 +31,7 @@ class HidTransport(Transport): # decide if the HID interface is normal transport # or debuglink - if platform.system() in ('Linux', 'Darwin'): + if platform.system() == 'Linux': # Sample: 0003:0017:00 if path.endswith(':00'): return False @@ -44,6 +44,10 @@ class HidTransport(Transport): return True return False + elif platform.system() == 'Darwin': + # DebugLink doesn't work on Mac + return False + else: raise Exception("USB interface detection not implemented for %s" % platform.system()) @@ -56,6 +60,11 @@ class HidTransport(Transport): serial_number = d['serial_number'] path = d['path'] + # HIDAPI on Mac cannot detect correct HID interfaces, so device with + # DebugLink doesn't work on Mac... + if devices.get(serial_number) != None and devices[serial_number][0] == path: + raise Exception("Two devices with the same path and S/N found. This is Mac, right? :-/") + if (vendor_id, product_id) in DEVICE_IDS: devices.setdefault(serial_number, [None, None]) devices[serial_number][int(bool(cls._detect_debuglink(path)))] = path