How to send Keyboard values in HID with Report ID?

1k views Asked by At

I am using below descriptor to send key values from keypad over HID bluetooth.

    USAGE_PAGE(1),      0x01,      
    USAGE(1),           0x06,      
    COLLECTION(1),      0x01,      
    REPORT_ID(1),        0x02,
    USAGE_PAGE(1),      0x07,      
    USAGE_MINIMUM(1), (byte) 0xE0,
    USAGE_MAXIMUM(1), (byte) 0xE7,
    LOGICAL_MINIMUM(1), 0x00,
    LOGICAL_MAXIMUM(1), 0x01,
    REPORT_SIZE(1),     0x01,      
    REPORT_COUNT(1),    0x08,
    INPUT(1),           0x02,    
    REPORT_COUNT(1),    0x01,     
    REPORT_SIZE(1),     0x08,
    INPUT(1),           0x01,       
    REPORT_COUNT(1),    0x05,      
    REPORT_SIZE(1),     0x01,
    USAGE_PAGE(1),      0x08,       
    USAGE_MINIMUM(1),   0x01,       
    USAGE_MAXIMUM(1),   0x05,      
    OUTPUT(1),          0x02,      
    REPORT_COUNT(1),    0x01,     
    REPORT_SIZE(1),     0x03,
    OUTPUT(1),          0x01,      
    REPORT_COUNT(1),    0x06,       
    REPORT_SIZE(1),     0x08,
    LOGICAL_MINIMUM(1), 0x00,
    LOGICAL_MAXIMUM(1), 0x65,       
    USAGE_PAGE(1),      0x07,       
    USAGE_MINIMUM(1),   0x00,
    USAGE_MAXIMUM(1),   0x65,
    INPUT(1),           0x00,       
    END_COLLECTION(0),

Problem that I am facing is I am able to send data but same data is being sent infinite number of time.

If I set modifier byte to 2 then everything works fine i.e uppercase latter are being sent for particular keypress but in case if i send lowercase latter data is being sent infinite number of time.

1

There are 1 answers

1
aja On BEST ANSWER

Keystrokes will appear to be received an "infinite number" of times when you forget to release the keys. The array contains the keys (up to 6 in your case) currently pressed. You need to clear the buffer to the "no event indicated" index, which in your case is 0x00. If you do not do this then the host will most likely implement the "typ-o-matic" key repeat function ... i.e. what you see when you press and hold a key on a normal keyboard.