Dan K

USB_HID_SET_REPORT_REQUEST does not work correctly

Discussion created by Dan K on Jun 13, 2015
Latest reply on Sep 7, 2015 by Iva Dorazinova

Using the latest Freescale Kinetis Software Development Kit (Kinetis SDK 1.2.0), discovered that the USB_HID_SET_REPORT_REQUEST
operation in the example application USB_App_Class_Callback() function (see hid_mouse or hid_keyboard demo_apps examples) does not work correctly. When the USB host sends a "Set Report" request, the "data" pointer referenced is always a NULL.

 

Investigating this, I determined that there appears to be a problem with the USB_Control_Service() function in the usb_framework.c file. In this function, the local "data" variable is always initialized to NULL and never changed before being passed to a callback function (eventually calling the application's USB_App_Class_Callback() function). I was able to get it to work by adding the following line: (shown in bold)

 

Line
448       /* class or vendor request */
449       size = event->len + USB_SETUP_PKT_SIZE;
        data = event->buffer_ptr;               // DLK added this bug fix
450       error = usb_fw_ptr->request_notify_callback(

 

Dan

Outcomes