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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Le Fri, 19 Sep 2008 19:24:40 +0530,
"Nalajala Murali" <nalajala.murali@xxxxxxxxx> a écrit :

> 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.

Use the D-Bus binding of your programming language, then see
http://dbus.freedesktop.org/doc/dbus-tutorial.html to get the basics of
D-Bus programming, which are not very complicated.

HAL tells over D-Bus when a device has been attached to the system, to
which /dev/, etc. Your application then simply has to register for
these events over D-Bus.

See
http://friky.svn.sourceforge.net/viewvc/friky/friky2/trunk/friky2/usbkey.py?revision=138&view=markup
for a Python version of this.

If your system already uses D-Bus and HAL, then clearly, this is the
best solution. If your system only relies on udev or mdev, then the
solution proposed by Matthias Kaehlcke (custom udev rules) is good.

Sincerly,

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers and embedded Linux development,
consulting, training and support.
http://free-electrons.com

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux