[PATCH] use udevadm to get device map

Jürg Billeter j at bitron.ch
Tue Sep 9 05:41:36 PDT 2008


On Wed, 2008-08-27 at 21:30 +0200, Danny Kukawka wrote:
> On Mittwoch, 27. August 2008, Dan Nicholson wrote:
> > On Tue, Aug 26, 2008 at 8:18 PM, Lucas Hazel <lucas at die.net.au> wrote:
> > > diff --git a/hald/linux/blockdev.c b/hald/linux/blockdev.c
> > > index 396dd9e..235e9d1 100644
> > > --- a/hald/linux/blockdev.c
> > > +++ b/hald/linux/blockdev.c
> > > @@ -1770,7 +1770,7 @@ udev_get_device_file_for_sysfs_path (const char
> > > *sysfs_path) char *ret;
> > >         char *u_stdout;
> > >         int u_exit_status;
> > > -        const char *argv[] = {"/usr/bin/udevinfo", "--root", "--query",
> > > "name", "--path", NULL, NULL}; +        const char *argv[] =
> > > {"/sbin/udevadm", "--root", "--query", "name", "--path", NULL, NULL};
> >
> > Don't you have to actually have to pass the "info" command to udevadm?
> > So, this would become:
> >
> > const char *argv[] = {"/sbin/udevadm", "info", "--root", "--query",
> > "name", "--path", NULL, NULL};

The following patch inserts the sysfs path at the right position when
calling udevadm info.

diff --git a/hald/linux/blockdev.c b/hald/linux/blockdev.c
index d1c9ee9..b970483 100644
--- a/hald/linux/blockdev.c
+++ b/hald/linux/blockdev.c
@@ -1774,7 +1774,7 @@ udev_get_device_file_for_sysfs_path (const char *sysfs_path)
         GError *g_error;
 
         ret = NULL;
-        argv[5] = sysfs_path;
+        argv[6] = sysfs_path;
 
         g_error = NULL;
 




More information about the hal mailing list