How to change USB-KB mode data to look the same as USB-HID data?

 

Step-by-step guide

 

The KB & HID Modes are very similar, with the exception that the Masked Card Data is in different formats. In KB mode, the Masked Card data is in ASCIII format, and in HID Mode, it is in HEX.

 

As far as data layout in BOTH modes, it goes as follows.

 

First two Characters are always ‘02’

The next 4 characters are the length of <CardData> in Hex.

All data following the first 6 characters, excluding the last 6 characters are <CardData>

The last 6 characters are laid out as followed.

The first 2 characters are the LRC.

The next 2 characters are the Checksum.

The final 2 characters are always ‘03’.

 

So, the steps to converting the KB read to HID read are as follows

 

  1. Convert the Masked Card Data to Hex.
  2. Calculate the length by totaling Card Data / 2 and then converting it to Hex and reversing it. So if the length is 498 / 2 = 249. 249 in hex is 00F9. The characters are swapped when in the IDTech read, so it must be put in as F900 rather than 00F9.
  3. Calculate the LRC using only the <CardData>
  4. Calculate the Checksum using only the <CardData>
  5. String it together as follows <’02’><HexLength><CardData><LRC><CheckSum><’03’>


    I made a small edit to test if notifications go out properly to watchers of this page.