Install Phidgets on Raspberry Pi

To be able to use Phidget on Raspberry, you will have to do the following steps.

Install Phidgets librairies

First of all, you have to download and compile the C phidget library to be able to use it on Raspberry.

sudo apt-get install libusb-1.0.0-dev
wget http://www.phidgets.com/downloads/libraries/libphidget.tar.gz
cd libphidget-* ; # * could be 2.1.8.20150207
./configure
make
sudo make install

Then you have to add Phidget .NET library available for Mono. First you have to download the needed packages with the following commands:

wget http://www.phidgets.com/downloads/libraries/Phidget21-windevel.zip
unzip Phidget21-windevel.zip

Then, to add the library to the Mono GAC:

sudo gacutil -i phidget21-windevel/Phidget21.NET.dll
sudo ln -s /usr/lib/mono/gac/Phidget21.NET/*/* /usr/lib/mono/2.0/Phidget21.NET.dll

Give access USB Phidget InterfaceKit for a regular user

Last step to be able to use the Phidget InterfaceKit on Raspberry Pi is a problem of permissions on files; only root can access to data of usb pluged devices. So for any program working with Phidget InterfaceKit, you would need to run it as root user (with a sudo). Of course, this is not the right solution.

You have to have the right file permissions on /dev/ to be able to access data of the Phidget InterfaceKit 8/8/8. /dev files are created using udev on Raspberry. So all files are dynamically created when the platform detect an hardware component (when you plug a USB device for example). So you have to create an udev file to specify what king of device you connect and what type of permissions you give to this device.

Create a file in /etc/udev/rules.d with the suffix .rules, e.g. local.rules, and add a line like this to it:

ATTRS{idVendor}=="06c2", ATTRS{idProduct}=="0045", SUBSYSTEMS=="usb", ACTION=="add", MODE="0660", GROUP="usb"

With this line in file, you will detect any InterfaceKit (vendor tag is 06c2 and product id is 0045). You can verify with lsusb than you have these numbers with your InterfaceKit (you will have a result like the following one).

Bus 001 Device 004: ID 06c2:0045 Phidgets Inc. (formerly GLAB) PhidgetInterface Kit 8-8-8

This will now create the right file in /dev with permission of rw for owner (root) and for group usb. The last step is to add your user to the usb group.

sudo addgroup usb
sudo adduser pi usb

After adding group and user to group, you have to logout and login again to have the right permissions. Then you have to restart the udev service.

sudo service udev restart