Re: cold-plugged usb flash drive not handled correctly in embedded system

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Fri, Aug 20, 2010 at 04:51:44PM +0200, Kay Sievers wrote:
> On Fri, Aug 20, 2010 at 16:42, Wolfgang Wegner <ww-ml@xxxxxx> wrote:
> > /etc/udev/rules.d/50-udev.rules:
> > ACTION=="add", KERNEL=="sd[a-z][0-9]", RUN+="/bin/mount -t auto -o rw,noauto,flush,quiet,nodev,nosuid,exec,noatime,dmask=000,fmask=111 /dev/%k /mnt/usbdisk", OPTIONS="last_rule"
> 
> udev 161 has no "last_rule" thing anymore.

ok, but I guess this does not change anything, especially in the
case when I use this as the only rule. ;-)

> You mount all devices, the possibly built-in ,and the plugged-in
> devices at the same place? :)

Yes, currently I do, because only one USB device is "supported".

> > It does not matter if I leave the standard rules in
> > /libexec/rules.d/ or if I remove them altogether, in either
> > case the USB flash drive is correctly mounted when plugged
> > into the running system but not when it is already present when
> > the system boots up.
> 
> The event for the device happens during early boot where you have no
> chance to mount. Do you run 'udevadm trigger' at bootup? It will
> re-generate all events so that they can be handled when userspace is
> running. It would need --action=add for your current rule to match.

The busybox start script (/etc/init.d/rcS) runs my udev start script
(/etc/init.d/start_udev.sh) which in turn runs udevadm trigger as
one of the last steps:

[...]
udevd --daemon --debug

mkdir -p /dev/.udev/queue/ /dev/.udev/rules.d/
create_dev_root_rule /dev/.udev/

udevadm trigger

create_dev_makedev

udevadm settle

exit 0

Again, I have to admit I do not really understand what
create_dev_makedev is for (copied from debian), but I am quite
sure it can do no harm...

>From my understanding, this should generate all the events -
and I see the event is there, because of this:
18.530148 [586] udev_device_new_from_syspath: device 0x40770 has devpath '/devices/platform/orion-ehci.0/usb1/1-1/1-1:1.0/host2/target2:0:0/2:0:0:0/block/sda/sda1'
18.530268 [586] udev_rules_apply_to_event: LINK 'block/8:1' //libexec/rules.d/50-udev-default.rules:3
18.530343 [586] udev_rules_apply_to_event: GROUP 0 //libexec/rules.d/50-udev-default.rules:72
18.530490 [586] udev_device_new_from_syspath: device 0x3eb40 has devpath '/devices/platform/orion-ehci.0/usb1/1-1/1-1:1.0/host2/target2:0:0/2:0:0:0/block/sda'
18.530894 [586] udev_device_read_db: device 0x3eb40 filled with db file data

All I am missing is the "RUN" line here.

BTW, amazing response time! :-)

Regards,
Wolfgang

--
To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel]     [Linux DVB]     [Asterisk Internet PBX]     [DCCP]     [Netdev]     [X.org]     [Util Linux NG]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux