3

I have a Magtek magstripe card reader. Here's more information than you'd ever want about the device:

# lsusb -v
Bus 001 Device 003: ID 0801:0001 MagTek Mini Swipe Reader (Keyboard Emulation)
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x0801 MagTek
  idProduct          0x0001 Mini Swipe Reader (Keyboard Emulation)
  bcdDevice            1.00
  iManufacturer           1 (error)
  iProduct                2 (error)
  iSerial                 3 (error)
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           34
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      1 Boot Interface Subclass
      bInterfaceProtocol      1 Keyboard
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.01
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      76
         Report Descriptors: 
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0008  1x 8 bytes
        bInterval               1
Device Status:     0x0000
  (Bus Powered)

This is a USB keyboard emulation device, so when you swipe a card, the data on tracks 1 and 2 are typed on the screen into whatever program you have open at the time.

I'm trying to learn about USB reverse engineering, so I'm trying to understand how this device sends data to my computer. After swiping a card and seeing the data on the screen, I try to find that data in the USB requests that go back and forth between my computer and the device. To do this, I use usbmon:

# cat /sys/kernel/debug/usb/usbmon/1u

I've read up on the output of usbmon and I've also tried looking at the data using vusb-analyzer, but I can't find any of the data I expect to see in the data stream.

Here is an example of the output on the screen and the output from usbmon after swiping an old (inactive) ID card from Oakland University.

Output on screen:

%000127138,6361380000058657,SINGH,?;6361380000058657=123456789012?+000127138?

Usbmon Output:

ffff88008954e900 3348888805 C Ii:1:003:1 0:1 8 = 02002200 00000000
ffff88008954e900 3348888878 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348889671 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3348889709 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348890693 C Ii:1:003:1 0:1 8 = 00002700 00000000
ffff88008954e900 3348890719 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348892689 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3348892712 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348893689 C Ii:1:003:1 0:1 8 = 00002700 00000000
ffff88008954e900 3348893714 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348894689 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3348894714 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348895688 C Ii:1:003:1 0:1 8 = 00002700 00000000
ffff88008954e900 3348895713 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348896662 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3348896686 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348897689 C Ii:1:003:1 0:1 8 = 00001e00 00000000
ffff88008954e900 3348897714 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348898690 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3348898715 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348899686 C Ii:1:003:1 0:1 8 = 00001f00 00000000
ffff88008954e900 3348899709 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348900687 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3348900710 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348901692 C Ii:1:003:1 0:1 8 = 00002400 00000000
ffff88008954e900 3348901716 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348902689 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3348902710 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348903689 C Ii:1:003:1 0:1 8 = 00001e00 00000000
ffff88008954e900 3348903711 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348904691 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3348904713 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348905692 C Ii:1:003:1 0:1 8 = 00002000 00000000
ffff88008954e900 3348905719 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348906665 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3348906697 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348907696 C Ii:1:003:1 0:1 8 = 00002500 00000000
ffff88008954e900 3348907726 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348908687 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3348908716 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348909688 C Ii:1:003:1 0:1 8 = 00003600 00000000
ffff88008954e900 3348909717 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348910688 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3348910717 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348911688 C Ii:1:003:1 0:1 8 = 00002300 00000000
ffff88008954e900 3348911717 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348912687 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3348912705 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348913687 C Ii:1:003:1 0:1 8 = 00002000 00000000
ffff88008954e900 3348913706 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348914688 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3348914706 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348915686 C Ii:1:003:1 0:1 8 = 00002300 00000000
ffff88008954e900 3348915705 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348916688 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3348916715 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348917691 C Ii:1:003:1 0:1 8 = 00001e00 00000000
ffff88008954e900 3348917718 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348918691 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3348918717 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348919690 C Ii:1:003:1 0:1 8 = 00002000 00000000
ffff88008954e900 3348919717 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348920694 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3348920718 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348921693 C Ii:1:003:1 0:1 8 = 00002500 00000000
ffff88008954e900 3348921716 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348922663 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3348922679 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348923692 C Ii:1:003:1 0:1 8 = 00002700 00000000
ffff88008954e900 3348923721 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348924659 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3348924678 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348925660 C Ii:1:003:1 0:1 8 = 00002700 00000000
ffff88008954e900 3348925675 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348926659 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3348926674 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348927662 C Ii:1:003:1 0:1 8 = 00002700 00000000
ffff88008954e900 3348927680 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348928675 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3348928701 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348929688 C Ii:1:003:1 0:1 8 = 00002700 00000000
ffff88008954e900 3348929714 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348930687 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3348930713 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348931688 C Ii:1:003:1 0:1 8 = 00002700 00000000
ffff88008954e900 3348931715 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348932689 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3348932720 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348933677 C Ii:1:003:1 0:1 8 = 00002200 00000000
ffff88008954e900 3348933690 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348934676 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3348934687 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348935680 C Ii:1:003:1 0:1 8 = 00002500 00000000
ffff88008954e900 3348935692 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348936664 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3348936675 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348937663 C Ii:1:003:1 0:1 8 = 00002300 00000000
ffff88008954e900 3348937674 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348938664 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3348938676 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348939664 C Ii:1:003:1 0:1 8 = 00002200 00000000
ffff88008954e900 3348939674 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348940661 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3348940671 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348941660 C Ii:1:003:1 0:1 8 = 00002400 00000000
ffff88008954e900 3348941670 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348942661 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3348942670 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348943673 C Ii:1:003:1 0:1 8 = 00003600 00000000
ffff88008954e900 3348943685 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348944676 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3348944700 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348945675 C Ii:1:003:1 0:1 8 = 02001600 00000000
ffff88008954e900 3348945687 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348946661 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3348946672 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348947661 C Ii:1:003:1 0:1 8 = 02000c00 00000000
ffff88008954e900 3348947673 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348948661 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3348948672 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348949664 C Ii:1:003:1 0:1 8 = 02001100 00000000
ffff88008954e900 3348949677 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348950665 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3348950676 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348951666 C Ii:1:003:1 0:1 8 = 02000a00 00000000
ffff88008954e900 3348951677 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348952666 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3348952677 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348953666 C Ii:1:003:1 0:1 8 = 02000b00 00000000
ffff88008954e900 3348953678 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348954665 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3348954677 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348956665 C Ii:1:003:1 0:1 8 = 00003600 00000000
ffff88008954e900 3348956680 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348957680 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3348957696 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348958677 C Ii:1:003:1 0:1 8 = 02003800 00000000
ffff88008954e900 3348958692 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348959663 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3348959678 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348960663 C Ii:1:003:1 0:1 8 = 00003300 00000000
ffff88008954e900 3348960674 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348961669 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3348961699 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348962670 C Ii:1:003:1 0:1 8 = 00002300 00000000
ffff88008954e900 3348962697 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348963663 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3348963678 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348964664 C Ii:1:003:1 0:1 8 = 00002000 00000000
ffff88008954e900 3348964676 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348965667 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3348965678 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348966667 C Ii:1:003:1 0:1 8 = 00002300 00000000
ffff88008954e900 3348966678 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348967671 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3348967681 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348968674 C Ii:1:003:1 0:1 8 = 00001e00 00000000
ffff88008954e900 3348968703 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348969673 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3348969701 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348970670 C Ii:1:003:1 0:1 8 = 00002000 00000000
ffff88008954e900 3348970697 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348971672 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3348971698 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348972676 C Ii:1:003:1 0:1 8 = 00002500 00000000
ffff88008954e900 3348972705 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348973678 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3348973688 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348974668 C Ii:1:003:1 0:1 8 = 00002700 00000000
ffff88008954e900 3348974694 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348975669 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3348975695 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348976667 C Ii:1:003:1 0:1 8 = 00002700 00000000
ffff88008954e900 3348976695 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348977670 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3348977700 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348978669 C Ii:1:003:1 0:1 8 = 00002700 00000000
ffff88008954e900 3348978695 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348979670 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3348979699 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348980669 C Ii:1:003:1 0:1 8 = 00002700 00000000
ffff88008954e900 3348980694 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348981674 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3348981702 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348982678 C Ii:1:003:1 0:1 8 = 00002700 00000000
ffff88008954e900 3348982704 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348983687 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3348983714 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348984682 C Ii:1:003:1 0:1 8 = 00002200 00000000
ffff88008954e900 3348984709 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348985675 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3348985702 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348986679 C Ii:1:003:1 0:1 8 = 00002500 00000000
ffff88008954e900 3348986707 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348987682 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3348987712 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348988685 C Ii:1:003:1 0:1 8 = 00002300 00000000
ffff88008954e900 3348988714 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348989679 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3348989707 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348990678 C Ii:1:003:1 0:1 8 = 00002200 00000000
ffff88008954e900 3348990706 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348991686 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3348991715 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348992686 C Ii:1:003:1 0:1 8 = 00002400 00000000
ffff88008954e900 3348992714 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348993681 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3348993690 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348994667 C Ii:1:003:1 0:1 8 = 00002e00 00000000
ffff88008954e900 3348994692 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348995668 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3348995684 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348996668 C Ii:1:003:1 0:1 8 = 00001e00 00000000
ffff88008954e900 3348996682 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348997670 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3348997684 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348998713 C Ii:1:003:1 0:1 8 = 00001f00 00000000
ffff88008954e900 3348998750 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3348999678 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3348999709 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3349000690 C Ii:1:003:1 0:1 8 = 00002000 00000000
ffff88008954e900 3349000721 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3349001690 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3349001721 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3349002689 C Ii:1:003:1 0:1 8 = 00002100 00000000
ffff88008954e900 3349002720 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3349003692 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3349003724 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3349004687 C Ii:1:003:1 0:1 8 = 00002200 00000000
ffff88008954e900 3349004717 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3349005688 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3349005718 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3349006687 C Ii:1:003:1 0:1 8 = 00002300 00000000
ffff88008954e900 3349006717 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3349007675 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3349007701 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3349008687 C Ii:1:003:1 0:1 8 = 00002400 00000000
ffff88008954e900 3349008715 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3349009682 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3349009712 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3349010681 C Ii:1:003:1 0:1 8 = 00002500 00000000
ffff88008954e900 3349010711 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3349011681 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3349011710 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3349012690 C Ii:1:003:1 0:1 8 = 00002600 00000000
ffff88008954e900 3349012719 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3349013673 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3349013682 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3349014697 C Ii:1:003:1 0:1 8 = 00002700 00000000
ffff88008954e900 3349014727 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3349015678 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3349015706 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3349016692 C Ii:1:003:1 0:1 8 = 00001e00 00000000
ffff88008954e900 3349016721 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3349017699 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3349017727 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3349018679 C Ii:1:003:1 0:1 8 = 00001f00 00000000
ffff88008954e900 3349018706 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3349020676 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3349020703 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3349021688 C Ii:1:003:1 0:1 8 = 02003800 00000000
ffff88008954e900 3349021720 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3349022673 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3349022683 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3349023676 C Ii:1:003:1 0:1 8 = 02002e00 00000000
ffff88008954e900 3349023706 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3349024670 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3349024680 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3349025670 C Ii:1:003:1 0:1 8 = 00002700 00000000
ffff88008954e900 3349025680 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3349026671 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3349026679 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3349027670 C Ii:1:003:1 0:1 8 = 00002700 00000000
ffff88008954e900 3349027678 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3349028677 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3349028705 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3349029681 C Ii:1:003:1 0:1 8 = 00002700 00000000
ffff88008954e900 3349029707 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3349030680 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3349030706 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3349031693 C Ii:1:003:1 0:1 8 = 00001e00 00000000
ffff88008954e900 3349031721 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3349032680 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3349032707 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3349033685 C Ii:1:003:1 0:1 8 = 00001f00 00000000
ffff88008954e900 3349033713 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3349034681 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3349034707 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3349035679 C Ii:1:003:1 0:1 8 = 00002400 00000000
ffff88008954e900 3349035706 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3349036676 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3349036703 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3349037690 C Ii:1:003:1 0:1 8 = 00001e00 00000000
ffff88008954e900 3349037718 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3349038677 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3349038703 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3349039691 C Ii:1:003:1 0:1 8 = 00002000 00000000
ffff88008954e900 3349039719 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3349040677 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3349040704 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3349041692 C Ii:1:003:1 0:1 8 = 00002500 00000000
ffff88008954e900 3349041720 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3349042677 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3349042704 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3349043690 C Ii:1:003:1 0:1 8 = 02003800 00000000
ffff88008954e900 3349043721 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3349044684 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3349044698 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3349045681 C Ii:1:003:1 0:1 8 = 00005800 00000000
ffff88008954e900 3349045710 S Ii:1:003:1 -115:1 8 <
ffff88008954e900 3349046682 C Ii:1:003:1 0:1 8 = 00000000 00000000
ffff88008954e900 3349046709 S Ii:1:003:1 -115:1 8 <

As you can see, the characters 'SINGH' (my last name) appear in the on-screen output, but I can't find those ASCII values anywhere in the data. How should I go about reverse engineering this device?

EDIT: Thanks to Igor's answer I got the Report Descriptors, but I'm not quite sure how to make use of them:

  Report Descriptor: (length is 76)
    Item(Global): Usage Page, data= [ 0x01 ] 1
                    Generic Desktop Controls
    Item(Local ): Usage, data= [ 0x06 ] 6
                    Keyboard
    Item(Main  ): Collection, data= [ 0x01 ] 1
                    Application
    Item(Global): Usage Page, data= [ 0x07 ] 7
                    Keyboard
    Item(Local ): Usage Minimum, data= [ 0xe0 ] 224
                    Control Left
    Item(Local ): Usage Maximum, data= [ 0xe7 ] 231
                    GUI Right
    Item(Global): Logical Minimum, data= [ 0x00 ] 0
    Item(Global): Logical Maximum, data= [ 0x01 ] 1
    Item(Global): Report Size, data= [ 0x01 ] 1
    Item(Global): Report Count, data= [ 0x08 ] 8
    Item(Main  ): Input, data= [ 0x02 ] 2
                    Data Variable Absolute No_Wrap Linear
                    Preferred_State No_Null_Position Non_Volatile Bitfield
    Item(Global): Report Count, data= [ 0x01 ] 1
    Item(Global): Report Size, data= [ 0x08 ] 8
    Item(Main  ): Input, data= [ 0x03 ] 3
                    Constant Variable Absolute No_Wrap Linear
                    Preferred_State No_Null_Position Non_Volatile Bitfield
    Item(Global): Report Count, data= [ 0x05 ] 5
    Item(Global): Report Size, data= [ 0x01 ] 1
    Item(Global): Usage Page, data= [ 0x08 ] 8
                    LEDs
    Item(Local ): Usage Minimum, data= [ 0x01 ] 1
                    NumLock
    Item(Local ): Usage Maximum, data= [ 0x05 ] 5
                    Kana
    Item(Main  ): Output, data= [ 0x02 ] 2
                    Data Variable Absolute No_Wrap Linear
                    Preferred_State No_Null_Position Non_Volatile Bitfield
    Item(Global): Report Count, data= [ 0x01 ] 1
    Item(Global): Report Size, data= [ 0x03 ] 3
    Item(Main  ): Output, data= [ 0x03 ] 3
                    Constant Variable Absolute No_Wrap Linear
                    Preferred_State No_Null_Position Non_Volatile Bitfield
    Item(Global): Report Count, data= [ 0x06 ] 6
    Item(Global): Report Size, data= [ 0x08 ] 8
    Item(Global): Logical Minimum, data= [ 0x00 ] 0
    Item(Global): Logical Maximum, data= [ 0x66 ] 102
    Item(Global): Usage Page, data= [ 0x07 ] 7
                    Keyboard
    Item(Local ): Usage Minimum, data= [ 0x00 ] 0
                    No Event
    Item(Local ): Usage Maximum, data= [ 0x66 ] 102
                    Power (not a key)
    Item(Main  ): Input, data= [ 0x00 ] 0
                    Data Array Absolute No_Wrap Linear
                    Preferred_State No_Null_Position Non_Volatile Bitfield
    Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255
    Item(Global): Usage Page, data= [ 0x00 0xff ] 65280
                    (null)
    Item(Local ): Usage, data= [ 0x20 ] 32
                    (null)
    Item(Global): Report Count, data= [ 0x18 ] 24
    Item(Main  ): Feature, data= [ 0x02 0x01 ] 258
                    Data Variable Absolute No_Wrap Linear
                    Preferred_State No_Null_Position Non_Volatile Buffered Bytes
    Item(Main  ): End Collection, data=none
3

Since it uses HID class, you should probably check the USB HID Spec from USB.org. The relevant part seems to be the section 8, "Report Protocol":

8.1 Report Types

Reports contain data from one or more items. Data transfers are sent from the device to the host through the Interrupt In pipe in the form of reports. Reports may also be requested (polled) and sent through the Control pipe or sent through an optional Interrupt Out pipe. A report contains the state of all the items (Input, Output or Feature) belonging to a particular Report ID. The software application is responsible for extracting the individual items from the report based on the Report descriptor.

Ii in the usbmon log refer to "Interrupt In", so these are "reports" from the device. Looks like the changing bytes in the data packets (such as 22, 27, 1e, 1f) correspond to keyboard keys. It seems that to figure out the mapping you need to parse the "Report Descriptor", which can be done by lsusb if you first detach the default driver.

  • So I was able to get the Report Descriptors by detaching the usbhid driver. I've updated my question with these descriptors. How can I use these to parse the usbmon data? – gsingh2011 Dec 21 '13 at 0:39
  • I figured it out. All the description I needed to understand the lsusb output was in the HID document you linked to (around section 6.2.2). In the usbmon output you see 8 bytes of data every request. The first byte is telling you which modifier keys are set. The next byte is reserved. The following bytes are telling you which keys are pressed. But the numbers don't correspond to keycodes, but usage ID's that you can find in the keyboard section here: usb.org/developers/devclass_docs/Hut1_12v2.pdf. It would nice if you could update your answer with some of this information. – gsingh2011 Dec 22 '13 at 16:30

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.