0
\$\begingroup\$

This is system log when keyboard is plugged in:

usb 5-1: new low-speed USB device number 7 using uhci_hcd
usb 5-1: New USB device found, idVendor=04f3, idProduct=0103
usb 5-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
input: HID 04f3:0103 as /devices/pci0000:00/0000:00:1d.0/usb5/5-1/5-1:1.0/0003:04F3:0103.000D/input/input23
hid-generic 0003:04F3:0103.000D: input,hidraw0: USB HID v1.10 Keyboard [HID 04f3:0103] on usb-0000:00:1d.0-1/input0
input: HID 04f3:0103 as /devices/pci0000:00/0000:00:1d.0/usb5/5-1/5-1:1.1/0003:04F3:0103.000E/input/input24
hid-generic 0003:04F3:0103.000E: input,hidraw1: USB HID v1.10 Device [HID 04f3:0103] on usb-0000:00:1d.0-1/input1

Then I run wireshark and press a key. But instead of 2 URBs there are 4. What part of the URB contains the pressed key code and what for are two extra URBs? Here is the trace.

These are images, one per packet: 1 2 3 4

\$\endgroup\$
  • \$\begingroup\$ Is it possible for you to post trace as image? \$\endgroup\$ – MaNyYaCk Jul 13 '18 at 7:37
  • \$\begingroup\$ @MaNyYaCk Done. \$\endgroup\$ – Igor Liferenko Jul 13 '18 at 7:49
2
\$\begingroup\$

There are two types of packets shown:

URB type: URB_COMPLETE: This is clearly sent from the device and contains the key data.

URB type: URB_SUBMIT : This is the host (hid driver) asking for the next data packet. Note that source is host and destination is device, which would otherwise be invalid for an IN type packet on the USB bus.

\$\endgroup\$
  • \$\begingroup\$ But why there are two reqest-response pairs instead of one? Is it documented in HID spec? \$\endgroup\$ – Igor Liferenko Jul 13 '18 at 11:05
  • 1
    \$\begingroup\$ @IgorLiferenko (KeyPress) followed by (KeyRelease) \$\endgroup\$ – brhans Jul 13 '18 at 14:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.