-
Notifications
You must be signed in to change notification settings - Fork 2
HEX Format #2
Copy link
Copy link
Open
Labels
questionFurther information is requestedFurther information is requested
Description
I run multiple turnstile with USB and Serial RFID reader of many brands.
Serial RFID are easy to handle but the RFIDEA HID reader always forced me to work in the console session.
I was using this in P3 which is not really flexible
if readerUSB == True: #(PYTHON 3 NO ORD REQUIRED - See archives functions.)
print("******** WAITING FOR CARD ACCESS with USB **************")
try:
while True:
while not done: ## Get the character from the HID
buffer = fp.read(8)
for c in buffer:
if c > 0: ## 40 is carriage return which signifies we are done looking for characters
if int(c) == 40:
done = True
break; ## If we are shifted then we have to use the hid2 characters.
if shift: ## If it is a '2' then it is the shift key
if int(c) == 2 :
shift = True
else: # if not a 2, lookup mapping
rfid_number += hid2[ int(c) ]
shift = False
else: # if not shifted, use the hid characters
if int(c) == 2 : # if 2, then it is the shift key
shift = True
else: # If not a 2, lookup mapping
rfid_number += hid[ int(c) ]
With your code I was able to read USB data off console.
However, the HEX data returned is reversed to my requirements
Data Return: Tag data: 35 88 8a 67 50 01 04 e0
Data required: E0040150678A8835
I played with the pcprox.py to reverse the HEX data and i have to create a loop but getting there.
def _format_hex(i: bytes) -> Text:
return ''.join(reversed(['%02x' % c for c in i]))
Have you had any requirements as such?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested