mirror of
https://github.com/qmk/qmk_firmware.git
synced 2025-04-21 22:51:28 +00:00
hid hid_get_input_report workarounds
This commit is contained in:
parent
a43d225fae
commit
8e18f4d0fd
@ -1,13 +1,12 @@
|
|||||||
# Copyright 2022 QMK
|
# Copyright 2022 QMK
|
||||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
import hid
|
from typing import List
|
||||||
|
|
||||||
|
|
||||||
class XAPClient:
|
class XAPClient:
|
||||||
"""XAP device discovery
|
"""XAP device discovery
|
||||||
"""
|
"""
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def devices(search: str = None) -> list[dict]:
|
def devices(search: str = None) -> List[dict]:
|
||||||
"""Find compatible XAP devices
|
"""Find compatible XAP devices
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -20,6 +19,9 @@ class XAPClient:
|
|||||||
name = '%04x:%04x' % (x['vendor_id'], x['product_id'])
|
name = '%04x:%04x' % (x['vendor_id'], x['product_id'])
|
||||||
return name.lower().startswith(search.lower())
|
return name.lower().startswith(search.lower())
|
||||||
|
|
||||||
|
# lazy import to avoid compile issues
|
||||||
|
import hid
|
||||||
|
|
||||||
devices = filter(_is_xap_usage, hid.enumerate())
|
devices = filter(_is_xap_usage, hid.enumerate())
|
||||||
if search:
|
if search:
|
||||||
devices = filter(_is_filtered_device, devices)
|
devices = filter(_is_filtered_device, devices)
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
# Copyright 2022 QMK
|
# Copyright 2022 QMK
|
||||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
import hid
|
|
||||||
import json
|
import json
|
||||||
import time
|
import time
|
||||||
import gzip
|
import gzip
|
||||||
@ -40,6 +39,9 @@ class XAPDeviceBase:
|
|||||||
self.timeout = timeout
|
self.timeout = timeout
|
||||||
self.running = True
|
self.running = True
|
||||||
|
|
||||||
|
# lazy import to avoid compile issues
|
||||||
|
import hid
|
||||||
|
|
||||||
self.dev = hid.Device(path=dev['path'])
|
self.dev = hid.Device(path=dev['path'])
|
||||||
|
|
||||||
self.bg = threading.Thread(target=self._read_loop, daemon=True)
|
self.bg = threading.Thread(target=self._read_loop, daemon=True)
|
||||||
|
Loading…
Reference in New Issue
Block a user