Skip to content

Commit bb2dbf4

Browse files
authored
Merge pull request #5379 from dhalbert/improve-usb_hid-Device-doc
Correct and improve usb_hid.Device doc
2 parents 9689022 + 2477424 commit bb2dbf4

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

shared-bindings/usb_hid/Device.c

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,29 @@
3939
//| not verified for correctness; it is up to you to make sure it is not malformed.
4040
//| :param int usage_page: The Usage Page value from the descriptor. Must match what is in the descriptor.
4141
//| :param int usage: The Usage value from the descriptor. Must match what is in the descriptor.
42-
//| :param int report_ids: Sequence of report ids used by the descriptor.
43-
//| If the ``report_descriptor`` does not have a report ID, use 0.
44-
//| :param int in_report_lengths: Sequence of sizes in bytes of the HIDs report sent to the host.
42+
//| :param Sequence[int] report_ids: Sequence of report ids used by the descriptor.
43+
//| If the ``report_descriptor`` does not specify any report IDs, use ``(0,)``.
44+
//| :param Sequence[int] in_report_lengths: Sequence of sizes in bytes of the HID reports sent to the host.
4545
//| The sizes are in order of the ``report_ids``.
46+
//| Use a size of ``0`` for a report that is not an IN report.
4647
//| "IN" is with respect to the host.
47-
//| :param int out_report_lengths: Size in bytes of the HID report received from the host.
48+
//| :param int out_report_lengths: Sequence of sizes in bytes of the HID reports received from the host.
4849
//| The sizes are in order of the ``report_ids``.
50+
//| Use a size of ``0`` for a report that is not an OUT report.
4951
//| "OUT" is with respect to the host.
5052
//|
5153
//| ``report_ids``, ``in_report_lengths``, and ``out_report_lengths`` must all be the same length.
54+
//|
55+
//| Here is an example of a `Device` with a descriptor that specifies two report IDs, 3 and 4.
56+
//| Report ID 3 sends an IN report of length 5, and receives an OUT report of length 6.
57+
//| Report ID 4 sends an IN report of length 2, and does not receive an OUT report::
58+
//|
59+
//| device = usb_hid.Device(
60+
//| descriptor=b"...", # Omitted for brevity.
61+
//| report_ids=(3, 4),
62+
//| in_report_lengths=(5, 2),
63+
//| out_report_lengths=(6, 0),
64+
//| )
5265
//| """
5366
//| ...
5467
//|

0 commit comments

Comments
 (0)