arvydas / blinkstick-python

BlinkStick Python interface to control devices connected to the computer
Other
135 stars 53 forks source link

psutil needs compiler for openwrt systems #19

Closed emanuelstanciu closed 9 years ago

emanuelstanciu commented 10 years ago

I tried to install the blinkstick python on openwrt and everything installs fine (see PyUSB comment) except for psutil, which throws the following error: unable to execute mips-openwrt-linux-uclibc-gcc: No such file or directory error: Setup script exited with error: command 'mips-openwrt-linux-uclibc-gcc' failed with exit status 1 Unfortunately it's hard and complicated to install a cross-compiler on an openwrt and other set-ups need to be accommodated for. Can you either provide a compiled version or simpler, does the library actually makes use of psutil?

arvydas commented 10 years ago

OpenWRT was always on my list :-) The psutil is not necessary, it's just there for the control script to display CPU usage with the following command:

blinkstick --cpu-usage

You can download the zip file for the BlinkStick pip package, remove the psutil reference from the setup.py and remove it from bin/blinkstick file and you should be good to go. You would lack this feature, however.

If there was any way for me to detect that the setup.py script is being run inside OpenWRT, then I could easily add conditional code to disable the cpu usage feature for OpenWRT. Unfortunately I don't have an OpenWRT enabled router now to test this.

arvydas commented 10 years ago

Oh, just remembered that we also have plans on removing the additional dependencies for third party pip packages only used in the control script. The idea is to make BlinkStick pip package lean and then add an option to download the script separately.

emanuelstanciu commented 10 years ago

Solved this one as suggested, removed reference from the setup.py and bin/blinkstick. However, the system doesn't recognise the blinkstick now, and this might be the biggest problem ever. Do I need any sort of special drivers for OpenWRT? BlinkStick control script 0.7.0 (c) Agile Innovative Ltd 2013

Traceback (most recent call last): File "/usr/bin/blinkstick", line 5, in pkg_resources.run_script('BlinkStick==0.7.0', 'blinkstick') File "build/bdist.linux-mips/egg/pkg_resources.py", line 483, in run_script both group and name are yielded (in distribution order). File "build/bdist.linux-mips/egg/pkg_resources.py", line 1348, in run_script self.zipinfo = zipimport._zip_directory_cache[self.loader.archive] File "/usr/lib/python2.7/site-packages/BlinkStick-0.7.0-py2.7.egg/EGG-INFO/scripts/blinkstick", line 308, in

File "/usr/lib/python2.7/site-packages/BlinkStick-0.7.0-py2.7.egg/EGG-INFO/scripts/blinkstick", line 231, in main

File "build/bdist.linux-mips/egg/blinkstick/blinkstick.py", line 397, in find_all File "build/bdist.linux-mips/egg/blinkstick/blinkstick.py", line 389, in _find_blicksticks File "/usr/lib/python2.7/site-packages/usb/core.py", line 864, in find raise ValueError('No backend available') ValueError: No backend available

Also, the system is no displaying anything in /dev

arvydas commented 10 years ago

This is actually a different issue. PyUSB is complaining that there is no backend available to interface USB device. Normally PyUSB uses libusb on Linux to access USB devices. Is it installed on OpenWRT? I've also read somewhere that this issue can happen when PyUSB can't find libusb on the system if it's installed in a non standard location.

emanuelstanciu commented 10 years ago

I have PyUSB and libusb, everything is installed and communicating properly. The issue is that the usb connection is not working properly as it is not recognised in /dev root@ComputeNode:~# ls dev ls: dev: No such file or directory root@ComputeNode:~# ls /dev bus mem mtd2ro mtd5ro mtdblock5 ptmx shm ttyS11 ttyS3 ttyS9 console mtd0 mtd3 mtdblock0 network_latency pts tty ttyS12 ttyS4 urandom cpu_dma_latency mtd0ro mtd3ro mtdblock1 network_throughput random ttyATH0 ttyS13 ttyS5 watchdog full mtd1 mtd4 mtdblock2 null sda ttyS0 ttyS14 ttyS6 zero kmsg mtd1ro mtd4ro mtdblock3 port sda1 ttyS1 ttyS15 ttyS7 log mtd2 mtd5 mtdblock4 ppp sda2 ttyS10 ttyS2 ttyS8 root@ComputeNode:~# blinkstick BlinkStick control script 0.7.0 (c) Agile Innovative Ltd 2013

Traceback (most recent call last): File "/usr/bin/blinkstick", line 340, in sys.exit(main()) File "/usr/bin/blinkstick", line 248, in main sticks = blinkstick.find_all() File "/usr/lib/python2.7/site-packages/blinkstick/blinkstick.py", line 397, in find_all return [BlinkStick(device=d) for d in _find_blicksticks()] File "/usr/lib/python2.7/site-packages/blinkstick/blinkstick.py", line 389, in _find_blicksticks return usb.core.find(find_all=find_all, idVendor=VENDOR_ID, idProduct=PRODUCT_ID) File "/usr/lib/python2.7/site-packages/usb/core.py", line 864, in find raise ValueError('No backend available') ValueError: No backend available root@ComputeNode:~#

But USB is recognised with dmesg when I plug the blinkstick: [ 324.390000] usb 1-1.5.4: USB disconnect, device number 7 [ 334.110000] usb 1-1.5.4: new low-speed USB device number 9 using ehci-platform

So I think it's a driver issue. I installed kmod-usb-core and kmod-usb-acm, acm which is recommended around the net for Arduino serial communication, but still no luck. Any other idea?

arvydas commented 10 years ago

BlinkStick is a HID device, It acts more like a keyboard/mouse rather than Arduino. You probably need to ensure that HID devices are supported with the kernel module.

arvydas commented 10 years ago

This might be a good place to start:

http://h-wrt.com/en/doc/kb

arvydas commented 9 years ago

psutil is no longer a dependency since 1.0