USB RFID reader

I bought a reader off Amazon, it is reading with @gdziuba/node-red-usbhid, but the output appears to be gibberish even using the hex to string in the example flow. Any ideas? It outputs 22 values, the card scan value is 0461851553
[0,0,39,0,0,0,0,0]
[0,0,0,0,0,0,0,0]
[0,0,33,0,0,0,0,0]
[0,0,0,0,0,0,0,0]
[0,0,35,0,0,0,0,0]
[0,0,0,0,0,0,0,0]
[0,0,30,0,0,0,0,0]
[0,0,0,0,0,0,0,0]
[0,0,37,0,0,0,0,0]
[0,0,0,0,0,0,0,0]
[0,0,34,0,0,0,0,0]
[0,0,0,0,0,0,0,0]
[0,0,30,0,0,0,0,0]
[0,0,0,0,0,0,0,0]
[0,0,34,0,0,0,0,0]
[0,0,0,0,0,0,0,0]
[0,0,32,0,0,0,0,0]
[0,0,0,0,0,0,0,0]
[0,0,40,0,0,0,0,0]
[0,0,0,0,0,0,0,0]

I like ones like this.

As this is a USBHID device:
Let's first put up the USBHID Map.


The arrays are HID Reports, each representing the following:

[Modifier, Reserved, Keycode1, Keycode2, Keycode3, Keycode4, Keycode5, Keycode6]

And finally....

39: "0"
33: "4"
35: "6"
30: "1"

See where I am going with this :nerd_face:

  • For each array you receive, extract the 3rd element (where 0 - can be ignored)
  • Once you have hit the length of elements you're expecting
    • Convert each HID code to its ASCII value (you may need to find a better table, then my image)

There might be better ways here of course, but I fancied getting dirty

EDIT


Code 40 is ENTER - Therefore you might not need to know the length, but instead stop/convert when you get this code in the array- as it seems to be present

  • For each array you receive, extract the 3rd element (where 0 - can be ignored)
  • When you get the code 40 - convert each element that you extracted / convert them = your card value

Thank you so much! I knew this was the right place to ask :slight_smile:

1 Like