1

Good day,

I'm a student and I would just like to ask for a minute of your time. I'm working on a barcode reader connected via USB port to a board name Arduino Yun. This board runs a version of embedded linux derived from OpenWrt using a microprocessor named Atheros AR9331

I would like to ask you, what's necessary to make the Python Evdev binding (python-evdev.readthedocs.org/en/latest/), to be able to run in this type of MIPS microarchitecture? At the momento, it's only for Ubuntu and ArchLinux. I'm kind of guessing that cross compilation would be needed, or the indication of the usage of a specific C compiler inside this linux.
The current python version supported for OpenWrt is 2.7.3 I already know , if you compile C code in your PC, the resulting executable will only run in this type of architecture. If you use that compiled program inside the microprocessor, it wont work. I've used this binding without trouble within ubuntu in my PC. I followed the instructions, python setup.py install, with a previous installation of setuptools, and it worked just fine.

But regarding OpenWrt, this was not the case.

The python script I'm using requires this library within the first line of code in order to reach the data from the device (it works like a keyboard /dev/input/event0):

#!/usr/bin/env python

from evdev import InputDevice, ecodes, list_devices

from select import select

I've seen suggestions of copying the entire library inside the arduino, and run the script inside the same folder. But it doesn't work, since the evdev module has files created with the architecture of the PC and not the MIPS.

So, what are the messages displayed for the error? If you run python setup.py install in Openwrt to try to install the evdev binding, this appears on screen:

File "setup.py", line 10, in <module> from setuptools.command.develop import develop ImportError: No module named setuptools.command.develop

It's obvious from here that you need the module aforementioned. So, I tried to install it with this script (pypi.python.org/pypi/setuptools):

python ez_setup.py

And the output shows this: Downloading https://pypi.python.org/packages/source/s/setuptools/setuptools-11.3.1.zip Traceback (most recent call last): File "ez_setup.py", line 332, in <module> sys.exit(main()) File "ez_setup.py", line 327, in main downloader_factory=options.downloader_factory, File "ez_setup.py", line 287, in download_setuptools downloader(url, saveto) File "ez_setup.py", line 209, in download_file_curl _clean_check(cmd, target) File "ez_setup.py", line 169, in _clean_check subprocess.check_call(cmd) File "/usr/lib/python2.7/subprocess.py", line 511, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['curl','https://pypi.python.org/packages/source/s/setuptools/setuptools-11.3.1.zip', '--silent', '--output', '/mnt/sda1/evdev-0.4.6/setuptools-11.3.1.zip']' returned non-zero exit status 60

I pressume this output is due to the fact that pypi doesn't exist for the python 2.7.3 in OpenWrt , only for newer versions and other architectures. Evedv binding is requiring the setuptools module in order to make things easier and standard, but if the binding is not supported for the target architecture, what's needed to be able to use it anyways?

Thanks for your time,

  • You may want to consider trimming this question down to its most essential facts. See [ask] for more information on how to ask a good question. – Heretic Monkey Jan 09 '15 at 20:23

2 Answers2

3

Good day everyone,

The solution was provided by Georgi Valkov. He is the creator of the python-evdev binding. I contacted him directly, and he was so kind that he cross compiled a version for the OpenWrt / Yun .

You can install the package using the openwrt package manager - opkg. The installation process is along the lines of:

$ opkg update
$ opkg install /path/to/python-evdev_0.4.7-1_ar71xx.ipk

To verify that the install was successful:

$ opkg files python-evdev
/usr/lib/python2.7/site-packages/evdev-0.4.7-py2.7.egg-info
/usr/lib/python2.7/site-packages/evdev/genecodes.py
/usr/lib/python2.7/site-packages/evdev/ff.py
/usr/lib/python2.7/site-packages/evdev/_input.so
/usr/lib/python2.7/site-packages/evdev/device.py
/usr/lib/python2.7/site-packages/evdev/events.py
/usr/lib/python2.7/site-packages/evdev/__init__.py
/usr/lib/python2.7/site-packages/evdev/ecodes.py
/usr/lib/python2.7/site-packages/evdev/_ecodes.so
/usr/lib/python2.7/site-packages/evdev/util.py
/usr/lib/python2.7/site-packages/evdev/uinput.py
/usr/lib/python2.7/site-packages/evdev/_uinput.so

This works just fine. Thanks.

PS. If someone needs the file, please contact me. Georgi sent me this address, but I didn't download the file from there because he sent it to me over email. https://github.com/gvalkov/openwrt-packages-yun/blob/master/lang/python-evdev/Makefile

1

In the output, you can see that curl returned the status code 60. According to man curl

60 Peer certificate cannot be authenticated with known CA certifi‐ cates.

According to the setuptools page, you can instead use python ez_setup.py --insecure but obviously do that at your own risk. Alternatively you could do what the advanced instructions say and manually download the setuptools tarball, verify its md5 hash yourself, and install it using its setup.py .

Ademan
  • 56
  • 4