UDEV : Phidget and TTY

Posted: 2010/10/16 in Software

Those of you that are seasoned Linux folks will probably get a good chuckle from this. 😉

The Phidget controllers and TTY that I plan to use to interface the BS2, were forcing me to run things as root on my Beagleboard.  This is not a huge problem, but it does force my application to also run as root.  This means that I cannot run debuggers and the likes as a regular user.  So I finally decided to dig-in and go though numerous forums and web pages to figure out an appropriate solution.

Lots of people talk about using hotplug, set-uid, etc… to handle such situations.   I’m using a 2.6 Linux kernel, hotplug was replaced by UDEV.  Essentially UDEV manages all pluggable devices on a Linux computer and one can change the standard set of rules for specific devices to make things run differently.

Through a fair amount of research and trial and error, I found a combination of rules that work well so far.  I have created two new rule files, their names are not significant by themselves unless there is a need to have rules override others (read alphabetical order).

New TTY rule: KERNEL==”ttyS[0-9]”, GROUP=”dialout”, MODE=”0777″ + add the user-ids using the TTY to the “dialout” group.

New Phidget rule: SUBSYSTEMS==”usb”, ACTION=”add”, ATTRS{idVendor}==”06c2″, ATTRS{idProduct}==”00[3-a][0-f]” mode=”666″

Restart your Beableboard, and now these devices can be accessed by any user in the “dialout” group.  These changes are as permanent as the rule files.

Now I can run my application along in the debugger right from Netbeans… awesome ! … I found an uninitialized function pointer real quick with this …


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s