Patch to remove 'Connection timed out' messages with SCM3711

Asked by Hartmut Benz

I am using an SCM3711 on ubuntu 11.10.

While my script is waiting for a device to come into range, it continuously prints
   Connection timed out
   Connection timed out
   Connection timed out
   ...
I have traced this down to pn53x_usb.py where I have added a third test.

=== modified file 'nfc/dev/pn53x_usb.py'
--- nfc/dev/pn53x_usb.py 2011-09-27 17:31:57 +0000
+++ nfc/dev/pn53x_usb.py 2012-01-30 09:35:07 +0000
@@ -67,7 +67,8 @@
             try: frame = self.dh.bulkRead(self.usb_inp, 300, timeout)
             except usb.USBError as error:
                 if (error.args[0] == "No error" or
- error.args[0] == "usb_reap: timeout error"):
+ error.args[0] == "usb_reap: timeout error" or
+ error.args[0] == "Connection timed out"):
                     # normal timeout condition on Linux (1) and Windows (2)
                     return None
                 usb_err = "could not set config 1: Device or resource busy"

I hope this helps someone
/Hartmut

Question information

Language:
English Edit question
Status:
Solved
For:
nfcpy Edit question
Assignee:
No assignee Edit question
Solved by:
Stephen Tiedemann
Solved:
Last query:
Last reply:
Revision history for this message
Stephen Tiedemann (stephen-tiedemann) said :
#1

Which libusb and pyusb version are you using? I can't see that message on
my Ubuntu 11.10.

Revision history for this message
Hartmut Benz (hartmut-benz) said :
#2

I am seeing this on ubuntu 11.10, pyusb-0.4.3-py2.7-linux-i686.egg and dpkg --list |grep libusb:
ii libusb-0.1-4 2:0.1.12-18 userspace USB programming library
ii libusb-1.0-0 2:1.0.8-4 userspace USB programming library
ii libusb-dev 2:0.1.12-18 userspace USB programming library development files

as well as with

Ubuntu 10.04.3 LTS, pyusb-0.4.3-py2.6-linux-i686.egg and dpkg --list|grep libusb:
ii libusb-0.1-4 2:0.1.12-14ubuntu0.2 userspace USB programming library
ii libusb-dev

Revision history for this message
Best Stephen Tiedemann (stephen-tiedemann) said :
#3

Patch added with revision #97. Thanks.

Revision history for this message
Hartmut Benz (hartmut-benz) said :
#4

Thanks Stephen Tiedemann, that solved my question.