cancel
Showing results for 
Search instead for 
Did you mean: 

How to send 16 bytes of data from USB keyboard(Using HID class ) to PC.I have sent 8 byte data it working properly. Unable to send 16 byte data.

Bs.1
Associate II

I have done setting in Report descriptor as below,

 0x05, 0x01,          // USAGE_PAGE (Generic Desktop)

   0x09, 0x06,          // USAGE (Keyboard)

   0xa1, 0x01,          // COLLECTION (Application)

   0x75, 0x01,          //  REPORT_SIZE (1)

   0x95, 0x08,          //  REPORT_COUNT (8)

   0x05, 0x07,          //  USAGE_PAGE (Keyboard)(Key Codes)

   0x19, 0xe0,          //  USAGE_MINIMUM (Keyboard LeftControl)(224)

   0x29, 0xe7,          //  USAGE_MAXIMUM (Keyboard Right GUI)(231)

   0x15, 0x00,          //  LOGICAL_MINIMUM (0)

   0x25, 0x01,          //  LOGICAL_MAXIMUM (1)

   0x81, 0x02,          //  INPUT (Data,Var,Abs) ; Modifier byte

//   0x95, 0x01,          //  REPORT_COUNT (1)

 0x95,0x10,

//   0x75, 0x08,          //  REPORT_SIZE (8)

    0x75, 0x10,

   0x81, 0x03,          //  INPUT (Cnst,Var,Abs) ; Reserved byte

   0x95, 0x05,          //  REPORT_COUNT (5)

//   0x75, 0x01,          //  REPORT_SIZE (1)

 0x75, 0x10,

   0x05, 0x08,          //  USAGE_PAGE (LEDs)

   0x19, 0x01,          //  USAGE_MINIMUM (Num Lock)

   0x29, 0x05,          //  USAGE_MAXIMUM (Kana)

   0x91, 0x02,          //  OUTPUT (Data,Var,Abs) ; LED report

   0x95, 0x01,          //  REPORT_COUNT (1)

//   0x75, 0x03,          //  REPORT_SIZE (3)

 0x75, 0x10,

   0x91, 0x03,          //  OUTPUT (Cnst,Var,Abs) ; LED report padding

   0x95, 0x06,          //  REPORT_COUNT (6)

//   0x75, 0x08,          //  REPORT_SIZE (8)

 0x75, 0x10,

   0x15, 0x00,          //  LOGICAL_MINIMUM (0)

   0x25, 0x65,          //  LOGICAL_MAXIMUM (101)

   0x05, 0x07,          //  USAGE_PAGE (Keyboard)(Key Codes)

   0x19, 0x00,          //  USAGE_MINIMUM (Reserved (no event indicated))(0)

   0x29, 0x65,          //  USAGE_MAXIMUM (Keyboard Application)(101)

   0x81, 0x00,          //  INPUT (Data,Ary,Abs)

   0xc0              //  END_COLLECTION

HID.h file

#define HID_EPIN_ADDR         0x81U

#define HID_EPIN_SIZE         0x10 //0x08U

#define HID_EPOUT_ADDR        0x01

#define HID_EPOUT_SIZE        0x01

#define USB_HID_CONFIG_DESC_SIZ    34U

#define USB_HID_DESC_SIZ       16U //9U

#define HID_MOUSE_REPORT_DESC_SIZE  63U //74U

#define HID_DESCRIPTOR_TYPE      0x21U

#define HID_REPORT_DESC        0x22U

#ifndef HID_HS_BINTERVAL

#define HID_HS_BINTERVAL      0x07U

#endif /* HID_HS_BINTERVAL */

#ifndef HID_FS_BINTERVAL

#define HID_FS_BINTERVAL      0x0AU

#endif /* HID_FS_BINTERVAL */

#define HID_REQ_SET_PROTOCOL     0x0BU

#define HID_REQ_GET_PROTOCOL     0x03U

#define HID_REQ_SET_IDLE       0x0AU

#define HID_REQ_GET_IDLE       0x02U

#define HID_REQ_SET_REPORT      0x09U

#define HID_REQ_GET_REPORT      0x01U

HId.c file

 0x03,     /*bInterfaceClass: HID*/

 0x00,     /*bInterfaceSubClass : 1=BOOT, 0=no boot previously was 1*/

 0x01,     /*nInterfaceProtocol : 0=none, 1=keyboard, 2=mouse*/

0 REPLIES 0