mrext
mrext copied to clipboard
Error using ACR122U-A9
nfc.sh
throws a repeated errors when ACR122U-A9 is connected
after "opened connection : ACS / ACR122U PICC Int..." message "error during poll: error polling: inp..." beeping sound repeats until script is stopped
looking for output logs so that i can view the full messages. connected NFC reader seems to have inconsistent status (light off/red/green) but error loops regardless of status indicator.
Error screenshot:
USB Reader:
Hi mate. Looks to be the right card reader, matches up with mine. Though it's interesting, my one has zero status light output on mister, although the status light works as expected on a PC.
I'll need to get the full log file from you and see that rest of that error line. Are you familiar with copying a file from mister of SSH? You will need to make the error happen again and then, without turning off the mister, copy the file /tmp/nfc.log
to your computer and upload it here
If you're not sure I will find some instructions
I did my own research on SSH and got access to the log. Thanks for taking a look!
/tmp# cat nfc.log
2023/08/18 23:49:50 INFO starting nfc service
2023/08/18 23:49:50 ERROR error loading database: empty csv file given
2023/08/18 23:49:50 INFO opened connection: ACS / ACR122U PICC Interface acr122_usb:001:005
2023/08/18 23:49:50 INFO polling for 20 times with 300ms delay
2023/08/18 23:49:50 ERROR error during poll: error polling: input / output error
That last line repeats on every poll, and then when stopping...
2023/08/18 23:50:09 INFO stopping nfc service
2023/08/18 23:50:09 ERROR error accepting connection: accept unix /tmp/nfc.sock: use of closed network connection
And just to test, I connected the NFC reader to a different USB port to make sure that was not the issue. It correctly identified the port switch:
2023/08/19 00:49:16 INFO opened connection: ACS / ACR122U PICC Interface acr122_usb:001:008
A few other bits of information:
- The beep/buzzing sound is coming out of my speakers via HDMI. If I leave the script running and exit, I still here is on the MiSTer home screen
- I have also tried removing all other USB devices with the same result
Recently I put out a new release of the app. Has there been any improvement?
I don't think it will fix the issue but may help make troubleshooting easier
It would also be good to try this reader on a PC if you can. To make sure it's definitely not faulty or anything
Here is the log from the most recent release:
2023/08/21 15:57:55 INFO starting nfc service
2023/08/21 15:57:55 INFO no database file found, skipping
2023/08/21 15:57:55 ERROR error watching database: no such file or directory
2023/08/21 15:57:56 INFO opened connection: ACS / ACR122U PICC Interface acr122_usb:001:007
2023/08/21 15:57:56 INFO polling for 20 times with 300ms delay
2023/08/21 15:57:56 ERROR error during poll: input / output error
2023/08/21 15:57:56 ERROR fatal IO error, device was unplugged, exiting...
The last 4 lines then repeat every poll.
It would also be good to try this reader on a PC if you can. To make sure it's definitely not faulty or anything
It took trying a few apps to find one that detected the reader, but it seems to be working:
Also looks ok in Device Manager:
Though it's interesting, my one has zero status light output on mister, although the status light works as expected on a PC.
Totally unrelated to the general topic of this issue, but I just stumbled across the following libnfc issue when wondering about the ACR122U status light myself. So mostly an FYI.
https://github.com/nfc-tools/libnfc/issues/524
I have the same problem. The reader don't scan anythings. Her are the log file:
/tmp# cat nfc.log
1970/01/01 01:00:47 INFO starting nfc service
1970/01/01 01:00:47 INFO loaded 0 entries from database
1970/01/01 01:00:47 INFO opened connection: ACS / ACR122U PICC Interface acr122_usb:001:004
1970/01/01 01:00:47 INFO polling for 20 times with 300ms delay
2023/08/22 13:02:30 INFO stopping nfc service
2023/08/22 13:02:30 ERROR error accepting connection: accept unix /tmp/nfc.sock: use of closed network connection
2023/08/22 13:02:38 INFO starting nfc service
2023/08/22 13:02:38 INFO loaded 0 entries from database
2023/08/22 13:02:38 INFO opened connection: ACS / ACR122U PICC Interface acr122_usb:001:004
2023/08/22 13:02:38 INFO polling for 20 times with 300ms delay
2023/08/22 13:05:11 INFO stopping nfc service
2023/08/22 13:05:11 ERROR error accepting connection: accept unix /tmp/nfc.sock: use of closed network connection
2023/08/22 13:05:31 INFO starting nfc service
2023/08/22 13:05:31 INFO loaded 0 entries from database
2023/08/22 13:05:32 INFO opened connection: ACS / ACR122U PICC Interface acr122_usb:001:004
2023/08/22 13:05:32 INFO polling for 20 times with 300ms delay
2023/08/22 13:06:15 INFO stopping nfc service
2023/08/22 13:06:15 ERROR error accepting connection: accept unix /tmp/nfc.sock: use of closed network connection
2023/08/22 13:06:34 INFO starting nfc service
2023/08/22 13:06:34 INFO loaded 0 entries from database
2023/08/22 13:06:35 INFO opened connection: ACS / ACR122U PICC Interface acr122_usb:001:007
2023/08/22 13:06:35 INFO polling for 20 times with 300ms delay
It took trying a few apps to find one that detected the reader, but it seems to be working:
Also looks ok in Device Manager:
At the moment these Mifare card aren't compatible with the script. You'll need to use some of the NTAG cards mentioned in the readme. We'll support them eventually, but it's not quite as straightforward. I'll try get them working soon
So, that's one thing. You'll have to either wait a bit until I've added support, or get some NTAG cards to test, otherwise it definitely won't work for sure. I'm still unsure about the error. I have Mifare cards too but I get an "RF transmission error" not an IO error
Though it's interesting, my one has zero status light output on mister, although the status light works as expected on a PC.
Totally unrelated to the general topic of this issue, but I just stumbled across the following libnfc issue when wondering about the ACR122U status light myself. So mostly an FYI.
Thanks for the link! We're already using a custom version of libnfc so it may not be such a big deal to add this in
I have the same problem. The reader don't scan anythings. Her are the log file:
2023/08/22 13:06:34 INFO starting nfc service 2023/08/22 13:06:34 INFO loaded 0 entries from database 2023/08/22 13:06:35 INFO opened connection: ACS / ACR122U PICC Interface acr122_usb:001:007 2023/08/22 13:06:35 INFO polling for 20 times with 300ms delay
To me this looks like it's working fine! Is there anything in particular that's happening which makes you think it's not working? The script and reader won't really do anything until you try to scan a card with some valid data on it
I try to scan a Lego Dimension Figur, but nothing happens. Lego Dimensions figur are NTAG213.
I've been investigating this with some other affected people. There's a couple things going on:
- Some of you are using Mifare cards. These aren't supported, but I am testing a new patch today which will add support for them. I hope to get it out in the next couple days depending how it goes
- Some of you have unfortunately gotten clone readers. They're indistinguishable from the outside but we've popped a couple open and they're clearly a very different board. I'm working on getting one myself so we can try add support, but I can't give a timeline on it yet sorry
thanks for the follow up. the price i paid makes more sense if it's a clone. i can send it your way if that would help
Hi everyone. The script has just been updated with support for Mifare tags. This won't fix issues with the incompatible scanner but I think it'll get things working for some of you. Please give it a shot!
So, I got one of these clones, and it also doesn't work. I opened it up and it has a blob chip, which was not a good sign. Anyway, I found this issue at the nfc-tools project about it: https://github.com/nfc-tools/libnfc/issues/576#issuecomment-706361288
Apparently, it will work if the usb_altinterface call is removed from the startup in libnfc. Maybe add a flag for a clone that would do that? Maybe there is something to distinguish the clone from the original USB-wise? For example, mine shows iSerial as 0.
You can see this by calling "lsusb -vv -d 072f:2200".
Wow nice find!! Let me put a test build together later today
Get Outlook for Androidhttps://aka.ms/AAb9ysg
From: Erico Mendonca @.> Sent: Wednesday, September 13, 2023 10:45:27 AM To: wizzomafizzo/mrext @.> Cc: Callan Barrett @.>; Comment @.> Subject: Re: [wizzomafizzo/mrext] Error using ACR122U-A9 (Issue #37)
So, I got one of these clones, and it also doesn't work. I opened it up and it has a blob chip, which was not a good sign. Anyway, I found this issue at the nfc-tools project about it: nfc-tools/libnfc#576 (comment)https://github.com/nfc-tools/libnfc/issues/576#issuecomment-706361288
Apparently, it will work if the usb_altinterface call is removed from the startup in libnfc. Maybe add a flag for a clone that would do that? Maybe there is something to distinguish the clone from the original USB-wise? For example, mine shows iSerial as 0.
You can see this by calling "lsusb -vv -d 072f:2200".
— Reply to this email directly, view it on GitHubhttps://github.com/wizzomafizzo/mrext/issues/37#issuecomment-1716860557, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AADMA3U4FI5NPHL2USCZYFDX2EM4PANCNFSM6AAAAAA3UUEI6Y. You are receiving this because you commented.Message ID: @.***>
Bus 001 Device 006: ID 072f:2200 Advanced Card Systems, Ltd ACR122U
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 0
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 8
idVendor 0x072f Advanced Card Systems, Ltd
idProduct 0x2200 ACR122U
bcdDevice 2.14
iManufacturer 1 ACS
iProduct 2 ACR122U PICC Interface
iSerial 0
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 0x005d
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x80
(Bus Powered)
MaxPower 200mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 3
bInterfaceClass 11 Chip/SmartCard
bInterfaceSubClass 0
bInterfaceProtocol 0
iInterface 0
ChipCard Interface Descriptor:
bLength 54
bDescriptorType 33
bcdCCID 1.00
nMaxSlotIndex 0
bVoltageSupport 7 5.0V 3.0V 1.8V
dwProtocols 2 T=1
dwDefaultClock 4000
dwMaxiumumClock 4000
bNumClockSupported 0
dwDataRate 10752 bps
dwMaxDataRate 250000 bps
bNumDataRatesSupp. 0
dwMaxIFSD 256
dwSyncProtocols 00000000
dwMechanical 00000000
dwFeatures 00020040
Auto parameter negotiation made by CCID
Short APDU level exchange
dwMaxCCIDMsgLen 271
bClassGetResponse 00
bClassEnvelope 00
wlcdLayout none
bPINSupport 0
bMaxCCIDBusySlots 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0008 1x 8 bytes
bInterval 50
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x02 EP 2 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x82 EP 2 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 1
can't get debug descriptor: Resource temporarily unavailable
Device Status: 0x0002
(Bus Powered)
Remote Wakeup Enabled
Let me know if anything here is different!
I've applied the patch shown in the linked issue. Please give it a shot and let me know if it's changed anything for you
My genuine reader appears to be working fine still, will need more testing but we may not even need to detect
the new nfc.sh is not working with my reader :(
Let me know if anything here is different!
Here is mine:
Bus 001 Device 006: ID 072f:2200 Advanced Card Systems, Ltd ACR122U
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 0
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 8
idVendor 0x072f Advanced Card Systems, Ltd
idProduct 0x2200 ACR122U
bcdDevice 2.07
iManufacturer 1 ACS
iProduct 2 ACR122U PICC Interface
iSerial 0
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 0x005d
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x80
(Bus Powered)
MaxPower 200mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 3
bInterfaceClass 11 Chip/SmartCard
bInterfaceSubClass 0
bInterfaceProtocol 0
iInterface 0
ChipCard Interface Descriptor:
bLength 54
bDescriptorType 33
bcdCCID 1.00
nMaxSlotIndex 0
bVoltageSupport 7 5.0V 3.0V 1.8V
dwProtocols 2 T=1
dwDefaultClock 4000
dwMaxiumumClock 4000
bNumClockSupported 0
dwDataRate 10752 bps
dwMaxDataRate 250000 bps
bNumDataRatesSupp. 0
dwMaxIFSD 256
dwSyncProtocols 00000000
dwMechanical 00000000
dwFeatures 00020040
Auto parameter negotiation made by CCID
Short APDU level exchange
dwMaxCCIDMsgLen 271
bClassGetResponse 00
bClassEnvelope 00
wlcdLayout none
bPINSupport 0
bMaxCCIDBusySlots 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0008 1x 8 bytes
bInterval 2
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x02 EP 2 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x82 EP 2 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
can't get debug descriptor: Resource temporarily unavailable
Device Status: 0x0000
(Bus Powered)
It appears to be identical to yours, except for the bcdDevice field.
Unfortunately, the patched binary did not work for me. Still got the same I/O error.
Looking again at the issues on the original project, it appears that this reader has many, many problems with different proposed solutions: https://github.com/nfc-tools/libnfc/issues/646 https://github.com/nfc-tools/libnfc/issues/691 https://github.com/nfc-tools/libnfc/pull/678
I'll look into getting it to work with my Linux machine first, if I find out something relevant, I'll report back.
https://github.com/nfc-tools/libnfc/pull/678
Not sure if this helps at all but I am actually using a fork of libnfc that includes this patch. You can see here:
https://github.com/wizzomafizzo/mrext/blob/f7aad9a78573463ab2193d04acfeaec4e2794553/scripts/armbuild/Dockerfile#L24
I thought this was necessary to get my ACR122U working in the first place. I have tested since then using the official repo (which is many commits ahead of that fork) and it does work but it would continuously error out when I tried to poll the device. That was awkward to handle so I left the fork for now
Anyway just something to keep in mind
And here is an example of building the NFC script with a patch:
https://github.com/wizzomafizzo/mrext/compare/main...fix-clone-reader
And here is an example of building the NFC script with a patch:
Interesting, I got it to work with this version, but it's acting a bit weird. Basically, it'll fail like before with I/O errors (and beep every few seconds), BUT if I place a card on top of the reader, it initializes the reader, reads the card, and launches the game. If I remove the card... another closed connection, IO error, and beep.
BTW, I got your Dockerfile, but I had to add "linux-libc-dev" to the apt-get install line so it could finish compiling libnfc. I then logged in to the container, cloned your repository, and compiled nfc.sh.
I was in process of compiling libnfc with debug, when I remembered to check the udev messages. Whenever there was an error on nfc.sh, I got quite a few unbind/remove messages on "udevadm monitor". Looking at dmesg, I noticed that there is a regular USB reset happening:
[ 5166.856201] usb 1-1.5: reset full-speed USB device number 8 using dwc2
Well, device 1-1 in this case is the USB hub plugged into the DE-10, according to "lsusb -t". Mine is the generic AliExpress 7-port hub board with the official MiSTer design.
I then plugged a USB voltage monitor on the MiSTer to check the reader's current usage. It stays at around 20mA on standby, and around 80mA when nfc.sh starts the service. Voltage was around 4.93V, which I found low.
I started pulling USB devices out, like my MT32pi, the Bluetooth dongle, and the keyboard, leaving only the Wifi and the reader. The voltage went up to almost exactly 5.0V, but the resets still occur.
Looking at my USB voltage meter (which is also a datalogger), I see this:
... the reader is pulling in peaks of 200mA (or more) and the USB voltage is going down to as much as 4.9V. So that appears to be the cause of the resets: this cheap clone reader consumes too much current. I'll try with a separate powered hub next to see what happens.
And plugging the reader to a computer, I can see that 200mA is its standby current after initializing the reader, going up to 400mA when reading a card. So, there is your problem...