Hallo,
@nurazur
ich habe jetzt endlich wieder Zeit für meine FS20-Forschung. Es schaltet (mit test_device.py)!
Allerdings verwirren mich die vielen Fehler.
Wer kann mich erhellen?
Raspberry Pi Details:
Type: Pi 3, Revision: 02, Memory: 1024MB, Maker: Embest
* Device tree is enabled.
*--> Raspberry Pi 3 Model B Rev 1.2
====================
PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
Linux 4.19.42-v7+ armv7l
====================
Python 2.7.13
Python 3.5.3
====================
Installation ohne Fehler:
~/fs20/pyusb-master $ sudo python setup.py install
~/fs20/pyfs20-master $ sudo python setup.py install
********* lsusb *********
Bus 001 Device 007: ID 18ef:e015
Bus 001 Device 005: ID 18ef:e014
====================
[ 2.439750] usb 1-1.4: New USB device found, idVendor=18ef, idProduct=e014, bcdDevice= 0.00
[ 2.439771] usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 2.439783] usb 1-1.4: Product: FS20PCE
[ 2.439806] usb 1-1.4: Manufacturer: ELV Elektronik AG
[ 2.446974] hid-generic 0003:18EF:E014.0001: hiddev96,hidraw0: USB HID v1.01 Device [ELV Elektronik AG FS20PCE] on usb-3f980000.usb-1.4/input0
====================
[ 2.906528] usb 1-1.5: New USB device found, idVendor=18ef, idProduct=e015, bcdDevice= 0.00
[ 2.906563] usb 1-1.5: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 2.906577] usb 1-1.5: Product: FS20PCS
[ 2.906599] usb 1-1.5: Manufacturer: ELV Elektronik AG
[ 2.907363] input: USB Keyboard Consumer Control as /devices/platform/soc/http://3f980000.usb/usb1/1-1/1-1.3…03/input/input2
[ 2.907902] hid-generic 0003:05AF:7596.0003: input,hidraw2: USB HID v1.11 Device [ USB Keyboard] on usb-3f980000.usb-1.3.3/input1
[ 2.923985] hid-generic 0003:18EF:E015.0004: hiddev97,hidraw3: USB HID v1.01 Device [ELV Elektronik AG FS20PCS] on usb-3f980000.usb-1.5/input0
====================
soweit so gut, Test spuckt jede Menge Fehler aus:
.........................................................
pi@raspberrypi:~/fs20/pyfs20-master/tests $ sudo python runall.py
test__get_device (test_pcs.TestPCS) ... ok
test__get_raw_address (test_pcs.TestPCS) ... ok
test__get_raw_command (test_pcs.TestPCS) ... ok
test__get_raw_interval (test_pcs.TestPCS) ... ok
test__get_response (test_pcs.TestPCS) ... ok
test__write (test_pcs.TestPCS) ... ERROR
test_get_version (test_pcs.TestPCS) ... ERROR
test_send_multiple (test_pcs.TestPCS) ... ERROR
test_send_once (test_pcs.TestPCS) ... ERROR
test_stop_multiple_sending (test_pcs.TestPCS) ... ERROR
test__get_device (test_pce.TestPCE) ... ok
test_get_response (test_pce.TestPCE) ... ERROR
test_get_version (test_pce.TestPCE) ... ERROR
test_reset (test_pce.TestPCE) ... ERROR
test_add_callback (test_pce.TestReceiver) ... ok
test_run (test_pce.TestReceiver) ... ERROR
test_stop (test_pce.TestReceiver) ... ok
test___init__ (test_pce.TestResponse) ... ok
test__str__ (test_pce.TestResponse) ... ok
test_address_part_to_byte (test_util.TestUtil) ... ok
test_address_to_byte (test_util.TestUtil) ... ok
test_byte_to_address (test_util.TestUtil) ... ok
test_byte_to_address_part (test_util.TestUtil) ... ok
test_byte_to_time_string (test_util.TestUtil) ... ok
test_datetime_to_seconds (test_util.TestUtil) ... ok
test_is_valid_address_part (test_util.TestUtil) ... ok
test_time_string_to_byte (test_util.TestUtil) ... ok
test_callable (test_device.TestDevice) ... ERROR
test_callable_blocked (test_device.TestDevice) ... ERROR
test_callable_unknown (test_device.TestDevice) ... ok
Allerdings schaltet dieser Aufruf einen Aktor:
sudo python tests/test_device.py
test_callable (__main__.TestDevice) ... ERROR
test_callable_blocked (__main__.TestDevice) ... ERROR
test_callable_unknown (__main__.TestDevice) ... ok
======================================================================
ERROR: test_callable (__main__.TestDevice)
----------------------------------------------------------------------
Traceback (most recent call last):
File "tests/test_device.py", line 19, in test_callable
self.assertEqual(self._switch.on(), 100)
File "/usr/local/lib/python2.7/dist-packages/fs20/device.py", line 98, in callable
, time=util.time_string_to_byte(time_string)
File "/usr/local/lib/python2.7/dist-packages/fs20/pcs.py", line 234, in send_once
+ self._get_raw_command(command + time)
File "/usr/local/lib/python2.7/dist-packages/fs20/pcs.py", line 184, in _write
return self._get_response()
File "/usr/local/lib/python2.7/dist-packages/fs20/pcs.py", line 169, in _get_response
raise DeviceInvalidResponse('Invalid response from device.')
DeviceInvalidResponse: Invalid response from device.
======================================================================
ERROR: test_callable_blocked (__main__.TestDevice)
----------------------------------------------------------------------
Traceback (most recent call last):
File "tests/test_device.py", line 27, in test_callable_blocked
self.assertEqual(self._switch.on(), 100)
File "/usr/local/lib/python2.7/dist-packages/fs20/device.py", line 98, in callable
, time=util.time_string_to_byte(time_string)
File "/usr/local/lib/python2.7/dist-packages/fs20/pcs.py", line 234, in send_once
+ self._get_raw_command(command + time)
File "/usr/local/lib/python2.7/dist-packages/fs20/pcs.py", line 182, in _write
self._get_device().write(ENDPOINT_WRITE, dataframe)
File "build/bdist.linux-armv7l/egg/usb/core.py", line 940, in write
intf, ep = self._ctx.setup_request(self, endpoint)
File "build/bdist.linux-armv7l/egg/usb/core.py", line 102, in wrapper
return f(self, *args, **kwargs)
File "build/bdist.linux-armv7l/egg/usb/core.py", line 216, in setup_request
self.managed_claim_interface(device, intf)
File "build/bdist.linux-armv7l/egg/usb/core.py", line 102, in wrapper
return f(self, *args, **kwargs)
File "build/bdist.linux-armv7l/egg/usb/core.py", line 167, in managed_claim_interface
self.backend.claim_interface(self.handle, i)
File "build/bdist.linux-armv7l/egg/usb/backend/libusb1.py", line 811, in claim_interface
_check(self.lib.libusb_claim_interface(dev_handle.handle, intf))
File "build/bdist.linux-armv7l/egg/usb/backend/libusb1.py", line 595, in _check
raise USBError(_strerror(ret), ret, _libusb_errno[ret])
USBError: [Errno 16] Resource busy
----------------------------------------------------------------------
Ran 3 tests in 0.133s
FAILED (errors=2)