Any objections to using the library python-gudev? In theory that should give us access to udev without having to invoke udevadm as an executable. That would make the whole udevadm on path issue go away (and make for a better solution all round).
If you like, I could try and learn how to use the library and send in a patch for that. Karl On Mon, 2010-12-20 at 17:11 +0300, Andrey Yurkevich wrote: > Actually, the path to the scripts dir (/lib/udev in your case) is provided by > udev.pc pkg-config file. So if you consider installing any script(s) to > /lib/udev, you'd better avoid hardcoding that directory and use pkgconfig: > > $ pkg-config --variable udevdir udev > /lib/udev > > Unfortunately, there is no path to udevadm provided as a variable in udev.pc > which, I suppose, could be filed as an enhancement request to udev bugtracker. > > cheers, > Andrey > > On 20 Dec 2010, at 4:33PM, Karl Relton wrote: > > > On my Ubuntu system, all the scripts in /lib/udev that need to run > > things from /sbin either use full path at each invocation, or at the top > > prepend /sbin to $PATH. > > > > So to be consistent with them we could make /lib/udev/synce-udev-serial > > do the prepend /sbin to $PATH, and > > then /usr/share/synce-connector/udev-synce-serial could just call > > udevadm. > > > > Karl > > > > > > On Fri, 2010-12-17 at 17:00 +0100, David Eriksson wrote: > >> Thanks! Maybe those changes should be build options or configuration > >> options? For example, udevadm might not be in PATH... > >> > >> > >> Best regards, > >> > >> David Eriksson > >> > >> > >> On Thu, Dec 16, 2010 at 18:43, Karl Relton > >> <karllinuxtest.rel...@ntlworld.com> wrote: > >>> I tried the new udev based connector on Ubuntu (Maverick) from the > >>> development ppa. > >>> > >>> To get it to work I had to apply the following patch: > >>> > >>> > >>> --- udev-synce-serial 2010-12-16 17:38:20.517195997 +0000 > >>> +++ udev-synce-serial.orig 2010-11-15 20:23:51.628813001 +0000 > >>> @@ -39,7 +39,7 @@ > >>> # there are no python bindings for udev, so this is a little > >>> awkward > >>> > >>> # get device name > >>> - cmd_list = ["/sbin/udevadm", "info", "--path="+device_path, > >>> "--query=name"] > >>> + cmd_list = ["udevadm", "info", "--path="+devpath, "--query=name"] > >>> try: > >>> proc = subprocess.Popen(cmd_list, stdout=subprocess.PIPE, > >>> stderr=subprocess.STDOUT) > >>> output_text = proc.communicate()[0] > >>> @@ -55,7 +55,7 @@ > >>> devname = output_text.strip() > >>> > >>> # get parent device path > >>> - match_obj = re.match('^(.+)/'+devname+'/tty/'+devname, > >>> device_path) > >>> + match_obj = re.match('^(.+)/'+name+"/"+subsystem+'/'+name, > >>> devpath) > >>> if match_obj == None: > >>> logger.error("failed to get parent device path from udev") > >>> sys.exit(1) > >>> @@ -63,7 +63,7 @@ > >>> parent_devpath = match_obj.group(1) > >>> > >>> # find all relevant child devices of the parent > >>> - cmd_list = ["/sbin/udevadm", "info", "--export-db"] > >>> + cmd_list = ["udevadm", "info", "--export-db"] > >>> try: > >>> proc = subprocess.Popen(cmd_list, stdout=subprocess.PIPE, > >>> stderr=subprocess.STDOUT) > >>> output_text = proc.communicate()[0] > >>> @@ -77,7 +77,7 @@ > >>> sys.exit(1) > >>> > >>> output_list = output_text.split('\n') > >>> - devpath_re = re.compile('^P: ('+parent_devpath+'.+/tty/.+)') > >>> + devpath_re = re.compile('^P: > >>> ('+parent_devpath+'.+/'+subsystem+'/.+)') > >>> > >>> devpath_list = [] > >>> for line in output_list: > >>> > >>> > >>> > >>> ------------------------------------------------------------------------------ > >>> Lotusphere 2011 > >>> Register now for Lotusphere 2011 and learn how > >>> to connect the dots, take your collaborative environment > >>> to the next level, and enter the era of Social Business. > >>> http://p.sf.net/sfu/lotusphere-d2d > >>> _______________________________________________ > >>> SynCE-Devel mailing list > >>> SynCE-Devel@lists.sourceforge.net > >>> https://lists.sourceforge.net/lists/listinfo/synce-devel > >>> > >> > > > > > > > > > > ------------------------------------------------------------------------------ > > Lotusphere 2011 > > Register now for Lotusphere 2011 and learn how > > to connect the dots, take your collaborative environment > > to the next level, and enter the era of Social Business. > > http://p.sf.net/sfu/lotusphere-d2d > > _______________________________________________ > > SynCE-Devel mailing list > > SynCE-Devel@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/synce-devel > > > > ------------------------------------------------------------------------------ Lotusphere 2011 Register now for Lotusphere 2011 and learn how to connect the dots, take your collaborative environment to the next level, and enter the era of Social Business. http://p.sf.net/sfu/lotusphere-d2d _______________________________________________ SynCE-Devel mailing list SynCE-Devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/synce-devel