ryanolf / node-sonos-nfc

Access your streaming music through physical NFC tokens, like putting on a CD or record. Great for children and adult aesthetics.
MIT License
36 stars 14 forks source link

[0] ReadError: Read operation failed: Status code: 0x6300 #2

Closed savepluto closed 3 years ago

savepluto commented 3 years ago

Hi raynolf,

I am getting an error message when reading NFC cards ("ReadError: Read operation failed: Status code: 0x6300"). Reader is recognized, as you can see in the log. When holding a card to the reader, it beeps/ LED color changes, but content can not be read. Tried with multiple cards - always same error. Reading with Win10/ NFC Tools or Android/ NFC tools does not show any issues.

Do you have any advise?

Regards

PM2 LOG - seems to come up nicely:

as@raspberrypi:~ $ pm2 log [TAILING] Tailing last 15 lines for [all] processes (change the value with --lines option) /home/as/.pm2/pm2.log last 15 lines: PM2 | 2021-02-24T10:32:00: PM2 log: PM2 version : 4.5.4 PM2 | 2021-02-24T10:32:00: PM2 log: Node.js version : 15.9.0 PM2 | 2021-02-24T10:32:00: PM2 log: Current arch : arm PM2 | 2021-02-24T10:32:00: PM2 log: PM2 home : /home/as/.pm2 PM2 | 2021-02-24T10:32:00: PM2 log: PM2 PID file : /home/as/.pm2/pm2.pid PM2 | 2021-02-24T10:32:00: PM2 log: RPC socket file : /home/as/.pm2/rpc.sock PM2 | 2021-02-24T10:32:00: PM2 log: BUS socket file : /home/as/.pm2/pub.sock PM2 | 2021-02-24T10:32:00: PM2 log: Application log path : /home/as/.pm2/logs PM2 | 2021-02-24T10:32:00: PM2 log: Worker Interval : 30000 PM2 | 2021-02-24T10:32:00: PM2 log: Process dump file : /home/as/.pm2/dump.pm2 PM2 | 2021-02-24T10:32:00: PM2 log: Concurrent actions : 2 PM2 | 2021-02-24T10:32:00: PM2 log: SIGTERM timeout : 1600 PM2 | 2021-02-24T10:32:00: PM2 log: =============================================================================== PM2 | 2021-02-24T10:32:00: PM2 log: App [npm:0] starting in -fork mode- PM2 | 2021-02-24T10:32:00: PM2 log: App [npm:0] online

/home/as/.pm2/logs/npm-error.log last 15 lines: /home/as/.pm2/logs/npm-out.log last 15 lines: 0|npm | > concurrently --kill-others "npm start" "npm explore sonos-http-api -- npm start" 0|npm | 0|npm | [0] 0|npm | [0] > sonos-nfc@0.1.0 start 0|npm | [0] > node sonos_nfc.js 0|npm | [0] 0|npm | [0] Control your Sonos with NFC cards. Searching for PCSC-compatible NFC reader devices... 0|npm | [0] ACS ACR122U 00 00 device attached 0|npm | [1] 0|npm | [1] > sonos-http-api@1.6.9 start 0|npm | [1] > node server.js 0|npm | [1] 0|npm | [1] 2021-02-24T09:32:29.615Z INFO Could not find file /home/as/vinyl/node-sonos-nfc/node_modules/sonos-http-api/settings.json 0|npm | [1] 2021-02-24T09:32:30.745Z INFO Presets loaded: {} 0|npm | [1] 2021-02-24T09:32:36.161Z INFO http server listening on 0.0.0.0 port 5005

When holding a NFC card to the reader, log shows the following lines:

0|npm | [0] ACS ACR122U 00 00 detected TAG_ISO_14443_3 with UID 73984171 0|npm | [0] 0|npm | ReadError: Read operation failed: Status code: 0x6300 0|npm | [0] 0|npm | ACS ACR122U 00 00: TAG_ISO_14443_3 with UID 73984171 removed

savepluto commented 3 years ago

This is probably causd by used mifare classic card, will try with NFC Forum Type card and get back.

ryanolf commented 3 years ago

@savepluto Thanks for using my code and filing this report!

The issue you are seeing should go away if you use a a card that doesn't require authentication. The MiFare classic apparently always requires authentication, which my code doesn't implement at the moment. I have used NTAG13 tags, but Mifare Ultralight may work as well.

The error is generated by the NFC-PCSC code. I've only implemented basic reading without authentication, though it is possible to add support for Mifare classic. The readme for nfc-pcsc has more info. If there's a compelling case to support MiFare Classic card, I can convert this to a feature request. Otherwise, I guess we can close this if using an a more basic card type works for you.

savepluto commented 3 years ago

As expected - malfunction was by incompatible card type. Runs perfectly fine with NTAG 216 card. Thanks for your response!