Re: Automatic USB drive detection/Disconnection in user application!!!

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Nalajala Murali <nalajala.murali@...>
Cc: <kernelnewbies@...>
Date: Tuesday, September 23, 2008 - 5:09 am

El Fri, Sep 19, 2008 at 07:24:40PM +0530 Nalajala Murali ha dit:


maybe instead of figuring out where your device is mapped you could
use udev rules to enforce a mapping. udev rules are usually defined
in /etc/udev/rules.d/, the format is described in
http://www.reactivated.net/writing_udev_rules.html

for example i use the following rules to map a usb stick on the first
usb controller of an embedded device to /dev/usbhda:

KERNEL=="sd?", SUBSYSTEM=="block", KERNELS=="1-1:1.0",
SUBSYSTEMS=="usb", SYMLINK="usbhda"

KERNEL=="sd*[0-9]", SUBSYSTEM=="block", KERNELS=="1-1:1.0",
ACTION=="add", SYMLINK="usbhda%n"

the application could use inotify(7) to watch /dev and be informed
when the device node is added or removed

-- 
Matthias Kaehlcke
Embedded Linux Engineer
Barcelona

                If you don't know where you are going,
               you will probably end up somewhere else
                         (Laurence J. Peter)
                                                                 .''`.
    using free software / Debian GNU/Linux | http://debian.org  : :'  :
                                                                `. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4                  `-

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@nl.linux.org
Please read the FAQ at http://kernelnewbies.org/FAQ
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: Automatic USB drive detection/Disconnection in user appl..., Matthias Kaehlcke, (Tue Sep 23, 5:09 am)
RE: Automatic USB drive detection/Disconnection in user appl..., Vivek Kumar Gupta, (Tue Sep 23, 4:46 am)