This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Emulate USB Keyboard with MCBSTM32Exl

Hi,

I use the board MCBSTM32Exl (http://www.keil.com/arm/mcbstm32exl/) and i wanna that my Board emulate a USB HID Keyboard (When i use the push-button User, the char 'Q' is send to my PC Host). For this, i studied the STMicroelectronics' library "USB full-speed device library" (www.st.com/.../um0424.zip) and adapted interruptions/GPIOs to use this Flibrary with my Board. Also, my PC recognize the device and i successed send data (I watched with a sniffer).

But, it's not like a keyboard, i tried to change the descriptor but it does'nt work (for exemple, my PC don't recognize the device)...

Have you any idea to help me ?

Regards,
ealary.

Parents
  • > Into the usb_desc.c, should i change anything with the Report Descriptor ? (Like, wMaxPacketSize into the Endpoint Descriptor ?)

    Ah yes, good catch.
    wMaxPacketSize of the interrupt IN endpoint descriptor increases to 8 bytes,
    to put the input report in single transaction.

    Also, the buffer size for the input report increases into 8 bytes.

    > which type of data should i insert into the buffer to send the char 'Q' for exemple ?

    As explained on SiLabs forum ( www.cygnal.org/.../001381.html ),

    At key push:
    input_report[8] = {
       0x00,   // modifier keys - nothing
       0x00,   // reserved
       0x14,   // keycode array[0] - key code of "Q"
       0x00,   // keycode array[1]
       0x00,   // keycode array[2]
       0x00,   // keycode array[3]
       0x00,   // keycode array[4]
       0x00,   // keycode array[5]
    }
    
    At key release: - all zeros:
    input_report[8] = {
       0x00,   // modifier keys - nothing
       0x00,   // reserved
       0x00,   // keycode array[0]
       0x00,   // keycode array[1]
       0x00,   // keycode array[2]
       0x00,   // keycode array[3]
       0x00,   // keycode array[4]
       0x00,   // keycode array[5]
    }
    

    Tsuneo

Reply
  • > Into the usb_desc.c, should i change anything with the Report Descriptor ? (Like, wMaxPacketSize into the Endpoint Descriptor ?)

    Ah yes, good catch.
    wMaxPacketSize of the interrupt IN endpoint descriptor increases to 8 bytes,
    to put the input report in single transaction.

    Also, the buffer size for the input report increases into 8 bytes.

    > which type of data should i insert into the buffer to send the char 'Q' for exemple ?

    As explained on SiLabs forum ( www.cygnal.org/.../001381.html ),

    At key push:
    input_report[8] = {
       0x00,   // modifier keys - nothing
       0x00,   // reserved
       0x14,   // keycode array[0] - key code of "Q"
       0x00,   // keycode array[1]
       0x00,   // keycode array[2]
       0x00,   // keycode array[3]
       0x00,   // keycode array[4]
       0x00,   // keycode array[5]
    }
    
    At key release: - all zeros:
    input_report[8] = {
       0x00,   // modifier keys - nothing
       0x00,   // reserved
       0x00,   // keycode array[0]
       0x00,   // keycode array[1]
       0x00,   // keycode array[2]
       0x00,   // keycode array[3]
       0x00,   // keycode array[4]
       0x00,   // keycode array[5]
    }
    

    Tsuneo

Children