4 Replies Latest reply on Oct 23, 2014 10:28 AM by BG4BMH

    Failed to access the USB through python.

    BG4BMH

      Hi all, I want to access the NFC card reader(ACR 122) through python. Here is what i have done.

       

      1st, run the lsusb to make sure the card reader is active on the usb port:

       

      root@clanton:/media/mmcblk0p1/nfcpy/examples# lsusb                       

      Bus 001 Device 002: ID 072f:2200                                          
      Bus 001 Device 001: ID 1d6b:0001                                          
      Bus 002 Device 001: ID 1d6b:0002                                          

       

      2nd, install the python usb code from the sourceforge.

       

      3rd, run the python script and get the error:

      root@clanton:/media/mmcblk0p1/nfcpy/examples# python tagtool.py           
      [nfc.clf] searching for reader with path 'usb'                            
      Traceback (most recent call last):                                        
        File "tagtool.py", line 479, in <module>                                
      TagTool().run()                                                       
        File "/media/mmcblk0p1/nfcpy/examples/cli.py", line 283, in run         
      while self.run_once() and self.options.loop:                          
        File "/media/mmcblk0p1/nfcpy/examples/cli.py", line 230, in run_once    
      try: clf = nfc.ContactlessFrontend(device)                            
        File "/media/mmcblk0p1/nfcpy/nfc/clf.py", line 105, in __init__         
      if path and not self.open(path):                                      
        File "/media/mmcblk0p1/nfcpy/nfc/clf.py", line 156, in open             
      self.dev = nfc.dev.connect(path)                                      
        File "/media/mmcblk0p1/nfcpy/nfc/dev/__init__.py", line 55, in connect  
      found = transport.USB.find(path)                                      
        File "/media/mmcblk0p1/nfcpy/nfc/dev/transport.py", line 169, in find   
      for d in cls.usb_core.find(find_all=True, **match)]                   
        File "/usr/lib/python2.7/site-packages/usb/core.py", line 829, in find  
      raise ValueError('No backend available')                              
      ValueError: No backend available                                           

       

      It seems like the python script can not find the usb backend.

       

      But here is the installed libusb package in the sysem:

      root@clanton:/media/mmcblk0p1/nfcpy/examples# opkg list-installed | grep -i libusb

      libusb-0.1-4 - 1:0.1.4-r1                                                      

      libusb-1.0-0 - 1.0.9-r1                                                        

      root@clanton:/media/mmcblk0p1/nfcpy/examples#

       

      Is there anything i missed? Thanks for your help.