Way to run openocd with ARM-USB-OCD as regular user ?

I am running openocd on a Fedora Core 6 Linux box.

Everything works fine except I seem to have to run as root to make it work. Is there a way to setup my box so I don’t have to run as root ?

To use USB serial ports, I run chown /dev/ttyUSB0 and then I can use them as a regular user.

Is there something similar for this device ?

Thanks

Hi,

see this recent thread http://www.sparkfun.com/cgi-bin/phpbb/v … php?t=5676 for a discussion on how this can be achieved. I don’t know if this is going to work as is for Fedora, but you should be able to see how it’s done.

Regards,

Dominic

Thanks for the tip, Dominic. I almost have it working.

I found this page helpful.

http://www.reactivated.net/writing_udev … erminology

The thread you sent me to had the rules file named “45-ft2232.rules”. Just a heads up that that file name might not work depending what is in the later scanned files, ie those starting with a number greater than 45. In my case the general rules file for my system started with 50 and it reassigned the permissions for USB devices.

So, I renamed my file to be 55-myusb.rules and it goes as follows:

#OLIMEX Debugger

SYSFS{idProduct}==“0003”, SYSFS{idVendor}==“15ba”, MODE=“777”, OWNER=“me”, GROUP=“users”

#PL2303 USB SERIAL DEVICES

SYSFS{idProduct}==“2303”, SYSFS{idVendor}==“067b”, MODE=“664”, OWNER=“me”, GROUP=“users”

It seems to have worked, because a) the permissions work for ttyUSB* devices now, which is a great thing in itself and b) I have this in /dev/

crwxrwxrwx 1 me users 442, 2054 Jan 18 11:52 /dev/usbdev2.7_ep00

crwxrwxrwx 1 me users 442, 2054 Jan 18 11:52 /dev/usbdev2.7_ep02

crwxrwxrwx 1 me users 442, 2054 Jan 18 11:52 /dev/usbdev2.7_ep04

crwxrwxrwx 1 me users 442, 2054 Jan 18 11:52 /dev/usbdev2.7_ep81

crwxrwxrwx 1 me users 442, 2054 Jan 18 11:52 /dev/usbdev2.7_ep83

And yet, I get this when I try to run openocd:

$ openocd -d3

Info: openocd.c:84 main(): Open On-Chip Debugger (2006-11-22 14:00 CEST)

Debug: jtag.c:1217 jtag_init():

Debug: ft2232.c:1244 ft2232_init(): ‘ft2232’ interface using FTD2XX with ‘olimex-jtag’ layout

Error: ft2232.c:1286 ft2232_init(): unable to open ftdi device: 2

If I run as root, it works fine. Is there something else I need to set other than the USB port permissions ?

/usr/lib

ls -l libftd*

lrwxrwxrwx 1 root root 34 Jan 16 15:08 libftd2xx.so.0 → /usr/local/lib/libftd2x

/usr/local/lib

ls -l libftd*

lrwxrwxrwx 1 root root 19 Jan 16 14:52 libftd2xx.so → libftd2xx.so.0.4.13

-rwxr-xr-x 1 root root 319466 Jan 16 14:52 libftd2xx.so.0.4.13

What am I missing ?

armdeveloper:
It seems to have worked, because a) the permissions work for ttyUSB* devices now, which is a great thing in itself and b) I have this in /dev/

crwxrwxrwx 1 me users 442, 2054 Jan 18 11:52 /dev/usbdev2.7_ep00

crwxrwxrwx 1 me users 442, 2054 Jan 18 11:52 /dev/usbdev2.7_ep02

crwxrwxrwx 1 me users 442, 2054 Jan 18 11:52 /dev/usbdev2.7_ep04

crwxrwxrwx 1 me users 442, 2054 Jan 18 11:52 /dev/usbdev2.7_ep81

crwxrwxrwx 1 me users 442, 2054 Jan 18 11:52 /dev/usbdev2.7_ep83

And yet, I get this when I try to run openocd:

$ openocd -d3

Info: openocd.c:84 main(): Open On-Chip Debugger (2006-11-22 14:00 CEST)

Debug: jtag.c:1217 jtag_init():

Debug: ft2232.c:1244 ft2232_init(): ‘ft2232’ interface using FTD2XX with ‘olimex-jtag’ layout

Error: ft2232.c:1286 ft2232_init(): unable to open ftdi device: 2

If I run as root, it works fine. Is there something else I need to set other than the USB port permissions ?

As I wrote in the thread Dominic pointed you to, libftd2xx operates on /proc/bus/usb/...

Please note, this is proc, not dev. Unfortunately, I don’t know how to change owner/permissions on /proc/bus/usb/xxx via udev :-(. So I keep chown/chmod it by hand :frowning:

Please check owner/permissions on the corresponding files in the /proc hierarchy.

Darn… I missed reading about the permissions on /proc/bus/usb !

I checked the permissions on /dev/bus/usb and they are fine. But the /proc/bus/usb permissions were still root !

I did a chown on them and now I can run openocd as a regular user.

I’ll figure out how to change the proc permissions in udev and post it here later on.

Hi

This can be done with the mount options for /proc/bus/usb

The relevant lines in /etc/fstab are:

none /proc proc defaults 0 0

none /proc/bus/usb usbfs defaults,devmode=0666 0 0

Some distributions does not mount /proc/dev/usb from /etc/ fstab but from other startupfiles,

so on fc5 I had to add the following to /etc/rc.local

Remount /proc/bus/usb to make fstab options (devmode=0666) active

mount -o remount /proc/bus/usb

Of course all /proc/bus/usb ebtries are now rw which is not a problem on a single user machine.

Regards,

Magnus

I was working on the approach outlined here:

http://www.owfs.org/index.php?page=udev

I wonder if there is a way to do it directly from a udev rules file, without the script like they did it ? I don’t like the idea of modding rc.local, but maybe that is just me.

I would say that chages to udev rules that run permission granting script are more error prone and potentially more dangerous than a remonut in rc.local

I cannot say that I ever really understod the udev rules, to much magic for me.

Magnus

I guess you have a point.