udev, hal, and usb mass storage.
David Zeuthen
david at fubar.dk
Mon Apr 19 04:37:08 PDT 2004
On Mon, Apr 19, 2004 at 12:11:00PM +0100, Anthony Metcalf wrote:
> Hi all,
> Some of you may remember from earlier posts that I'm playing with hal
> and a usb flash device. This is working nicely, I plug the device in,
> udev creates the nodes, hal notices it, it's added to the
> hal-device-manager, and so long as gnome-volume-manager is running it is
Technically hal-device-manager is just a simple application showing the
device objects and their properties exported by HAL.
> automatically mounted as /keyfob. This happens
> because I have the line
>
> /dev/sda1 /keyfob auto defaults, user 0 0
>
> in fstab.
>
> I want to be able to use udev's funkyness and create a link from
> whatever device node (sda1, sdb1 etc) that the device is given to
> /dev/keyfob. So I created the rule and udev now reliably creates
> /dev/sda1 and /dev/keyfob as a link to sda1. This is good.
>
> What is not good is that hal does not know this, it has no knowledge of
> /keyfob, so I cannot have my fstab line above as
>
> /dev/keyfob /keyfob auto defaults, user 0 0
>
> as I would like.
>
> Currently this is not a big thing for me, I only have the one device and
> so it *is* *always* /dev/sda1, but what if I get another? and plug them
> in in a different order? udev will handle this fine, hal wont. What am I
> to do?
>
> Can I alter hal to notice links to device nodes? do I have to change the
> way the rule creates the node so that /dev/keyfob is not a link?
> Will this affect my system badly? Where in the hal source do I start
> looking for this stuff?
>
HAL in CVS now has callouts, see hald/callout.c for details. The short
story is that you can now drop a script like this
http://freedesktop.org/cgi-bin/viewcvs.cgi/hal/hal/tools/callouts/fstab-update.sh?rev=1.4&view=auto
into /etc/hal/device.d and it will manage your fstab - all the device
properties are exported in the env as HAL_PROP_<prop_name_capitalised>,
see the script. Note that this script is highly experimental, use at
your own risk. Nonetheless, this script works very nicely for the USB
storage devices I've got (all four of them).
Btw, if you're running Fedora or something else using kudzu note that
there may, and will, be a race with /usr/sbin/updfstab so you may need
to move this out of the way or otherwise disabled it.
Also, see my other post about having the property block.volume_name
available - with this, a more intelligent fstab update callout might
use this information to create a sane mount point name.
> Any help is very much apreciated, and sorry for the long post, I find it
> better to explain as fully as possible than to have to keep adding stuff
> in response to people trying to help.
>
No problem.
Hope this helps,
David
_______________________________________________
hal mailing list
hal at freedesktop.org
http://freedesktop.org/mailman/listinfo/hal
More information about the Hal
mailing list