cversek/python-FLI

Preparing the FLI SDK Dependency

cversek opened this issue · 1 comments

If you are getting an error message like
OSError: libfli.so: cannot open shared object file: No such file or directory
it is very likely that the FLI SDK hasn't been compiled and installed properly.

There are a few steps that one needs to prepare FLI's SDK so that python-FLI can provide access to the C library.

First, the SDK must be compiled as a shared object/dynamic library (.so file) rather than the default, which is a static object (.a file). I have just posted a replacement Makefile that can be dropped in the libfli-1.104 source package folder. Then one can run make clean (if code was already compiled) then make install (as root). That should build the library so that it can be handled by the Python ctypes module (python-FLI is just a slightly more convenient OO wrapper for this foreign function interface module) and copy it to /usr/local/lib.

Now depending on the target Linux system /usr/local/lib might not be on the dynamic libraries path. There are many ways to get this library found, but I have a few suggestions in order of least hacky first. On Ubuntu and similar, that path could be added to the end of file /etc/ld.so.conf, which is updated next by running ldconfig. If that doesn't seem to work, you could create a symbolic link like this:
sudo ln -s /usr/local/lib/libfli.so /usr/lib
If ctypes is still having trouble finding the library, you could always just drop it into the python package folder (probably somewhere like /usr/local/lib/python2.7/dist-packages/FLI-dev-py2.7.egg/FLI/)

Here is what I needed to do on Ubuntu 12.04 to get my camera working.

dowload FLI SDK >= 1.104 and FLI Linux Kernel Module >= 1.3 from
http://www.flicamera.com/software/index.html

fliusb install

user@...:~$ cd ../fliusb-1.3
user@...$ make

As root, (or use sudo) run:

root@...$ mkdir /lib/modules/uname -r/misc
root@...$ cp fliusb.ko /lib/modules/uname -r/misc
root@...$ depmod -a
root@...$ modprobe fliusb

to check install,
user@...$ dmesg | tail

should show something similar to:

FLI USB device found: 'Camera Name'
FLI USB device attached; rdepaddr: 0x82; wrepaddr: 0x02; buffersize: 4096;
timeout: 5000

then you loaded your driver successfully.

If you would like to load driver during each computer boot, add fliusb to /etc/modules.

libfli install
Get updated makefile for libfli-1.104
https://github.com/cversek/python-FLI/tree/master/libfli.so-1.104_Makefile

Then as normal user:

make sure updated makefile is copied to the libfli-1.104 folder
user@...$ cd ../libfli-1.104
user@...$ make

camera permissions
You must also allow a standard user access to the camera (by default only root has access)

modify udev rules, add a file
/etc/udev/rules.d/80-flicam.rules

contents of file should be:

Finger Lakes Camera

KERNEL=="fliusb*", MODE="666", GROUP="plugdev"

Make sure that the GROUP is one that the desired user is a part of (check by typing
"groups username" at a command prompt)

reload with
user@...$ sudo udevadm control --reload-rules

and unplug/replug camera

double check correct permissions with
user@...$ cd /dev
user@...$ ls -al | grep fli

install python-FLI
download from https://github.com/cversek/python-FLI
user@...$ cd ../download_directory
user@...$ python setup.py install

Then, a quick check of the camera in python

import FLI
cams = FLI.camera.USBCamera.find_devices()
cam0=cams[0]
cam0
<FLI.camera.USBCamera object at 0x283ce10>
cam0.get_temperature()
will print out current camera temperature