londonhackspace / Doorbot

old RFID door entry bot, now mostly just door announcers
26 stars 10 forks source link

Card reader failure #23

Closed marksteward closed 5 years ago

marksteward commented 11 years ago
2013-05-08 16:39:58,377 DEBUG    Loading card table, mtime 1368027542
2013-05-08 16:39:58,675 INFO     Loaded 650 cards
2013-05-08 16:39:58,690 INFO     <...> authorised as charduff
2013-05-08 16:39:58,693 DEBUG    Triggering door relay
2013-05-08 16:39:59,196 DEBUG    Announcing to network
2013-05-08 16:39:59,198 DEBUG    Broadcasting RFID to network
2013-05-08 16:40:04,115 DEBUG    Loading card table, mtime 1368027602
2013-05-08 16:40:04,414 INFO     Loaded 650 cards
2013-05-08 16:40:04,428 INFO     <...> authorised as charduff
2013-05-08 16:40:04,431 DEBUG    Triggering door relay
2013-05-08 16:40:04,935 DEBUG    Announcing to network
2013-05-08 16:40:04,937 DEBUG    Broadcasting RFID to network
2013-05-08 16:40:10,324 INFO     <...> authorised as charduff
2013-05-08 16:40:10,326 DEBUG    Triggering door relay
2013-05-08 16:40:10,830 DEBUG    Announcing to network
2013-05-08 16:40:10,832 DEBUG    Broadcasting RFID to network
2013-05-08 16:40:13,398 INFO     <...> authorised as charduff
2013-05-08 16:40:13,400 DEBUG    Triggering door relay
2013-05-08 16:40:13,904 DEBUG    Announcing to network
2013-05-08 16:40:13,906 DEBUG    Broadcasting RFID to network
2013-05-08 16:40:16,455 INFO     <...> authorised as charduff
2013-05-08 16:40:16,457 DEBUG    Triggering door relay
2013-05-08 16:40:16,961 DEBUG    Announcing to network
2013-05-08 16:40:16,963 DEBUG    Broadcasting RFID to network
...
2013-05-08 17:05:46,099 INFO     <...> authorised as Hipster
2013-05-08 17:05:46,102 DEBUG    Triggering door relay
2013-05-08 17:05:46,605 DEBUG    Announcing to network
2013-05-08 17:05:46,608 DEBUG    Broadcasting RFID to network
2013-05-08 17:07:35,200 CRITICAL Unexpected error during poll: Error 6300 selecting card
2013-05-08 17:07:40,216 DEBUG    Starting main loop
2013-05-08 17:07:42,663 CRITICAL Unexpected error during poll: Error 6300 selecting card
2013-05-08 17:07:47,671 DEBUG    Starting main loop
2013-05-08 17:07:47,687 CRITICAL Unexpected error during poll: Error PC01 selecting card
2013-05-08 17:07:52,695 DEBUG    Starting main loop
...
Starting doorbot...
...
2013-05-08 17:10:14,566 DEBUG    Starting main loop
2013-05-08 17:10:14,789 CRITICAL Unexpected error during poll: Error PC01 selecting card
...
2013-05-08 17:16:04,393 DEBUG    Starting main loop
2013-05-08 17:16:04,438 DEBUG    Starting main loop
2013-05-08 17:16:04,624 CRITICAL Unexpected error during poll: Error PC01 selecting card
2013-05-08 17:16:04,629 CRITICAL Unexpected error during poll: Error PC01 selecting card
...
2013-05-08 17:17:45,743 CRITICAL Unexpected error during poll: Error PC01 selecting card
...
2013-05-08 17:21:33,602 DEBUG    Starting main loop
...
2013-05-08 17:30:28,885 INFO     <...> authorised as TimRTerrible
May  8 17:14:08 wilson pcscd: ccid_usb.c:660:WriteUSB() write failed (1/4): -4 No such device
May  8 17:14:11 wilson kernel: [107795.543984] usb 1-1.2: new full-speed USB device number 6 using dwc_otg
May  8 17:14:11 wilson kernel: [107795.648568] usb 1-1.2: New USB device found, idVendor=072f, idProduct=90cc
May  8 17:14:11 wilson kernel: [107795.648598] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
May  8 17:14:11 wilson kernel: [107795.648617] usb 1-1.2: Product: CCID USB Reader
May  8 17:14:11 wilson kernel: [107795.648647] usb 1-1.2: Manufacturer:    
May  8 17:14:45 wilson 6> 
May  8 17:15:01 wilson /USR/SBIN/CRON[10310]: (root) CMD (/root/Doorbot/getcards.sh)

pscsd restarted a couple of times with no luck, and then a second copy of doorbot was started simultaneously. After killing both, replugging the USB and restarting pcscd in foreground mode (after a 5 minute or so wait), it worked again.

It's probably replugging the USB that fixes it, and therefore either Linux or the reader getting into a persistently broken state. Unfortunately, killing pcscd while doorbot's running also triggers the PC01 error, so we need better diagnostics.

JasperWallace commented 11 years ago

this might help:

http://unix.stackexchange.com/questions/7412/how-to-reconnect-a-logically-disconnected-usb-device

or maybe not?

http://stackoverflow.com/questions/1163824/linux-usb-turning-the-power-on-and-off

marksteward commented 10 years ago

Happened on bell, too, while Jasper was playing with the 16-seg display.

JasperWallace commented 10 years ago

921c72eb8b5a38ec48873ce8c6a64860a5b5ab3f now means we exit when we lose the card reader. We rely on monit restarting us. seems to work?

marksteward commented 10 years ago

Now we're using RFUID, the error is:

Feb 12 21:42:33 hamming Doorbot[1483]: CRITICAL Unexpected error during poll: Unable to connect with protocol: T0 or T1. Card is unresponsive.
marksteward commented 10 years ago

For reference, as it's not in here yet, you can trigger this kind of behaviour by asking the pn532 to shut itself down (see https://github.com/marksteward/RFUID/blob/master/rfid.py#L363). The only way to fix this seems to be to cut power to the hub, and a Pi rebooting won't work.

Need to look at the ACR to see if it has any pins we could use to reset the pn532.

zymurgic commented 5 years ago

Refers to old install, irrelevant to any current install