2014-08-21 11:53 PM
I want to turn on/off keyboard led using STM32F4 Discovery HID example.. Keys are working fine.I have problem with output Set_report. Led is not turning on/off although it seems i am sending correct request.I am sending following 1 byte control output report each time a key is pressed to turn on caps lock led as follows:
USBH_Set_Report(&USB_OTG_Core_dev , &USB_Host,0x00,0x02,1,(uint8_t *)0x02);USBH_Status USBH_Set_Report (USB_OTG_CORE_HANDLE *pdev, USBH_HOST *phost, uint8_t reportType, uint8_t reportId, uint8_t reportLen, uint8_t* reportBuff){ phost->Control.setup.b.bmRequestType = USB_H2D | USB_REQ_RECIPIENT_INTERFACE |\ USB_REQ_TYPE_CLASS; phost->Control.setup.b.bRequest = USB_HID_SET_REPORT; phost->Control.setup.b.wValue.w = (reportType << 8 ) | reportId; phost->Control.setup.b.wIndex.w = 0; phost->Control.setup.b.wLength.w = reportLen; return USBH_CtlReq(pdev, phost, reportBuff , reportLen );}can anyone tell me,what i am doing wrong here? thanks. #keyboard #hid #usb2014-08-27 10:34 AM
I have same issue. Have you fix it? Version of library isV2.1.0
u8 c=3;
res=USBH_Set_Report(&USB_OTG_Host_Hnd,&USB_Host,0x00,0x00,0x01,&c);
//res allwaysUSBH_BUSY
2014-08-27 10:37 AM
2014-08-28 04:58 AM
I fix my request: USBH_Set_Report(pdev,phost,0x02,0x00,0x01,&c); But result strange - the keyboard begin sending packets with 0 and caps lock turns on regardless of �?.
2014-08-28 07:16 AM
With software usb sniffer i found that computer sends such requests several(6) times. So i just sent several requests in main cycle and all works fine. ^_^ After each request it must be processed with USBH_Process.
2018-12-20 05:45 AM
You need wait for USBH_OK
[code]
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);
[/code]
2019-01-27 08:59 AM
can you share your code
2019-01-27 09:30 AM
Thread is from 4+ years ago, it is quite likely the respondent will not get email alerts or currently monitor the forum.