我正在学习如何使用MFRC522模块和覆盆子pi。 Im使用mfrc522python库。在
在尝试更改密钥之前,我能够从mifare 1k读写数据。 我试着换7区。 是这样的:
[0, 0, 0, 0, 0, 0, 255, 7, 128, 105, 255, 255, 255, 255, 255, 255]
在这样的变化之后:
^{pr2}$修改后,我可以用A键读取0-3扇区:
255, 255, 255, 255, 255, 255
以及键B的扇区7:
250,250,250,250,250,250
尝试恢复初始设置时,我犯了个错误,将扇区7更改为:
[255, 255, 255,255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255]
现在我只能读UID。 我知道6-7-8块包含权限,但我找不到关于这个主题的好文档。 如何重置初始设置?在
我尝试使用以下代码:
# Welcome message
print "Welcome to the MFRC522 data read example"
print "Press Ctrl-C to stop."
# This loop keeps checking for chips. If one is near it will get the UID and authenticate
while continue_reading:
# Scan for cards
(status,TagType) = MIFAREReader.MFRC522_Request(MIFAREReader.PICC_REQIDL)
# If a card is found
if status == MIFAREReader.MI_OK:
print "Card detected"
# Get the UID of the card
(status,uid) = MIFAREReader.MFRC522_Anticoll()
# If we have the UID, continue
if status == MIFAREReader.MI_OK:
# Print UID
print "Card read UID: "+str(uid[0])+","+str(uid[1])+","+str(uid[2])+","+str(uid[3])
# This is the default key for authentication
key = [0xFF,0xFF,0xFF,0xFF,0xFF,0xFF]
setas = [0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x07,0x80,0x69,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF]
sect = 7
# Select the scanned tag
MIFAREReader.MFRC522_SelectTag(uid)
# Authenticate
status = MIFAREReader.MFRC522_Auth(MIFAREReader.PICC_AUTHENT1A, sect, key, uid)
# Check if authenticated
if status == MIFAREReader.MI_OK:
MIFAREReader.MFRC522_Read(sect)
MIFAREReader.MFRC522_Write(sect,setas)
MIFAREReader.MFRC522_Read(sect)
MIFAREReader.MFRC522_StopCrypto1()
else:
print "Authentication error"
good doc about Mifare classic 1k 在这里你可以学习如何设置访问位。在
我完全封锁了整个区域的所有通道。在
注意:
可以在下面的文档中找到其他的水果: learn Adafruit
相关问题 更多 >
编程相关推荐