HID Feature
I have implemented a detach feature in a HID device which report descriptor is:
const BYTE IPLB_ReportDescriptor[IPLB_SIZ_REPORT_DESC] = {
0x06, 0xA0, 0xFF, // USAGE_PAGE (Consumer Page) 0x09, 0x01, // USAGE (Consumer Control Usage 0x01) 0xA1, 0x01, // COLLECTION (Application)
//INPUT 0x09, 0x03, 0x15, 0x00, // LOGICAL_MINIMUM(0) 0x26, 0xFF, 0x00, // LOGICAL_MAXIMUM(255) 0x75, 0x08, // REPORT_SIZE 0x95, BUFFER_SIZE, // REPORT_COUNT 0x81, 0x02, // INPUT (Data, Variable,Abs)
//OUTPUT 0x09, 0x04, 0x15, 0x00, // LOGICAL_MINIMUM(0) 0x26, 0xFF, 0x00, // LOGICAL_MAXIMUM(255) 0x75, 0x08, // REPORT_SIZE 0x95, BUFFER_SIZE, // REPORT_COUNT 0x91, 0x02, // OUTPUT (Data, Variable,Abs)
//Feature 0x09, 0x05, 0x15, 0x00, // LOGICAL_MINIMUM(0) 0x26, 0xFF, 0x00, // LOGICAL_MAXIMUM(255) 0x75, 0x08, // REPORT_SIZE 0x95, BUFFER_SIZE, // REPORT_COUNT 0xB1, 0x02, // Feature (Data, Variable,Abs)
//DETACH FEATURE 0x06,0x00,0xFF, 0x09,0x55, 0x15,0x00, 0x26,0xFF,0x00, 0x75,0x08, 0x95,BUFFER_SIZE, 0xB1,0x82, 0xC0 // END_COLLECTION }
In my software I am able to detect the device, to recognize the detach feature ability using:
while ((cnt < pWalk->Caps.NumberFeatureValueCaps) { if (pValue->UsagePage == VENDOR_USAGE_PAGE) { HidDetachFound = true; break; } cnt ++; pValue++; }
but when I send the Set_feature request I have no answer from the device?!
if (!HidD_SetFeature(pWalk->HidDevice, Feature,64)) HandleTxtError("Unable to enter DFU mode: Set Feature HID Detach failed !"); else { Sleep(1000); HandleTxtSuccess("Successfully entered DFU Mode !"); AfxMessageBox("Detach command successful ! Device list refresh will be done...\n\nPlease re-select your device in DFU mode"); Refresh(); }
This set_feature request uses a control transfer (EP0) but debugging in my firmware on the USB_CORE I see no data arriving.
Does someone have an idea where the problem can be, any help will be welcome!
Hi Tsuneo!
That's exacly what I was looking for.
Just a small thing, after testing this changes I realise that after deleting there 3 lines according to your instructions, the device is not recognize anymore.
// pbLen = (*CopyRoutine)(0); // delete these lines // wLen = (WORD)((DWORD)pbLen); // pInfo->Ctrl_Info.Usb_wLength = wLen;
and with the lines the firmware never gets to this function, so I can't process the feature ...
void IPLB_Status_In(void) { if (Request == SET_REPORT) { // // Your Set_Report( Feature ) handler comes here // data is held in feature_buf[] // Request = 0; } }
Any idea what can be wrong?