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

> I need a solution for the below problem.
> 
> When the USB got detected by the kernel ( Linux ) i am not able to
> figure it out to where it is mapped on my dev file system. Please let
> me know how will i come to know to where my USB is mapped using the C
> routine!!! Is there any provision to call some kernel related
> functions so that i cae to know where it mapped? Also how do i know (
> application ) the USB disconnection?
> 
> Also i heard few solutions for the above problem like, "Query HAL over
> Dbus" and reading information from "libsysfs" library.Though first one
> is pretty good i don't know how to use Dbus in my application ( it bit
> confused me ).If any one propose any better solutions that would be
> very helpful.

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 [EMAIL PROTECTED]
Please read the FAQ at http://kernelnewbies.org/FAQ

Reply via email to