Update hidapi, improve device detection via handshake
parent
deb9c7e08f
commit
139cfae374
|
|
@ -1,7 +1,7 @@
|
||||||
altgraph==0.17
|
altgraph==0.17
|
||||||
fbs==0.9.0
|
fbs==0.9.0
|
||||||
future==0.18.2
|
future==0.18.2
|
||||||
hidapi==0.9.0.post3
|
hidapi==0.10.1
|
||||||
keyboard==0.13.5
|
keyboard==0.13.5
|
||||||
macholib==1.14
|
macholib==1.14
|
||||||
pefile==2019.4.18
|
pefile==2019.4.18
|
||||||
|
|
|
||||||
|
|
@ -187,8 +187,8 @@ class MainWindow(QMainWindow):
|
||||||
outf.write(self.keymap_editor.save_layout())
|
outf.write(self.keymap_editor.save_layout())
|
||||||
|
|
||||||
def on_click_refresh(self):
|
def on_click_refresh(self):
|
||||||
self.devices = find_vial_devices(self.via_stack_json, self.sideload_vid, self.sideload_pid)
|
|
||||||
self.combobox_devices.clear()
|
self.combobox_devices.clear()
|
||||||
|
self.devices = find_vial_devices(self.via_stack_json, self.sideload_vid, self.sideload_pid)
|
||||||
|
|
||||||
for dev in self.devices:
|
for dev in self.devices:
|
||||||
self.combobox_devices.addItem(dev.title())
|
self.combobox_devices.addItem(dev.title())
|
||||||
|
|
|
||||||
|
|
@ -47,9 +47,27 @@ def hid_send(dev, msg, retries=1):
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
||||||
def is_rawhid(dev):
|
def is_rawhid(desc):
|
||||||
# TODO: this is only broken on linux, other platforms should be able to check usage_page
|
if desc["usage_page"] != 0xFF60 or desc["usage"] != 0x61:
|
||||||
return dev["interface_number"] == 1
|
return False
|
||||||
|
|
||||||
|
dev = hid.device()
|
||||||
|
|
||||||
|
try:
|
||||||
|
dev.open_path(desc["path"])
|
||||||
|
except OSError:
|
||||||
|
return False
|
||||||
|
|
||||||
|
# probe VIA version and ensure it is supported
|
||||||
|
data = b""
|
||||||
|
try:
|
||||||
|
data = hid_send(dev, b"\x01", retries=3)
|
||||||
|
except RuntimeError:
|
||||||
|
pass
|
||||||
|
dev.close()
|
||||||
|
|
||||||
|
# must have VIA protocol version = 9
|
||||||
|
return data[0:3] == b"\x01\x00\x09"
|
||||||
|
|
||||||
|
|
||||||
def find_vial_devices(via_stack_json, sideload_vid=None, sideload_pid=None):
|
def find_vial_devices(via_stack_json, sideload_vid=None, sideload_pid=None):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue