flowtter / py-acr122u Goto Github PK
View Code? Open in Web Editor NEWA library to use the acr122u at its full potential.
License: MIT License
A library to use the acr122u at its full potential.
License: MIT License
I really want it to be a library and not a code that is copied every time someone wants to use it.
Since I don't have the reader any more, I can't test the code.
Ideally, it should be on https://pypi.org/
Can you make this into a library?
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
I run "pip install py122u" but get following errors:
`Collecting py122u
Using cached py122u-2.3.5-py3-none-any.whl.metadata (2.8 kB)
Collecting pyscard>=2.0.7 (from py122u)
Using cached pyscard-2.0.7.tar.gz (152 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Using cached py122u-2.3.5-py3-none-any.whl (8.3 kB)
Building wheels for collected packages: pyscard
Building wheel for pyscard (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for pyscard (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [12 lines of output]
Package libpcsclite was not found in the pkg-config search path.
Perhaps you should add the directory containing `libpcsclite.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libpcsclite' found
running bdist_wheel
running build
running build_py
running build_ext
building 'smartcard.scard._scard' extension
swigging smartcard/scard/scard.i to smartcard/scard/scard_wrap.c
swig -python -outdir smartcard/scard -DPCSCLITE -o smartcard/scard/scard_wrap.c smartcard/scard/scard.i
error: command 'swig' failed: No such file or directory
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pyscard
Failed to build pyscard
ERROR: Could not build wheels for pyscard, which is required to install pyproject.toml-based projects`
I'm facing a problem after writing to another block different than 0x01.
After writing to another block, i can't authenticate to previous the blocks that i have wrote data.
My code
from nfc import nfc as nfcReader
reader = nfcReader.Reader()
block_number = 0x01
custom_number = 0x20
key_location = 0x01
reader.load_authentication_data(key_location, [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF])
reader.authentication(block_number, 0x61, key_location)
def write(position=block_number, number=custom_number, data=[0x00 for i in range(16)]):
""" Write data to mifare tag
Example:
write(reader, 0x01, 0x20, [0x00 for i in range(16)])
"""
while number >= 16:
write_16(reader, position, 16, data)
number -= 16
position += 1
def write_16(r, position, number, data):
r.update_binary_blocks(position, number, data)
def read(position=block_number, number=custom_number):
""" Read data from mifare tag
>>> read(reader, 0x01, 0x20)
"""
print(f'block {block_number}')
result = []
while number >= 16:
result.append(read_16(position, 16, reader))
number -= 16
position += 1
return result
def read_16(position, number, r):
return r.read_binary_blocks(position, number)
I was wondering, what are all the commands I can execute?
Thanks
Hello,
is it possible to read the UID from the reader in such a way that only the 8 digit hexadecimal is read like on an HID reader?
I would like to get the same values as an HID reader in order to establish the assignment via such a reader and to connect the ACR122 to the Raspberry and scan the card there for use on the Pi.
Unfortunately, I only get a 16-digit hex number.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.