Flowtter / py-acr122u

A library to use the acr122u at its full potential.
MIT License
49 stars 12 forks source link

Can't read other blocks than from sector 0 #5

Closed jdouliez closed 1 year ago

jdouliez commented 1 year ago

Hi,

Thanks for this project ! It helps me a lot.

I face a kind of problem because I can authenticate on sector 0 and read block 1,2 and 3. But I don't manage to read others blocks frorm others sectors. I would like to read blocks from sector 7, for instance!

Below is an extract of my code. sector_id can vary from 0 to 15. KEYS dict is correctly populated somewhere else!

KEY_A = 0x60
KEY_B = 0x61
KEY_LOCATION = 0x01
KEY_VALUE = KEYS[sector_id][KEY_A]

reader.load_authentication_data(KEY_LOCATION, KEY_VALUE)
reader.authentication(sector_id, KEY_A, KEY_LOCATION)

BYTES_COUNT_TO_READ = 16
print("".join(int_list_to_string_list(reader.read_binary_blocks(1, BYTES_COUNT_TO_READ)))) # This is only OK for sector 0
print("".join(int_list_to_string_list(reader.read_binary_blocks(2, BYTES_COUNT_TO_READ)))) # This is only OK for sector 0

Regards, JD

Flowtter commented 1 year ago

Unfortunately, I don't have the NFC reader anymore, so I won't be able to provide much help.

There is another issue (https://github.com/Flowtter/py-acr122u/issues/3) that might be related to your problem.

I'm not sure if I'll be able to help you further without being able to test it. In any case, pull requests are welcome !

jdouliez commented 1 year ago

Oooh. OK that's too bad!

Do you confirm, at least, that any bloc of a Mifare 1K should be readable ? Have you previously tested that ?

Thanks !

Flowtter commented 1 year ago

Actually, if I remember correctly, I had issues reading and writing some NFC cards, and thought that it was corrupted.

I'm afraid that it might be a bug, probably something that I misunderstood in the specs.

Really sorry that I can't help you more

jdouliez commented 1 year ago

No problem. ;)

Maybe you can answer this last question :

If I want to read the 4th bloc (so 1st bloc of sector 1) --> Do I need to authenticate to sector 1 and read bloc number 4 or authenticate to sector 1 and read bloc 0 ? :D

Cheers!

Flowtter commented 1 year ago

Hello, I'm really sorry for the late reply. I'm afraid I really can't.

Hope you figured it out !