From mboxrd@z Thu Jan 1 00:00:00 1970 From: Greg KH Date: Thu, 23 Sep 2004 18:04:25 +0000 Subject: Re: Auto-handling arbitrary USB mass storage devices Message-Id: <20040923180425.GB9028@kroah.com> List-Id: References: <200409211843.23943.jason@jasonlebrun.info> In-Reply-To: <200409211843.23943.jason@jasonlebrun.info> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org 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