Skip to content

Commit 36a3ece

Browse files
author
kolten
committed
usb-device-hid: Enable configuring the bInterval on hid devices.
Signed-off-by: kolten <koltenpearson@fastmail.com>
1 parent 6ae440a commit 36a3ece

File tree

1 file changed

+5
-1
lines changed
  • micropython/usb/usb-device-hid/usb/device

1 file changed

+5
-1
lines changed

micropython/usb/usb-device-hid/usb/device/hid.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ def __init__(
6464
set_report_buf=None,
6565
protocol=_INTERFACE_PROTOCOL_NONE,
6666
interface_str=None,
67+
binterval=8,
6768
):
6869
# Construct a new HID interface.
6970
#
@@ -85,12 +86,15 @@ def __init__(
8586
# - protocol can be set to a specific value as per HID v1.11 section 4.3 Protocols, p9.
8687
#
8788
# - interface_str is an optional string descriptor to associate with the HID USB interface.
89+
#
90+
# - binterval this is the polling rate the device will request the host use in milliseconds.
8891
super().__init__()
8992
self.report_descriptor = report_descriptor
9093
self.extra_descriptors = extra_descriptors
9194
self._set_report_buf = set_report_buf
9295
self.protocol = protocol
9396
self.interface_str = interface_str
97+
self.binterval = binterval
9498

9599
self._int_ep = None # set during enumeration
96100

@@ -150,7 +154,7 @@ def desc_cfg(self, desc, itf_num, ep_num, strs):
150154
# Add the typical single USB interrupt endpoint descriptor associated
151155
# with a HID interface.
152156
self._int_ep = ep_num | _EP_IN_FLAG
153-
desc.endpoint(self._int_ep, "interrupt", 8, 8)
157+
desc.endpoint(self._int_ep, "interrupt", 8, self.binterval)
154158

155159
self.idle_rate = 0
156160

0 commit comments

Comments
 (0)