OpenWrt Forum Archive

Topic: devices showing up with always same name / need help with udev

The content of this topic has been archived on 2 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi,

to be able to make my current project running to full extend i need my serial/USB devices always showing up with the same name under /dev.

So far i made a workaround by creating additional symlinks to the existing devices via a startup script. But since i added a USB-GPS that is messed up since the USB devices are mapped in a different order. The GPS is not permanently connected and there the problem starts.

I have Backfire 10.03.1-rc4 bcrm47xx running on the WL500gp. i just added the udev and udevtrigger packages and made the following rules in
/etc/udev/rules.d/10-local.rules:

ACTION=="add", KERNEL=="ttyS0", SUBSYSTEM=="tty", SYMLINK+="COM1_test"
ACTION=="add", KERNEL=="ttyS1", SUBSYSTEM=="tty", SYMLINK+="OTportA_test"
ACTION=="add", KERNELS=="1-2.1:1.0", SUBSYSTEMS=="usb", DRIVERS=="pl2303", ATTRS{modalias}=="usb:v067Bp2303d0202dc00dsc00dp00icFFisc00ip00", SYMLINK+="Display_test"
ACTION=="add", KERNELS=="1-2.2:1.0", SUBSYSTEMS=="usb", DRIVERS=="pl2303", ATTRS{modalias}=="usb:v067Bp2303d0300dc00dsc00dp00icFFisc00ip00", SYMLINK+="OTportB_test"

But nothing happens... ;-(

Is there anything else that need to be configured than writing the rules after udev package is installed?
I have already browsed some webpages explaining udev and found something here in the forum. But nothing that really helped me..


Gerald

(Last edited by dk7xe on 23 May 2011, 16:43)

... i got it running

after i detected that the udev daemon is not started @ boot. I created the following startup script as /etc/init.d/udev and enabled it

#!/bin/sh /etc/rc.common
#Init script for udevd

START=30

start() {
    #----------- START the UDEV daemon --------------
    /sbin/udevd --daemon &
    }

stop() {
    killall udevd
}

and

execute a udevadm trigger after that.
For this i changed my existing startup script for the tmpdevices /etc/init.d/tmpdev to

#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org

START=72

start() {
    # trigger udev
    /sbin/udevadm trigger &
}

i think that's needed cause on a timing issue at booting.
udev is started as 30 and usb as 37 in rc.d.
But when looking at the log i see that the usb devices are mapped before the udev daemon is running.

Any ideas for a better solution are welcome ;-)
Gerald

What about just calling the existing script with "enable" ?

jow wrote:

What about just calling the existing script with "enable" ?

..that was the first thing i was looking for.
But the udev package for 10.03.1_rc4 do not contain a start up script for udev.

result of opkg files udev

Package udev (142-1) is installed on root and has the following files:
/lib/udev/rules.d/60-persistent-input.rules
/sbin/udevadm
/lib/udev/scsi_id
/lib/udev/cdrom_id
/lib/udev/rules.d/60-persistent-storage.rules
/lib/udev/rules.d/50-udev-default.rules
/lib/udev/rules.d/75-persistent-net-generator.rules
/lib/udev/rules.d/60-cdrom_id.rules
/lib/udev/path_id
/lib/libudev.so.0.3.0
/lib/udev/rules.d/75-cd-aliases-generator.rules
/sbin/udevd
/lib/udev/rules.d/79-fstab_import.rules
/lib/udev/ata_id
/lib/udev/rules.d/60-persistent-serial.rules
/lib/udev/usb_id
/lib/udev/write_cd_rules
/etc/udev/udev.conf
/lib/libudev.so.0
/lib/udev/rules.d/95-udev-late.rules
/lib/udev/fstab_import
/lib/udev/rule_generator.functions
/lib/udev/rules.d/80-drivers.rules
/lib/udev/write_net_rules

Gerald

Afair udev is launched by preinit if it is installed. Just make sure that hotplug2 does *not* exist on your system otherwise they'll conflict.

jow wrote:

Afair udev is launched by preinit if it is installed. Just make sure that hotplug2 does *not* exist on your system otherwise they'll conflict.

..man(n) lernt immer wieder dazu.. ;-)

Thanx for pointing that out. indeed i have hotplug2 still installed. are there any other things i need to take care of when removing hotplug and let udev do the job?
I consider it still as strange that udev daemon was not started by preinit and that i had to put my own startup script there.. maybe that's related to my lacking knowledge.

When i look at /etc/init.d/boot i find

    killall -q hotplug2
    [ -x /sbin/hotplug2 ] && /sbin/hotplug2 --override --persistent \
            --set-worker /lib/hotplug2/worker_fork.so \
            --set-rules-file /etc/hotplug2.rules \
            --max-children 1 >/dev/null 2>&1 &

    # the coldplugging of network interfaces needs to happen later, so we do it manually here
    for iface in $(awk -F: '/:/ {print $1}' /proc/net/dev); do
        /usr/bin/env -i ACTION=add INTERFACE="$iface" /sbin/hotplug-call net
    done

I think something need to be done to make that working with udev!? the first part starting hotplug2 i would replace by starting udevd --daemon.
But i'm not sure what to do with the coldplugging of network interfaces.

Would be nice if you can provide some further details on that.

Thank you for your support!
Gerald

(Last edited by dk7xe on 27 May 2011, 08:04)

The discussion might have continued from here.