charlysan / pyrfidhid

Python library to control Chinese USB HID 125Khz RFID Reader/Writer
MIT License
142 stars 36 forks source link

unexpected keyword argument 'version' #6

Closed steakhal closed 4 years ago

steakhal commented 4 years ago

I had some problems with using this tool.

I have the following system and configuration:

$ lsusb -d ffff:0035
Bus 002 Device 008: ID ffff:0035 IC Reader IC Reader

$ cat /etc/udev/rules.d/99-rfidreader.rule
SUBSYSTEM=="usb", ATTR{idVendor}=="ffff", ATTR{idProduct}=="0035", MODE="0666", GROUP="usbusers"

$ groups
... usbusers ...

I tried to use the CLI utility, but I got the following trace:

$ rfid_cli -h
Traceback (most recent call last):
  File "/usr/bin/rfid_cli", line 11, in <module>
    load_entry_point('pyrfidhid==1.0', 'console_scripts', 'rfid_cli')()
  File "/usr/lib/python3.7/site-packages/pyrfidhid-1.0-py3.7.egg/cli/rfid_cli.py", line 410, in main
  File "/usr/lib/python3.7/site-packages/pyrfidhid-1.0-py3.7.egg/cli/rfid_cli.py", line 43, in __init__
  File "/usr/lib/python3.7/site-packages/pyrfidhid-1.0-py3.7.egg/cli/rfid_cli.py", line 303, in parse_arguments
TypeError: __init__() got an unexpected keyword argument 'version'

And when I tried to use it from source, eg. using your read.py example, also failed:

$ python read.py
Initializing device...
Traceback (most recent call last):
  File "read.py", line 76, in <module>
    main()
  File "read.py", line 48, in main
    rfid.init()
  File "/usr/lib/python3.7/site-packages/pyrfidhid-1.0-py3.7.egg/rfidhid/core.py", line 58, in init
  File "/usr/lib/python3.7/site-packages/pyrfidhid-1.0-py3.7.egg/rfidhid/usb_hid.py", line 43, in get_report_descriptor
  File "/usr/lib/python3.7/site-packages/usb/control.py", line 173, in get_descriptor
    data_or_wLength = desc_size)
  File "/usr/lib/python3.7/site-packages/usb/core.py", line 1025, in ctrl_transfer
    self._ctx.managed_open()
  File "/usr/lib/python3.7/site-packages/usb/core.py", line 102, in wrapper
    return f(self, *args, **kwargs)
  File "/usr/lib/python3.7/site-packages/usb/core.py", line 120, in managed_open
    self.handle = self.backend.open_device(self.dev)
  File "/usr/lib/python3.7/site-packages/usb/backend/libusb1.py", line 786, in open_device
    return _DeviceHandle(dev)
  File "/usr/lib/python3.7/site-packages/usb/backend/libusb1.py", line 643, in __init__
    _check(_lib.libusb_open(self.devid, byref(self.handle)))
  File "/usr/lib/python3.7/site-packages/usb/backend/libusb1.py", line 595, in _check
    raise USBError(_strerror(ret), ret, _libusb_errno[ret])
usb.core.USBError: [Errno 13] Access denied (insufficient permissions)

Using sudo did not help.

$ sudo python read.py 
Initializing device...
Traceback (most recent call last):
  File "read.py", line 76, in <module>
    main()
  File "read.py", line 48, in main
    rfid.init()
  File "/usr/lib/python3.7/site-packages/pyrfidhid-1.0-py3.7.egg/rfidhid/core.py", line 58, in init
  File "/usr/lib/python3.7/site-packages/pyrfidhid-1.0-py3.7.egg/rfidhid/usb_hid.py", line 43, in get_report_descriptor
  File "/usr/lib/python3.7/site-packages/usb/control.py", line 173, in get_descriptor
    data_or_wLength = desc_size)
  File "/usr/lib/python3.7/site-packages/usb/core.py", line 1043, in ctrl_transfer
    self.__get_timeout(timeout))
  File "/usr/lib/python3.7/site-packages/usb/backend/libusb1.py", line 883, in ctrl_transfer
    timeout))
  File "/usr/lib/python3.7/site-packages/usb/backend/libusb1.py", line 595, in _check
    raise USBError(_strerror(ret), ret, _libusb_errno[ret])
usb.core.USBError: [Errno 32] Pipe error

I have strictly followed the Setup steps for Linux.

# libusb-1.0-0-dev was already installed
$ sudo pip install pyusb
$ sudo python setup.py install

Could you help me diagnose what went wrong?

charlysan commented 4 years ago

@steakhal, have you tried using a different Linux distribution AND/OR python version to see if you get the same error?

steakhal commented 4 years ago

Unfortunately, I have no more time and interest investigating this issue :| I'm really sorry for disturbing you, I will close this issue not. Maybe later if the conditions change, I will pick this up and reopen the ticket.

Sorry.