From mboxrd@z Thu Jan 1 00:00:00 1970 From: Scott Cuyle Fritzinger Date: Thu, 15 Nov 2001 23:39:58 +0000 Subject: Re: hotplug arch. and apps Message-Id: List-Id: References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org On Thu, 15 Nov 2001, Greg KH wrote: > On Thu, Nov 15, 2001 at 12:38:03PM -0800, Scott Cuyle Fritzinger wrote: > > I've come up with an idea that would make this REALLY easy to do, and it > > is only slightly different than what hotplug currently does. instead of > > just relying on usb.handmap or usb.usermap, why not create a directory > > /etc/hotplug/usb.map/ and place files in there that contain the ID's for > > the supported devices? the hotplug agent can open each file, look for ID's > > and then run the corresponding scripts. > This needs to play nice with the automated > /lib/modules//modules.usbmap files too (these are > automatically built by depmod so the hotplug scripts know what kernel > drivers match what devices. yup! from what i've read, it seems like the modules.usbmap has 'first dibs' on any device, and then the usb.handmap is referenced if nothing matches there. > > like, you can place all the HID device "lines" in /etc/hotplug/usb.map/hid > These should be covered by the modules.usbmap file. ah. ok. without trying to rock the boat too much, is there a reason why it isn't just moved to hotplug instead? :P is it that not everyone uses hotplug? or that the kernel doesn't want to depend on external apps? i'm ignorant as to this issue... > > /etc/hotplug/usb.map/camera for all known (still) camera ID's. This will > > be a VERY generic file, not gphoto specific at all, but rather supportive > > of all apps out there. this file will cause the agent to run the > > /etc/hotplug/usb/camera script, which will then mount (usb mass storage) > > or set permissions on the device. > What would you expect the /etc/hotplug/usb.map/camera file to look like? > Would it have all usb product/vendor ids that gphoto2 works with, or > would there be single file for ever product/vendor pair? it would contain all camera product/vendor ID's that gphoto or any other application supports. basically a repository of USB id's for still cameras. > That is a great idea, and as more USB devices are supported by user > space programs (like gphoto) instead of kernel drivers, this will become > more important. very cool. i think doing things this way would make handling USB devices a little more 'hands-free' because it lets applications (via hotplug scripts) handle the nitty-gritty (permissions, ownership, mounting, etc...) and give the end-user a nicer experience. > > is it possible alter the usb agent to work in this way? the downside would > > be disk hits for each file in /etc/hotplug/usb.map/* (a little slower), > > but the flexibility is that each application can EASILY update the devices > > it supports by just placing a file in there instead of having to search > > through a single file and replace (usb.handmap). > Don't worrry about the speed hit, the flexibility is much more important > (I don't think a user minds that a device takes an extra second or so to > initialize everything when it is plugged in.) > > ideas? thoughts? > I think it's a great idea, and am interested in further implementation > details. here's another thing: still cameras come in 3 main 'flavors' now: - proprietary protocols - Picture Transfer Protocol (PTP) - USB Mass Storage the first 2 can use some simple permission/ownership script action that sets owner=localuser, no problems... we have a script doing this already. the last one we'd like to mount automatically to /camera0 or something when it is plugged in. Now, the USB Mass Storage driver is loaded automatically via modules.usbmap (storage class driver), but is hotplug called after that? if a USB mass storage camera is plugged in, and the kernel loads the appropriate modules, is hotplug called at all? if hotplug isn't called, then there isn't any automounting. is there a way to get hotplug to be called regardless, not to load subsequent drivers, but rather handle permissions/ownership/mounting/etc... like, a Mass storage camera is plugged, the modules are loaded, and then hotplug is called which will in turn call the camera script, which will see that it is a mass storage camera and mount it to /camera0. we could play around with fstab, but that would be a PITA. it'd be nice to have that depend on a hotplug script that is easily updateable and quite dynamic in nature. this may very well break other things that i'm not aware of, so any input on this idea is really needed :P Thanks! -=Scott _______________________________________________ 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