try nfc
This commit is contained in:
parent
88e02f1fee
commit
386cbc2c0a
@ -7,7 +7,7 @@ sudo apt-get install python3-psycopg2 -y
|
||||
sudo apt-get install python3-fido2 -y
|
||||
sudo apt-get install python3-nfcpy -y
|
||||
sudo apt-get install screen -y
|
||||
#test
|
||||
|
||||
sudo apt-get update
|
||||
sudo apt-get upgrade -y
|
||||
|
||||
|
20
main.py
20
main.py
@ -105,26 +105,28 @@ class CliInteraction(UserInteraction):
|
||||
print("User Verification required.")
|
||||
return True
|
||||
|
||||
try:
|
||||
clf = nfc.ContactlessFrontend('usb') # Ensure this matches your connection
|
||||
print("NFC reader initialized.")
|
||||
except Exception as e:
|
||||
print("Failed to initialize NFC reader:", e)
|
||||
|
||||
|
||||
def read_nfc_tag():
|
||||
try:
|
||||
clf = nfc.ContactlessFrontend('usb')
|
||||
tag = clf.connect(rdwr={'on-connect': lambda tag: False})
|
||||
clf.close()
|
||||
return tag.identifier if tag else None
|
||||
except Exception as e:
|
||||
print("NFC read error:", e)
|
||||
return None
|
||||
|
||||
|
||||
while True:
|
||||
if gpie:
|
||||
GPIO.output(door, GPIO.LOW)
|
||||
# GPIO.output(14, GPIO.LOW)
|
||||
|
||||
print("Waiting for device...")
|
||||
badCredentials = False
|
||||
if gpie:
|
||||
GPIO.output(redLed, GPIO.HIGH)
|
||||
while True:
|
||||
try:
|
||||
# GPIO.output(14, GPIO.LOW)
|
||||
nfc_tag = read_nfc_tag()
|
||||
dev = next(CtapHidDevice.list_devices(), None)
|
||||
|
||||
if dev:
|
||||
|
@ -2,7 +2,6 @@
|
||||
sudo cp /user/CNSA/CNSA-276-FP/config.ini /config.bak
|
||||
sudo rm -R /user/CNSA/CNSA-276-FP
|
||||
|
||||
#test2
|
||||
|
||||
# Function to check internet connectivity
|
||||
check_internet_connection() {
|
||||
|
Loading…
Reference in New Issue
Block a user