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