[libhid-discuss] libhid USB error: error sending control message: Protocol error

hatmakers hatmakers at cableone.net
Mon Mar 12 02:42:34 CET 2007



On Sun Mar 11 14:19 , Charles Lepple  sent:

>On Mar 11, 2007, at 3:55 PM, hatmakers wrote:
>
>>> So the only thing that I can think of is that hidif->hid_parser-
>>>> ReportDescSize isn't correctly being sent. You can add a debug TRACE
>>> () statement to hid_prepare_report_descriptor() to verify this.
>>
>>
>> The code will fail when it tries to prepare the hid descriptor which
>> returns -71 from the usb control msg.  (see TRACE).
>
>Ah, my mistake. I was looking at the report descriptor URB that you  
>sent, and I forgot to look back at the debug output.
>
>>   TRACE: hid_prepare_hid_descriptor(): retrieving HID descriptor  
>> for USB
>> device(endpoint: 80) 001/024[0]...
>> USB error: error sending control message: Protocol error
>>   TRACE: hid_prepare_hid_descriptor():
>> usb_control_msg(devhandle,129,6,8448,0,(char *)buffer, 24,10000)  
>> RETURNED: -71
>> WARNING: hid_prepare_hid_descriptor(): failed to get HID descriptor  
>> for USB
>
>Does this match one of the earlier URBs in the usbsnoop logfile?

I am not 100% sure... still figuring out the usb snoop log
but these look the most relevant... 



1 ms] UsbSnoop - DispatchAny(f0b90610) : IRP_MJ_INTERNAL_DEVICE_CONTROL
[1 ms] UsbSnoop - MyDispatchInternalIOCTL(f0b91e80) : fdo=8558fde8, Irp=859623d8,
IRQL=0
[1 ms]  >>>  URB 1 going down  >>>
-- URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE:
  TransferBufferLength = 00000012
  TransferBuffer       = 856c9120
  TransferBufferMDL    = 00000000
  Index                = 00000000
  DescriptorType       = 00000001 (USB_DEVICE_DESCRIPTOR_TYPE)
  LanguageId           = 00000000
[1 ms] UsbSnoop - DispatchAny(f0b90610) : IRP_MJ_SYSTEM_CONTROL
[1 ms] UsbSnoop - MyInternalIOCTLCompletion(f0b91db0) : fido=00000000,
Irp=859623d8, Context=86208108, IRQL=2
[1 ms]  <<<  URB 1 coming back  <<<
-- URB_FUNCTION_CONTROL_TRANSFER:
  PipeHandle           = 86234218
  TransferFlags        = 0000000b (USBD_TRANSFER_DIRECTION_IN,
USBD_SHORT_TRANSFER_OK)
  TransferBufferLength = 00000012
  TransferBuffer       = 856c9120
  TransferBufferMDL    = 862b92c8
    00000000: 12 01 00 02 00 00 00 10 25 09 99 12 01 00 01 02
    00000010: 00 01
  UrbLink              = 00000000
  SetupPacket          =
    00000000: 80 06 00 01 00 00 12 00
[1 ms] UsbSnoop - DispatchAny(f0b90610) : IRP_MJ_INTERNAL_DEVICE_CONTROL
[1 ms] UsbSnoop - MyDispatchInternalIOCTL(f0b91e80) : fdo=8558fde8, Irp=859623d8,
IRQL=0
[1 ms]  >>>  URB 2 going down  >>>
-- URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE:
  TransferBufferLength = 00000009
  TransferBuffer       = 85709418
  TransferBufferMDL    = 00000000
  Index                = 00000000
  DescriptorType       = 00000002 (USB_CONFIGURATION_DESCRIPTOR_TYPE)
  LanguageId           = 00000000
[2 ms] UsbSnoop - MyInternalIOCTLCompletion(f0b91db0) : fido=00000000,
Irp=859623d8, Context=855aa678, IRQL=2
[2 ms]  <<<  URB 2 coming back  <<<
-- URB_FUNCTION_CONTROL_TRANSFER:
  PipeHandle           = 86234218
  TransferFlags        = 0000000b (USBD_TRANSFER_DIRECTION_IN,
USBD_SHORT_TRANSFER_OK)
  TransferBufferLength = 00000009
  TransferBuffer       = 85709418
  TransferBufferMDL    = 862b92c8
    00000000: 09 02 29 00 01 01 00 a0 32
  UrbLink              = 00000000
  SetupPacket          =
    00000000: 80 06 00 02 00 00 09 00
[2 ms] UsbSnoop - DispatchAny(f0b90610) : IRP_MJ_INTERNAL_DEVICE_CONTROL
[2 ms] UsbSnoop - MyDispatchInternalIOCTL(f0b91e80) : fdo=8558fde8, Irp=859623d8,
IRQL=0
2 ms]  >>>  URB 3 going down  >>>
-- URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE:
  TransferBufferLength = 00000029
  TransferBuffer       = 8557f060
  TransferBufferMDL    = 00000000
  Index                = 00000000
  DescriptorType       = 00000002 (USB_CONFIGURATION_DESCRIPTOR_TYPE)
  LanguageId           = 00000000
[3 ms] UsbSnoop - MyInternalIOCTLCompletion(f0b91db0) : fido=00000000,
Irp=859623d8, Context=86085978, IRQL=2
[3 ms]  <<<  URB 3 coming back  <<<
-- URB_FUNCTION_CONTROL_TRANSFER:
  PipeHandle           = 86234218
  TransferFlags        = 0000000b (USBD_TRANSFER_DIRECTION_IN,
USBD_SHORT_TRANSFER_OK)
  TransferBufferLength = 00000029
  TransferBuffer       = 8557f060
  TransferBufferMDL    = 862b92c8
    00000000: 09 02 29 00 01 01 00 a0 32 09 04 00 00 02 03 00
    00000010: 00 00 09 21 01 01 00 01 22 2f 00 07 05 81 03 10
    00000020: 00 0a 07 05 01 03 10 00 0a
  UrbLink              = 00000000
  SetupPacket          =
    00000000: 80 06 00 02 00 00 29 00





>
>> And since that is failing (hid_preparation.c)
>> it never sets the  ReportDescSize
>> which is required for the hid_prepare_report_descriptor()\
>> right?
>> or is ReportDescSize able to be set someplace else?
>
>Hmm, it appears as though this code http://www.ghz.cc/~clepple/ 
>libhid/doc/html/hid__preparation_8c-source.html#l00025> is just  
>trying to retrieve the first 9 bytes, and that is where the firmware  
>is getting confused. (The HID descriptor is variable-length, but the  
>first 9 bytes are a standard descriptor header.)
>
>The HID access code in NUT[*] has a workaround for some HID UPSes  
>that do not return the right number of bytes for the report, but I  
>think we are seeing slightly different symptoms here.
>
>[*] http://www.networkupstools.org and http://boxster.ghz.cc/projects/ 
>nut/browser/trunk/drivers/libusb.c#L249
>
>Did you change the code to use 24 instead for the length? (I'm  
>looking at the parameters to usb_control_msg() above.)

Oh yes, sorry.. I was testing something... forgot to change it back.
Here I put the value back and re-compiled...


[...]

 NOTICE: hid_init_parser(): successfully initialised the HID parser for USB
Device 001/024[0].
  TRACE: hid_prepare_hid_descriptor(): initialising the HID descriptor for USB
device 001/024[0]...
  TRACE: hid_prepare_hid_descriptor(): retrieving HID descriptor for USB
device(endpoint: 80) 001/024[0]...
USB error: error sending control message: Protocol error
  TRACE: hid_prepare_hid_descriptor():
usb_control_msg(devhandle,129,6,8448,0,(char *)buffer, 9,10000) RETURNED: -71
WARNING: hid_prepare_hid_descriptor(): failed to get HID descriptor for USB
device 001/024[0]:error sending control message: Protocol error
  TRACE: hid_close(): closing USB device 001/024[0]...
  TRACE: hid_close(): closing handle of USB device 001/024[0]...
 NOTICE: hid_close(): successfully closed USB device 001/024[0].
  TRACE: hid_reset_parser(): resetting the HID parser for USB device 001/024[0]...
  TRACE: hid_close(): freeing memory allocated for HID parser...
  TRACE: hid_close(): resetting HIDInterface...
hid_force_open failed with return code 13


---- Msg sent via CableONE.net MyMail - http://www.cableone.net


More information about the libhid-discuss mailing list