On Fri, Nov 30, 2012 at 3:09 AM, Walter Dnes <[email protected]> wrote:
> On Fri, Nov 30, 2012 at 12:28:01AM +0000, Jorge Almeida wrote
>
>> When a pen is inserted, this is what is set:
>>
>> DEVNAME=sdd
>
> This is almost exactly what I remember from when I was
> writing/testing/debugging my automount scripts. The one difference I
> remember is that when mdev handled it, there was no "DEVNAME" variable,
> but rather it was "MDEV". But otherwise identical. Two important notes...
Strange. The variable name is set by the kernel. Maybe you were using a
patched kernel?
>
> 1) For a USB mass storage device (pen or external hard drive) with N
> partitions, the hotplug handler will get N+1 events when inserting and
> also when removing. E.g. if your pen drive has 3 partitions, you'll get
> 4 events...
Right. The helper program is launched 4 times and will create (or remove,
depending on $ACTION) 4 symlinks.
>
> Would you be OK if the devices were always mounted in /media ? The
> reason I ask is that my scripts use pmount, which can take an optional
> label argument. E.g. if MDEV is "sdd1"
>
pmount looks a good idea for a many-users workstation. For a 1-user computer,
there's no loss of functionality with sticking with fstab.
>
> Actually, if I was writing it, I would add a few lines to my script
> for the "add" ACTION
Sure, I just didn't mention it.
> * label=${MDEV}
> * look for a "serial" file in the PCI path of the newly-inserted device
> * if found; then
> grep through a textfile to match the contents of the "serial" file
I thought of keeping data-- (key,value) = (serial_number,
custom_name_of_device)-- in a cdb database. I think it is faster than reading
a text file, and no parsing needed. It is also scalable (although this is
probably irrelevant on a custom-workstation scale...). My (untested) program is
about 11k, statically compiled.
By the way, I don't suppose there is a mailing list to talk about these
matters (mdev/ udev-alternative/ udev-fork related)? This is really
distro-agnostic stuff...
Thanks
Jorge Almeida