Re: Cannot dump USB report descriptors, not even after unbinding the device

2017-03-06 Thread Krzysztof Opasiak


Hi,

On 03/03/2017 09:48 PM, Alan Stern wrote:

On Fri, 3 Mar 2017, László Monda wrote:


Hi Krzysztof, and thank you for the help!


Oh now I see. I missed this when I was reading this email for the first
time.


root@spark ~ # echo -n 2-10.3 > /sys/bus/usb/drivers/usb/unbind



You are trying to unbind here wrong driver I think. Try to unbound driver
for interface instead of for whole device:

# echo -n 2-10.3:1.0 > /sys/bus/usb/drivers/usb/unbind


I've tried to unbind 2-10.3:[0-4].[0-4] but bash always tells me that
there's no such device.


Krzysztof told you the wrong driver.  You should do:

echo 2-10.3:1.0 >/sys/bus/usb/drivers/usbhid/unbind

(the -n doesn't matter).



Thank you Alan for catching this!

I've copy-pasted the path from above and forgot to fix driver name. 
Unfortunately I did the same mistake in my second response. Please 
excuse me Laszlo for this oversight.


Cheers,
--
Krzysztof Opasiak
Samsung R Institute Poland
Samsung Electronics
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Cannot dump USB report descriptors, not even after unbinding the device

2017-03-03 Thread Krzysztof Opasiak
Hi,

>Hi Krzysztof, and thank you for the help!
>
>> Oh now I see. I missed this when I was reading this email for the first
>> time.
>>
>> root@spark ~ # echo -n 2-10.3 > /sys/bus/usb/drivers/usb/unbind
>>
>>
>> You are trying to unbind here wrong driver I think. Try to unbound driver
>> for interface instead of for whole device:
>>
>> # echo -n 2-10.3:1.0 > /sys/bus/usb/drivers/usb/unbind
>
> I've tried to unbind 2-10.3:[0-4].[0-4] but bash always tells me that
> there's no such device.
>
> The strace output is very long, and I can't make much sense of it, but
> I uploaded it as a GitHub gist:
> https://gist.github.com/mondalaci/424d145263b5b6160d02bd42ce80247f

This output is quite similar to what I expected. This part is important:

ioctl(10, USBDEVFS_CLAIMINTERFACE, 0x7fff881fc78c) = -1 ENOENT (No such
file or directory)
write(1, " Report Descriptors: \n", 30) = 30
write(1, " ** UNAVAILABLE **\n", 29) = 29

So lsusb is trying to claim your hid interface but it gets the ENOENT
error and that's nothing weird because before executing lsusb you
kicked-off the generic USB device driver:

echo -n 2-10.3 > /sys/bus/usb/drivers/usb/unbind

which is responsible for setting USB device configuration and when you
unbind it from your device it just simply puts whole device in
unconfigured state. This means that you cannot claim any interface
because they simply don't exist in your system device hierarchy.

So to make things simply working I suggest to:
1) Disconnect your device (or alternatively just rebind the driver;))

2) Go to /sys/bus/usb/devices

3) Find directory which corresponds to your device (for example 2-10.3)

4) As you have 3 interfaces you will then have 3 directories which names
starts with name of your device but then there is additional : and two
digits. (for example 2-10.3:1.0). The last digit is bInterfaceNumber.

5) Use lsusb -t to check to which interfaces your driver is bound.

6) Unbind first driver using:
# echo -n 2-10.3:1.X > /sys/bus/usb/drivers/usb/unbind

Where X is bInterfaceNumber of one of interfaces in your device to which
some driver is bound.

7) Execute lsusb -t once again to check if there are some drivers left.
If yes goto 6.

8) Execute your lsusb command to get your report descriptors.

Cheers,
Krzysztof Opasiak
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Cannot dump USB report descriptors, not even after unbinding the device

2017-03-03 Thread Alan Stern
On Fri, 3 Mar 2017, László Monda wrote:

> Hi Krzysztof, and thank you for the help!
> 
> > Oh now I see. I missed this when I was reading this email for the first
> > time.
> >
> >> root@spark ~ # echo -n 2-10.3 > /sys/bus/usb/drivers/usb/unbind
> >
> >
> > You are trying to unbind here wrong driver I think. Try to unbound driver
> > for interface instead of for whole device:
> >
> > # echo -n 2-10.3:1.0 > /sys/bus/usb/drivers/usb/unbind
> 
> I've tried to unbind 2-10.3:[0-4].[0-4] but bash always tells me that
> there's no such device.

Krzysztof told you the wrong driver.  You should do:

echo 2-10.3:1.0 >/sys/bus/usb/drivers/usbhid/unbind

(the -n doesn't matter).

Alan Stern

> The strace output is very long, and I can't make much sense of it, but
> I uploaded it as a GitHub gist:
> https://gist.github.com/mondalaci/424d145263b5b6160d02bd42ce80247f
> 
> Cheers!

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Cannot dump USB report descriptors, not even after unbinding the device

2017-03-03 Thread László Monda
Hi Krzysztof, and thank you for the help!

> Oh now I see. I missed this when I was reading this email for the first
> time.
>
>> root@spark ~ # echo -n 2-10.3 > /sys/bus/usb/drivers/usb/unbind
>
>
> You are trying to unbind here wrong driver I think. Try to unbound driver
> for interface instead of for whole device:
>
> # echo -n 2-10.3:1.0 > /sys/bus/usb/drivers/usb/unbind

I've tried to unbind 2-10.3:[0-4].[0-4] but bash always tells me that
there's no such device.

The strace output is very long, and I can't make much sense of it, but
I uploaded it as a GitHub gist:
https://gist.github.com/mondalaci/424d145263b5b6160d02bd42ce80247f

Cheers!

-- 
László Monda 
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Cannot dump USB report descriptors, not even after unbinding the device

2017-03-03 Thread Krzysztof Opasiak



On 03/03/2017 04:59 PM, László Monda wrote:

Dear List,

About 2 years ago, I used to be able to dump the USB report
descriptors of my input devices after unlinking them, but for some
reason, not anymore.

root@spark ~ # dmesg | tail
[239486.804224] logitech-hidpp-device 0003:046D:404D.02B3:
input,hidraw5: USB HID v1.11 Keyboard [Logitech K400 Plus] on
usb-:00:14.0-10.3:1
[239535.214726] usb 2-10.3: USB disconnect, device number 115
[239538.010455] usb 2-10.3: new full-speed USB device number 116 using xhci_hcd
[239538.125768] usb 2-10.3: New USB device found, idVendor=046d, idProduct=c52b
[239538.125770] usb 2-10.3: New USB device strings: Mfr=1, Product=2,
SerialNumber=0
[239538.125771] usb 2-10.3: Product: USB Receiver
[239538.125772] usb 2-10.3: Manufacturer: Logitech
[239538.135925] logitech-djreceiver 0003:046D:C52B.02B6:
hiddev0,hidraw4: USB HID v1.11 Device [Logitech USB Receiver] on
usb-:00:14.0-10.3/input2
[239538.264789] input: Logitech K400 Plus as
/devices/pci:00/:00:14.0/usb2/2-10/2-10.3/2-10.3:1.2/0003:046D:C52B.02B6/0003:046D:404D.02B7/input/input340
[239538.264987] logitech-hidpp-device 0003:046D:404D.02B7:
input,hidraw5: USB HID v1.11 Keyboard [Logitech K400 Plus] on
usb-:00:14.0-10.3:1



Oh now I see. I missed this when I was reading this email for the first 
time.



root@spark ~ # echo -n 2-10.3 > /sys/bus/usb/drivers/usb/unbind


You are trying to unbind here wrong driver I think. Try to unbound 
driver for interface instead of for whole device:


# echo -n 2-10.3:1.0 > /sys/bus/usb/drivers/usb/unbind

Cheers,
--
Krzysztof Opasiak
Samsung R Institute Poland
Samsung Electronics
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Cannot dump USB report descriptors, not even after unbinding the device

2017-03-03 Thread Krzysztof Opasiak



On 03/03/2017 04:59 PM, László Monda wrote:

Dear List,

About 2 years ago, I used to be able to dump the USB report
descriptors of my input devices after unlinking them, but for some
reason, not anymore.

root@spark ~ # dmesg | tail
[239486.804224] logitech-hidpp-device 0003:046D:404D.02B3:
input,hidraw5: USB HID v1.11 Keyboard [Logitech K400 Plus] on
usb-:00:14.0-10.3:1
[239535.214726] usb 2-10.3: USB disconnect, device number 115
[239538.010455] usb 2-10.3: new full-speed USB device number 116 using xhci_hcd
[239538.125768] usb 2-10.3: New USB device found, idVendor=046d, idProduct=c52b
[239538.125770] usb 2-10.3: New USB device strings: Mfr=1, Product=2,
SerialNumber=0
[239538.125771] usb 2-10.3: Product: USB Receiver
[239538.125772] usb 2-10.3: Manufacturer: Logitech
[239538.135925] logitech-djreceiver 0003:046D:C52B.02B6:
hiddev0,hidraw4: USB HID v1.11 Device [Logitech USB Receiver] on
usb-:00:14.0-10.3/input2
[239538.264789] input: Logitech K400 Plus as
/devices/pci:00/:00:14.0/usb2/2-10/2-10.3/2-10.3:1.2/0003:046D:C52B.02B6/0003:046D:404D.02B7/input/input340
[239538.264987] logitech-hidpp-device 0003:046D:404D.02B7:
input,hidraw5: USB HID v1.11 Keyboard [Logitech K400 Plus] on
usb-:00:14.0-10.3:1

root@spark ~ # echo -n 2-10.3 > /sys/bus/usb/drivers/usb/unbind

root@spark ~ # lsusb -vd 046d:c52b


Try to use strace and see what fails:

strace lsusb -vd 046d:c52b

Cheers,
--
Krzysztof Opasiak
Samsung R Institute Poland
Samsung Electronics
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Cannot dump USB report descriptors, not even after unbinding the device

2017-03-03 Thread László Monda
Dear List,

About 2 years ago, I used to be able to dump the USB report
descriptors of my input devices after unlinking them, but for some
reason, not anymore.

root@spark ~ # dmesg | tail
[239486.804224] logitech-hidpp-device 0003:046D:404D.02B3:
input,hidraw5: USB HID v1.11 Keyboard [Logitech K400 Plus] on
usb-:00:14.0-10.3:1
[239535.214726] usb 2-10.3: USB disconnect, device number 115
[239538.010455] usb 2-10.3: new full-speed USB device number 116 using xhci_hcd
[239538.125768] usb 2-10.3: New USB device found, idVendor=046d, idProduct=c52b
[239538.125770] usb 2-10.3: New USB device strings: Mfr=1, Product=2,
SerialNumber=0
[239538.125771] usb 2-10.3: Product: USB Receiver
[239538.125772] usb 2-10.3: Manufacturer: Logitech
[239538.135925] logitech-djreceiver 0003:046D:C52B.02B6:
hiddev0,hidraw4: USB HID v1.11 Device [Logitech USB Receiver] on
usb-:00:14.0-10.3/input2
[239538.264789] input: Logitech K400 Plus as
/devices/pci:00/:00:14.0/usb2/2-10/2-10.3/2-10.3:1.2/0003:046D:C52B.02B6/0003:046D:404D.02B7/input/input340
[239538.264987] logitech-hidpp-device 0003:046D:404D.02B7:
input,hidraw5: USB HID v1.11 Keyboard [Logitech K400 Plus] on
usb-:00:14.0-10.3:1

root@spark ~ # echo -n 2-10.3 > /sys/bus/usb/drivers/usb/unbind

root@spark ~ # lsusb -vd 046d:c52b
Bus 002 Device 116: ID 046d:c52b Logitech, Inc. Unifying Receiver
Device Descriptor:
bLength18
bDescriptorType 1
bcdUSB   2.00
bDeviceClass0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize032
idVendor   0x046d Logitech, Inc.
idProduct  0xc52b Unifying Receiver
bcdDevice   24.01
iManufacturer   1 Logitech
iProduct2 USB Receiver
iSerial 0
bNumConfigurations  1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength   84
bNumInterfaces  3
bConfigurationValue 1
iConfiguration  4 RQR24.01_B0023
bmAttributes 0xa0
  (Bus Powered)
  Remote Wakeup
MaxPower   98mA
Interface Descriptor:
  bLength 9
  bDescriptorType 4
  bInterfaceNumber0
  bAlternateSetting   0
  bNumEndpoints   1
  bInterfaceClass 3 Human Interface Device
  bInterfaceSubClass  1 Boot Interface Subclass
  bInterfaceProtocol  1 Keyboard
  iInterface  0
HID Device Descriptor:
  bLength 9
  bDescriptorType33
  bcdHID   1.11
  bCountryCode0 Not supported
  bNumDescriptors 1
  bDescriptorType34 Report
  wDescriptorLength  59
 Report Descriptors:
   ** UNAVAILABLE **
  Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81  EP 1 IN
bmAttributes3
  Transfer TypeInterrupt
  Synch Type   None
  Usage Type   Data
wMaxPacketSize 0x0008  1x 8 bytes
bInterval   8
Interface Descriptor:
  bLength 9
  bDescriptorType 4
  bInterfaceNumber1
  bAlternateSetting   0
  bNumEndpoints   1
  bInterfaceClass 3 Human Interface Device
  bInterfaceSubClass  1 Boot Interface Subclass
  bInterfaceProtocol  2 Mouse
  iInterface  0
HID Device Descriptor:
  bLength 9
  bDescriptorType33
  bcdHID   1.11
  bCountryCode0 Not supported
  bNumDescriptors 1
  bDescriptorType34 Report
  wDescriptorLength 148
 Report Descriptors:
   ** UNAVAILABLE **
  Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x82  EP 2 IN
bmAttributes3
  Transfer TypeInterrupt
  Synch Type   None
  Usage Type   Data
wMaxPacketSize 0x0008  1x 8 bytes
bInterval   2
Interface Descriptor:
  bLength 9
  bDescriptorType 4
  bInterfaceNumber2
  bAlternateSetting   0
  bNumEndpoints   1
  bInterfaceClass 3 Human Interface Device
  bInterfaceSubClass  0 No Subclass
  bInterfaceProtocol  0 None
  iInterface  0
HID Device Descriptor:
  bLength 9
  bDescriptorType33
  bcdHID   1.11
  bCountryCode0 Not supported
  bNumDescriptors 1
  bDescriptorType34 Report
  wDescriptorLength  98
 Report Descriptors:
   ** UNAVAILABLE **
  Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x83  EP 3 IN
bmAttributes3
  Transfer TypeInterrupt
  Synch Type   None
  Usage Type   Data