Do we need hotplug?

Andrew Benton b3nt at ukonline.co.uk
Sun Aug 21 07:37:00 PDT 2005


Alexander E. Patrakov wrote:
> Coldplugging is a bit more problematic. hotplug-light does load modules, 
> but does not recreate USB hotplug events correctly. This breaks 
> chmodding pseudofiles in /proc/bus/usb/xxx/yyy when USB host controller 
> is compiled as a non-module, and thus it will make my scanner 
> inaccessible for non-root when BLFS finally moves from the obsolete 
> "usb" group hack to the proper hotplug handlers.
> 

I've just been working round a similar issue with an Iriver mp3 player. It uses an altered form of fat 32. There is a kernel patch to allow it to be mounted but the ifp aplication I used to use to access the device relied on hotplug to change the permissions onit so non-root uses could access it. Without hotplug, I can only put songs on the device as root. The solution was to create a udev rule (all one line, sorry if it wraps)

ACTION="add", BUS="usb", SYSFS{manufacturer}="iRiver Limited.", PROGRAM="/usr/sbin/ifp-nonroot.sh"

That runs a simple script /usr/sbin/ifp-nonroot.sh that looks like this 

#!/bin/bash
chgrp audio $DEVICE
chmod g+rw $DEVICE

Of course the script can do almost anything so this is very powerfull, flexible and extensible. 

man udev is quite informative and so is the docs/writing_udev_rules/index.html file in the udev kernel source. That should really get installed in /usr/share/doc. Perhaps something like

install -m 755 -d /usr/share/doc/udev_rules &&
install -m 644 docs/writing_udev_rules/index.html /usr/share/doc/udev_rules


> 
> Back to the original question: Hotplug is not needed for a minimal 
> system. Its use in LFS is limited to hardware detection facilities 
> (compare /etc/sysconfig/modules in LFS-6.1 with LFS-6.0), and BLFS 
> doesn't use hotplug yet. But it is useful.
> 

To me, I don't see the need for hotplug to be in LFS, I don't think it should be in BLFS either. If someone needs it they should write a hint. Maybe I'm being a bit extreme, but...



More information about the lfs-dev mailing list