Where/when is /dev populated?

I have an openwrt dist with kernel 2.6.21 and busybox 1.4.2. I don't get the permissions I want on some device nodes in /dev. Although I can change those in an rc script, it would be nice to get the permissions right from the start.

However, I cannot figure out where the device nodes are created... How can I find that out?

Reply to
John
Loading thread data ...

Le 10/04/08 16:51, dans , « John » a écrit :

A driver can use devfs_mk_cdev() function to create the dev entry and set initial mode permissions.

--
Éric Lévénez -- 
Unix is not only an OS, it's a way of life.
Reply to
Eric Levenez

I'm only figuring this out myself, but I do know, the configurable part of it, in 2.6 kernels, is run by udev, and configured by rule files in /etc/udev/rules.d/*.rules

Good luck, Mel.

Reply to
Mel

Its very simple. For tty the udev rule could look like this:

KERNEL=="tty", MODE="0666", GROUP="users"

Do you need special things for the serial devices? Add:

KERNEL=="ttyS0*", MODE="0640", GROUP="special" KERNEL=="ttyS[1-9]*", MODE="0666", GROUP="users"

(first match wins. So ttyS0 gets other settings than all other ttyS devices)

And it works for all kind of devices.

JB

Reply to
Juergen Beisert

In further news, we're trying to nail a particular device down to a particular USB socket. For whatever reason, udev was coming up with different KERNEL names on different boots. After a productive day yesterday, we have a rule like

SUBSYSTEM=="usb", KERNELS=="2-1:1.0", DRIVERS=="ftdi_sio", NAME="ourown/tty"

The application opens a connection to /dev/ourown/tty , and gets the device consistently.

We had been dealing with the permissions thing by putting our user into the dialout group which is automatically assigned. It's inflexible, but it works as long as we don't need actual ttys on the system. Good to know about GROUP= .

Also the commands udevinfo, which provides the magic names and values to use in rules, and udevtest which lets you test rule files without booting.

Mel.

Reply to
Mel

Why not using this?

KERNEL=="ttyUSB[0-9]*", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", SYMLINK+="ourown/tty"

$ ls -la /dev/ourown/tty lrwxrwxrwx 1 root root 10 Apr 11 14:00 /dev/ourown/tty ->

../ttyUSB0

$ ls -la /dev/ttyUSB0 crw-rw---- 1 root root 188, 0 Apr 11 14:00 /dev/ttyUSB0

Its my FTDI245 based device.

JB

Reply to
Juergen Beisert

I don't have /etc/udev... However, I found out that the permissions can be specified in /etc/hotplug2-init.rules. Moreover, something happens in /sbin/mount_root (a file with OpenWrt copyright): It is concluded I have no devfs entry in /proc/filesystems, a tmpfs filesystem is mounted and the hotplug2 daemon is started.

Don't know it that will ever help anyone :)

Reply to
John

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.