This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

HID USB support 16 bit X-axis and Y-axis

I came across the SDK document below:
For the mouse protocol, one 4-byte input report is defined:
BYTE[0]: Button state bit field.
BYTE[1]: Signed 8-bit X-axis offset since the last position.
BYTE[2]: Signed 8-bit Y-axis offset since the last position.
BYTE[3]: signed 8-bit Wheel offset since the last position.

By using the Generic HID USB instance how do I extend this 4 bytes to 6 bytes reporting to support 16 bit X-axis and Y-axis?

  • currently I am trying to get this Report Descriptor to work but it still reports 4 bytes instead of 8 bytes.

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    #define HID_GENERIC_REP_DESCRIPTOR { \
    0x05, 0x01, /* Usage Page (Generic Desktop), */ \
    0x09, 0x02, /* Usage (Mouse), */ \
    0xA1, 0x01, /* Collection (Application), */ \
    0x09, 0x01, /* Usage (Pointer), */ \
    0xA1, 0x00, /* Collection (Physical), */ \
    0x05, 0x09, /* Usage Page (Buttons), */ \
    0x19, 0x01, /* Usage Minimum (01), */ \
    0x29, 0x03, /* Usage Maximum (03), 3 buttons */ \
    0x15, 0x00, /* Logical Minimum (0), */ \
    0x25, 0x01, /* Logical Maximum (1), */ \
    0x75, 0x01, /* Report Size (1), */ \
    0x95, 0x03, /* Report Count (3), */ \
    0x81, 0x02, /* Input (Data, Variable, Absolute)*/ \
    0x75, 0x05, /* Report Size (5), 5 bit padding */ \
    0x95, 0x01, /* Report Count (1), */ \
    0x81, 0x01, /* Input (Constant), */ \
    0x05, 0x01, /* Usage Page (Generic Desktop), */ \
    0x09, 0x30, /* Usage (X), */ \
    0x09, 0x31, /* Usage (Y), */ \
    0x16, 0x01, 0x80, /* Logical Minimum (-32767), */ \
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • How to properly post source code (or any other text which requires/benefits from a mono-spaced font):

  • It does not quite help, what I need is for the X-axis and Y-axis of mouse reporting to be 16 bits instead of the default 8 bits. This 16 bits are reported count (upper and lower bytes) and not like in your document left X-axis and right X-axis. 

    Further more build is ok but when running it on the nRF52840 dongle, the USB still reports 4 bytes (button, X-axis, Y-axis and z-wheel). Each one byte making up the 4 bytes.

  • thanks for this tips.

1 2