how to start a process from linux(debian) OS on detection of a usb device?

2

I'm using a FTDI 2232H chip in synchronous FIFO mode to communicate over USB to an altera Cyclone II FPGA. I've developed a program that will communicate with the device, using libftdi and libusb, running from a TI AM3517 arm processor with Debian installed.

I'm not to sure how to have configure the debian OS to start the my communication process on detection(ie. hotplug) of the FTDI 2232H usb device.

richmb

Posted 2011-05-06T13:13:48.330

Reputation: 143

in case anyone was wondering heres the udev rule I used to implement this. I created /etc/udev/rules.d/99-FTDI2232H-usb.rules

I here i'm running my program /opt/prog and passing in the serial manufacture and product information as arguments

ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0403", ATTR{idProduct}=="6010", RUN+="/opt/prog %s{serial} %s{manufacturer} %s{product}", ${serial}, $ATTR{manufacturer}, $ATTRS{product} – richmb – 2011-06-14T20:24:37.510

Answers

0

You can use halevt (or its predecessor ivman on earlier kernels) to detect and execute actions on hotplug events.

sudocode

Posted 2011-05-06T13:13:48.330

Reputation: 113

Thank you for the quick response. I've been doing to further research and just learned about udev. It seems that both halevt and udev would be able to accomplish this task. Any incite on to which one would be more suitable? – None – 2011-05-06T14:24:36.163

halevt works for me (detect when audio CD is inserted on a headless media server) but udev appears to be the way forward as HAL is deprecated. You've reached the end of my knowledge on this ;) – None – 2011-05-06T14:39:50.603