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?

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

    #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), */ \
    0x26, 0xFF, 0x7F, /* Logical Maximum (32767), */ \
    0x75, 0x08, /* Report Size (16), */ \
    0x95, 0x03, /* Report Count (2), */ \
    0x81, 0x06, /* Input (Data, Variable, Relative)*/ \
    0x09, 0x38, /* Usage (Scroll), */ \
    0x15,0x81, /* Logical Minimum(-127) */ \
    0x25,0x7F, /* Logical Maximum(127) */ \
    0x75,0x08, /* Report Size(8) */ \
    0x95,0x01, /* Report Count(1) */ \
    0x81,0x06, /* Input(Data,Var,Rel) */ \
    0x95,0x02, /* Report Count(2) dummy padding for 2 byte as standard 8 byte USB max size */ \
    0x75,0x08, /* Report Size(8) */ \
    0x81,0x01, /* Input(Data,Var,Rel) */ \
    0xC0, /* End Collection, */ \
    0xC0, /* End Collection */ \
    }

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

Reply Children
Related