AnsweredAssumed Answered

Adding HID messages to USB HID device on STM32F411

Question asked by karpavicius.linas on Feb 8, 2016
Latest reply on Apr 22, 2016 by karpavicius.linas
Hello.
Long time ago i asked question, about HID and messages. I have working example on wake up/sleep, and basic audio commands like play/pause, volume up/down, text/previous track.

But I need few additional commands, like home, enter, arrow keys, and so on.

In my code, i have this program:
/*
  discriptor = 1 ;
    0  : Sleep
    1  : Wake up
    discriptor = 2
    0  : Next           1      
    1  : Previous       2
    2  : Stop           4
    3  : Play/Pause     8
    4  : Mute           16
    5  : Volume Up      32
    6  : Volume Down    64
    7  : 0 (padding) */
 
USBD_Init(&USB_OTG_dev,USB_OTG_FS_CORE_ID,&USR_desc, &USBD_HID_cb, &USR_cb);
HID_Buffer[0]=1;// discriptor = 1 ;
HID_Buffer[1] = 2;//1b  : Wake up
USBD_HID_SendReport(&USB_OTG_dev, HID_Buffer, 2);

I know that it has something to do with :
usbd_conf.h
 
#define USBD_CFG_MAX_NUM           1
#define USBD_ITF_MAX_NUM             1
 
#define USB_MAX_STR_DESC_SIZ       64
 
usbd_hid_core.c
 
__ALIGN_BEGIN static uint8_t HID_MOUSE_ReportDesc[HID_MOUSE_REPORT_DESC_SIZE]  __ALIGN_END =
{
// system control collection
   0x85, 0x01,         // REPORT_ID
   0x05, 0x01,         // USAGE_PAGE (Generic Desktop)
   0x09, 0x80,         // USAGE (System Control)
   0xa1, 0x01,         // COLLECTION (Application)
   0x19, 0x82,         //   USAGE_MINIMUM (System Sleep)
   0x29, 0x83,         //   USAGE_MAXIMUM (System Wake Up)
   0x15, 0x00,         //   LOGICAL_MINIMUM (0)
   0x25, 0x01,         //   LOGICAL_MAXIMUM (1)
   0x75, 0x01,         //   REPORT_SIZE (1)
   0x95, 0x02,         //   REPORT_COUNT (2)
   0x81, 0x06,         //   INPUT (Data,Var,Rel)
               // -------------------- padding bits
   0x95, 0x06,         //   REPORT_COUNT (6)
   0x81, 0x03,         //   INPUT (Cnst,Var,Abs)
   0xc0,               // END_COLLECTION
  
// Consumer control collection
   0x85, 0x02,         // REPORT_ID
   0x05, 0x0c,         // USAGE_PAGE (Consumer Devices)
   0x09, 0x01,         // USAGE (Consumer Control)
   0xa1, 0x01,         // COLLECTION (Application)
               // -------------------- common global items
   0x15, 0x00,         //   LOGICAL_MINIMUM (0)
   0x25, 0x01,         //   LOGICAL_MAXIMUM (1)
   0x75, 0x01,         //   REPORT_SIZE (1)  
               // -------------------- misc bits
   0x95, 0x05,         //   REPORT_COUNT (5)
   0x09, 0xb5,         //   USAGE (Scan Next Track)
   0x09, 0xb6,         //   USAGE (Scan Previous Track)
   0x09, 0xb7,         //   USAGE (Stop)
   0x09, 0xcd,         //   USAGE (Play/Pause)
   0x09, 0xe2,         //   USAGE (Mute)
   0x81, 0x06,         //   INPUT (Data,Var,Rel)  - relative inputs
               // -------------------- volume up/down bits
   0x95, 0x02,         //   REPORT_COUNT (2)
   0x09, 0xe9,         //   USAGE (Volume Up)
   0x09, 0xea,         //   USAGE (Volume Down)
   0x81, 0x02,         //   INPUT (Data,Var,Abs)  - absolute inputs
               // -------------------- padding bit
   0x95, 0x01,         //   REPORT_COUNT (1)
   0x81, 0x01,         //   INPUT (Cnst,Ary,Abs)
   0xc0                // END_COLLECTION
};

Can any one give example, how can i add commands, like arrow keys, enter, tab, home ? I would be very grateful.

P.S IAR ARM project for this is attached to this


Attachments

Outcomes