* Auto-handling arbitrary USB mass storage devices
@ 2004-09-22 1:43 Jason LeBrun
2004-09-23 18:04 ` Greg KH
0 siblings, 1 reply; 2+ messages in thread
From: Jason LeBrun @ 2004-09-22 1:43 UTC (permalink / raw)
To: linux-hotplug
I'd like to use udev/hotplug to automate the addition/removal of USB storage
devices. I'm not sure of the best way to go about this, since these tools
certainly provide more than one way to do it!
Basically, I'd like to set things up once, and then have this to happen for
any plugged usb-storage device:
1. When I plug in a device, a device node with a some friendly name, like the
results of SYSFS{vendor} should get created in /dev.
2. Mount points should get automatically created somewhere, like in /mnt
or /media. They should also have a similarly nice name.
3. A line should be added to fstab that corresponds to the new drive.
4. Optionally, the drive should be mounted right away.
It *seems* like hotplug/udev should allow this to be easy, but here are the
problems I'm having in each step:
1. I can't seem to use all of the SYSFS attributes. For example,
SYSFS{product} won't return anything.
Furthermore, the %s format specifier is not working quite properly. For
example, I have an external USB HD with two partitions. If I use
SYMLINK="%s{vendor}%n" in my rules file, I get in my /dev directory the
following:
lrwxrwxrwx 1 root root 4 Sep 21 18:34 1 -> sda1
lrwxrwxrwx 1 root root 4 Sep 21 18:34 2 -> sda2
lrwxrwxrwx 1 root root 4 Sep 21 18:34 WDC -> sda1
If I just use a hard coded version, SYMLINK="WDC%n", it comes up properly:
lrwxrwxrwx 1 root root 4 Sep 21 18:36 WDC1 -> sda1
lrwxrwxrwx 1 root root 4 Sep 21 18:36 WDC2 -> sda2
2+3. I want to create mount points and fstab entries based on either a
"friendly" SYSFS attribute, or the device link created in step 1. It seems to
be that everything beyond step 1 should be done using the hotplug system. I
have no idea how to get the information I need for my hotplug scripts,
however. Is there any way for hotplug to get the info that it needs from
udev?
Also, I can't seem to get the REMOVE actions to do anything in either udev or
hotplug.
Any hints or suggestions for any of the above would be greatly appreciated!
Thanks,
Jason
-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Auto-handling arbitrary USB mass storage devices
2004-09-22 1:43 Auto-handling arbitrary USB mass storage devices Jason LeBrun
@ 2004-09-23 18:04 ` Greg KH
0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2004-09-23 18:04 UTC (permalink / raw)
To: linux-hotplug
On Tue, Sep 21, 2004 at 06:43:23PM -0700, Jason LeBrun wrote:
> I'd like to use udev/hotplug to automate the addition/removal of USB storage
> devices. I'm not sure of the best way to go about this, since these tools
> certainly provide more than one way to do it!
>
> Basically, I'd like to set things up once, and then have this to happen for
> any plugged usb-storage device:
>
> 1. When I plug in a device, a device node with a some friendly name, like the
> results of SYSFS{vendor} should get created in /dev.
udev can do this for you.
> 2. Mount points should get automatically created somewhere, like in /mnt
> or /media. They should also have a similarly nice name.
>
> 3. A line should be added to fstab that corresponds to the new drive.
>
> 4. Optionally, the drive should be mounted right away.
HAL does these steps for you. Not udev.
> It *seems* like hotplug/udev should allow this to be easy, but here are the
> problems I'm having in each step:
>
> 1. I can't seem to use all of the SYSFS attributes. For example,
> SYSFS{product} won't return anything.
What is the full rule you are trying to match on?
> Furthermore, the %s format specifier is not working quite properly. For
> example, I have an external USB HD with two partitions. If I use
> SYMLINK="%s{vendor}%n" in my rules file, I get in my /dev directory the
> following:
> lrwxrwxrwx 1 root root 4 Sep 21 18:34 1 -> sda1
> lrwxrwxrwx 1 root root 4 Sep 21 18:34 2 -> sda2
> lrwxrwxrwx 1 root root 4 Sep 21 18:34 WDC -> sda1
Please realize that depending on the level in sysfs where your rule
matches, there might not be a vendor file there. That's what is
probably happening here.
thanks,
greg k-h
-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-09-23 18:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-22 1:43 Auto-handling arbitrary USB mass storage devices Jason LeBrun
2004-09-23 18:04 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).