cancel
Showing results for 
Search instead for 
Did you mean: 

[USB Host] Keyboard Output Report - How to control the 3 LEDs? (NumLock, Caps Lock and Scroll Lock status)

Not applicable

Could anyone tell how to add this functionality in the USB Host library for STM32CubeIDE?

I found this:

u8 c=3;
 
USBH_StatusTypeDef res = USBH_BUSY;
 
do {
res=USBH_Set_Report(&USB_OTG_Host_Hnd,&USB_Host,0x02,0x00,0x01,&c);
} while(res != USBH_OK);

Source: https://community.st.com/s/question/0D50X00009XkZ11/caps-lock-led-turn-onoff

I didn't find this function (USBH_Set_Report) in the library, I found only USBH_HID_SetReport, but I couldn't implement that.

Is there any ST document that talks about this?

I found a document written by Microchip:

A  standard  keyboard  has  three  LEDs  to  display  NumLock, Caps Lock and Scroll Lock status. The LEDs are absolute  output  items;  the  state  of  each  LED  must  be included in the output reports (0 = OFF, 1 = ON)

Source: http://ww1.microchip.com/downloads/en/AppNotes/01212a.pdf

12 REPLIES 12
Not applicable

Note: This code is being developed for use in this project (It's still not functional): https://github.com/rtek1000/Datalogger_2039

Pavel A.
Evangelist III

IIRC the host class examples in the ST USBH library are limited.

Every class can send few requests to the device at setup time (after enumeration) and then goes to "steady state" that in HID examples only reads input reports.

What you're looking for is how to "inject" a class specific request in the "steady" state of the HID class.

RhSilicon
Lead

Related: USB HUB support for HID HOST: https://community.st.com/s/feed/0D53W000021OPdPSAW