From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrey Borzenkov Date: Sat, 12 May 2007 03:33:02 +0000 Subject: Re: Question regarding hotplug/udev + USB key Message-Id: <200705120733.07559.arvidjaar@mail.ru> MIME-Version: 1 Content-Type: multipart/mixed; boundary="===============0922786478==" List-Id: References: In-Reply-To: To: linux-hotplug@vger.kernel.org --===============0922786478== Content-Type: multipart/signed; boundary="nextPart2330472.TQZXExa0eY"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit --nextPart2330472.TQZXExa0eY Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Friday 11 May 2007, Greg wrote: > On May 11, 2007, at 3:34 AM, Greg KH wrote: > > Great questions, care to ask this on the linux-hotplug-devel mailing > > list and CC me? That way I can answer it in public to enable everyone > > else to know the answer, and let the search engines pick it up. > > Sure thing! Here's my question again: > > I'm currently working on a project (a program written in C++) and I > need to be notified whenever a USB key is attached to the computer > and what the absolute path of that key is so that I can automatically > see what's inside of it. > > What is the easiest and proper (modern) way of doing this? Should I > create a script in /etc/hotplug.d/usb or should I add a rule to the / > etc/udev/rules.d folder?=20 yet another possibility is to use HAL notifications over D-Bus (listen for= =20 DeviceAdded and then check for speific porperties). This way you may even=20 expect more portability as udev is Linux specific and HAL is available on=20 Solaris and BSD (although I do not know how complete implementation is). HA= L=20 specification is on=20 http://people.freedesktop.org/~david/hal-spec/hal-spec.html; freedesktop.or= g=20 also hosts D-Bus; specifically=20 http://www.freedesktop.org/wiki/Software/dbus-cpp seems to provide C++=20 binding to D-Bus (but you of course can use C bindings which are more=20 mature). HTH =2Dandrey > Please be aware that I'm really kind of=20 > shooting in the dark here and don't really have a strong grasp on any > of this so if you happen to know of a good link that might point me > in the right direction to solving my problem I would appreciate that > greatly as well (currently I'm going off of what are likely outdated > online documents). > > The computer that this program will run on has a linux 2.6 kernel. > > Kind regards, > > - Greg Slepak > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > 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 --nextPart2330472.TQZXExa0eY Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (GNU/Linux) iD8DBQBGRTVuR6LMutpd94wRAruFAJ9/Y1GGBaMcTGICVw/rqMVMCRuXfgCgrl7D jEmQIILPxOV+vTNkIWyo06I= =9m5W -----END PGP SIGNATURE----- --nextPart2330472.TQZXExa0eY-- --===============0922786478== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ --===============0922786478== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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 --===============0922786478==--