Better interface filter, OSX portability

This commit is contained in:
BTChip github 2018-03-12 19:21:16 +01:00
parent ede307f9d0
commit ab589175f3
No known key found for this signature in database
GPG Key ID: 48BCF826EBFA4D17
1 changed files with 3 additions and 2 deletions

View File

@ -190,8 +190,9 @@ def getDongle(debug=False, selectCommand=None):
hidDevicePath = None
ledger = True
for hidDevice in hid.enumerate(0, 0):
if hidDevice['vendor_id'] == 0x2c97 and ('interface_number' not in hidDevice or hidDevice['interface_number'] == 0):
hidDevicePath = hidDevice['path']
if hidDevice['vendor_id'] == 0x2c97:
if ('interface_number' in hidDevice and hidDevice['interface_number'] == 0) or ('usage_page' in hidDevice and hidDevice['usage_page'] == 0xffa0):
hidDevicePath = hidDevice['path']
if hidDevicePath is not None:
dev = hid.device()
dev.open_path(hidDevicePath)