HOWTO Program a key

From i3Detroit
Jump to: navigation, search

RFID Tags

Our RFID entry system uses EM4100 125khz RFID tags.

Format

There are three formats for the data in our flavour of RFID:

  1. 1 26 bit decimal number, just a number, written on keyfobs
  2. 2 16 bit decimal numbers, <5 digits>:<5 digits>, currently (2022-07-29) in the CRM and written on the cards.
  3. the number but as hex It's what is in the spreadsheet right now.

Converting formats

Thanks to Evan for the blog post and Google Sheet documenting this!

  • To go from hex to decimal: echo 0x05094D8 | perl -nle 'print hex'
    • 0x is optional
  • To go from 2 16 bit to decimal: echo 80:38104 | perl -laF/:/ -e 'print (($F[0] << 16) + $F[1])'
  • To go from decimal to 2 16 bit:echo 5280984 | perl -ne 'printf "%03d:%05d\n", $_ >> 16, $_ & 0xFFFF'
  • Decimal to hex: echo 5280984 | perl -nle 'printf "0x%X\n", $_'

Programming new keys

Since April 2020 adding new keys and changing the status of existing ones is handled through a remote interface on McClellan.

The code is at github.com/i3detroit/door-management.

  1. Put information for the user in the source of truth spreadsheet
  2. Copy the spreadsheet CSV to mcclellan
  3. /opt/door-management/setAccess $whateverCSV a|b
    • So for example /opt/door-management/setAccess access.csv a