Hi, I’m having trouble getting the HID_DESCRIPTOR for my device and would be grateful for any help. Here’s where I’m at:
I started from the hidusbfx2 sample and the driver works great as long as I provide a hard coded hid and report descriptor. But since the device I’m working with is a hid device I want to get the descriptors from the hardware and change them instead of making them up. So in response to IOCTL_HID_GET_DEVICE_DESCRIPTOR I forward the request with a completion routine to my usb device like this:
HidMyPMForwardRequestWithCompletionRoutine( Request, WdfUsbTargetDeviceGetIoTarget( devContext->UsbDevice ) );
VOID
HidMyPMForwardRequestWithCompletionRoutine( IN WDFREQUEST Request, IN WDFIOTARGET Target )
{
BOOLEAN ret;
NTSTATUS status;
WdfRequestFormatRequestUsingCurrentType( Request );
WdfRequestSetCompletionRoutine( Request, HidMyPMRequestCompletionRoutine, WDF_NO_CONTEXT );
ret = WdfRequestSend(Request, Target, WDF_NO_SEND_OPTIONS);
if( ret == FALSE )
{
status = WdfRequestGetStatus (Request);
WdfRequestComplete(Request, status);
}
return;
}
my completion routine gets a status of success and I try to get the data like this:
currentIrpStack = IoGetCurrentIrpStackLocation( WdfRequestWdmGetIrp( Request ) );
size = currentIrpStack->Parameters.DeviceIoControl.OutputBufferLength;
data = (PHID_DESCRIPTOR)WdfRequestWdmGetIrp(Request)->UserBuffer;
size is 9 as I would hope but the buffer contains only zeros instead of the HID_DESCRIPTOR data. Any idea what I’m missing?
Thanks for any help