All of lore.kernel.org
 help / color / mirror / Atom feed
* My udev rule doesn't work
@ 2007-04-07 13:44 Michael Buesch
  2007-04-08 19:37 ` Kay Sievers
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Michael Buesch @ 2007-04-07 13:44 UTC (permalink / raw)
  To: linux-hotplug

Hi,

I have the following rule:

mb@powermac:/etc/udev/rules.d$ cat 01-deathadder.rules 
# Configure the Razer DeathAdder mouse
ACTION="add", SUBSYSTEM="usb_device", SYSFS{idVendor}="1532", SYSFS{idProduct}="0007", RUN+="deathaddercfg -C"

It's for autoconfiguration of the mouse when it's hotplugged.
But somehow this doesn't work. It seems like
the program is not called.
Does someone have an idea what could cause this?

mb@powermac:~$ udevtest /class/usb_device/usbdev1.8/
main: looking at device '/class/usb_device/usbdev1.8' from subsystem 'usb_device'
run_program: 'usb_device_name --export usbdev1.8'
run_program: '/lib/udev/usb_device_name' (stdout) 'USB_BUS\01'
run_program: '/lib/udev/usb_device_name' (stdout) 'USB_DEV\08'
run_program: '/lib/udev/usb_device_name' returned with status 0
udev_rules_get_name: rule applied, 'usbdev1.8' becomes 'bus/usb/001/008'
udev_device_event: device '/class/usb_device/usbdev1.8' already known, remove possible symlinks
udev_node_add: creating device node '/dev/bus/usb/001/008', major = '189', minor = '7', mode = '0664', uid = '0', gid = '0'
main: run: 'deathaddercfg -C'
main: run: 'socket:/org/freedesktop/hal/udev_event'
main: run: 'socket:/org/kernel/udev/monitor'

I'm on Ubuntu Breezy.

Thanks!

-- 
Greetings Michael.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CIDÞVDEV
_______________________________________________
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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: My udev rule doesn't work
  2007-04-07 13:44 My udev rule doesn't work Michael Buesch
@ 2007-04-08 19:37 ` Kay Sievers
  2007-04-08 19:53 ` Michael Buesch
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Kay Sievers @ 2007-04-08 19:37 UTC (permalink / raw)
  To: linux-hotplug

On 4/7/07, Michael Buesch <mb@bu3sch.de> wrote:
> I have the following rule:
>
> mb@powermac:/etc/udev/rules.d$ cat 01-deathadder.rules
> # Configure the Razer DeathAdder mouse
> ACTION="add", SUBSYSTEM="usb_device", SYSFS{idVendor}="1532", SYSFS{idProduct}="0007", RUN+="deathaddercfg -C"
>
> It's for autoconfiguration of the mouse when it's hotplugged.
> But somehow this doesn't work. It seems like
> the program is not called.
> Does someone have an idea what could cause this?
>
> mb@powermac:~$ udevtest /class/usb_device/usbdev1.8/
> main: looking at device '/class/usb_device/usbdev1.8' from subsystem 'usb_device'
> run_program: 'usb_device_name --export usbdev1.8'
> run_program: '/lib/udev/usb_device_name' (stdout) 'USB_BUS\01'
> run_program: '/lib/udev/usb_device_name' (stdout) 'USB_DEV\08'
> run_program: '/lib/udev/usb_device_name' returned with status 0
> udev_rules_get_name: rule applied, 'usbdev1.8' becomes 'bus/usb/001/008'
> udev_device_event: device '/class/usb_device/usbdev1.8' already known, remove possible symlinks
> udev_node_add: creating device node '/dev/bus/usb/001/008', major = '189', minor = '7', mode = '0664', uid = '0', gid = '0'
> main: run: 'deathaddercfg -C'
> main: run: 'socket:/org/freedesktop/hal/udev_event'
> main: run: 'socket:/org/kernel/udev/monitor'

Hmm, udevtest is working fine, I fear that this is another indication,
that some USB-attributes are not readable at event time. We've seen
something similar with a new process scheduler recently.

If you add:
   ACTION="add", SUBSYSTEM="usb_device", PROGRAM="/bin/sleep 1"
before your rule, does it work?

Kay

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CIDÞVDEV
_______________________________________________
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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: My udev rule doesn't work
  2007-04-07 13:44 My udev rule doesn't work Michael Buesch
  2007-04-08 19:37 ` Kay Sievers
@ 2007-04-08 19:53 ` Michael Buesch
  2007-04-08 19:58 ` Michael Buesch
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Michael Buesch @ 2007-04-08 19:53 UTC (permalink / raw)
  To: linux-hotplug

On Sunday 08 April 2007 21:37, Kay Sievers wrote:
> On 4/7/07, Michael Buesch <mb@bu3sch.de> wrote:
> > I have the following rule:
> >
> > mb@powermac:/etc/udev/rules.d$ cat 01-deathadder.rules
> > # Configure the Razer DeathAdder mouse
> > ACTION="add", SUBSYSTEM="usb_device", SYSFS{idVendor}="1532", SYSFS{idProduct}="0007", RUN+="deathaddercfg -C"
> >
> > It's for autoconfiguration of the mouse when it's hotplugged.
> > But somehow this doesn't work. It seems like
> > the program is not called.
> > Does someone have an idea what could cause this?
> >
> > mb@powermac:~$ udevtest /class/usb_device/usbdev1.8/
> > main: looking at device '/class/usb_device/usbdev1.8' from subsystem 'usb_device'
> > run_program: 'usb_device_name --export usbdev1.8'
> > run_program: '/lib/udev/usb_device_name' (stdout) 'USB_BUS\01'
> > run_program: '/lib/udev/usb_device_name' (stdout) 'USB_DEV\08'
> > run_program: '/lib/udev/usb_device_name' returned with status 0
> > udev_rules_get_name: rule applied, 'usbdev1.8' becomes 'bus/usb/001/008'
> > udev_device_event: device '/class/usb_device/usbdev1.8' already known, remove possible symlinks
> > udev_node_add: creating device node '/dev/bus/usb/001/008', major = '189', minor = '7', mode = '0664', uid = '0', gid = '0'
> > main: run: 'deathaddercfg -C'
> > main: run: 'socket:/org/freedesktop/hal/udev_event'
> > main: run: 'socket:/org/kernel/udev/monitor'
> 
> Hmm, udevtest is working fine, I fear that this is another indication,
> that some USB-attributes are not readable at event time. We've seen
> something similar with a new process scheduler recently.
> 
> If you add:
>    ACTION="add", SUBSYSTEM="usb_device", PROGRAM="/bin/sleep 1"
> before your rule, does it work?

No, doesn't seem to.
I tried with one and five seconds sleep.

root@powermac:/etc/udev/rules.d# udevtest /class/usb_device/usbdev1.12/
main: looking at device '/class/usb_device/usbdev1.12' from subsystem 'usb_device'
run_program: '/bin/sleep 5'
run_program: '/bin/sleep' returned with status 0
run_program: 'usb_device_name --export usbdev1.12'
run_program: '/lib/udev/usb_device_name' (stdout) 'USB_BUS\01'
run_program: '/lib/udev/usb_device_name' (stdout) 'USB_DEV\x012'
run_program: '/lib/udev/usb_device_name' returned with status 0
udev_rules_get_name: rule applied, 'usbdev1.12' becomes 'bus/usb/001/012'
udev_device_event: device '/class/usb_device/usbdev1.12' already known, remove possible symlinks
udev_node_add: creating device node '/dev/bus/usb/001/012', major = '189', minor = '11', mode = '0664', uid = '0', gid = '0'
main: run: 'deathaddercfg -C'
main: run: 'socket:/org/freedesktop/hal/udev_event'
main: run: 'socket:/org/kernel/udev/monitor'

I also tried to put deathaddercfg into PROGRAM (although that's incorrect).
Isn't called, too.

root@powermac:/etc/udev/rules.d# udevtest /class/usb_device/usbdev1.15
main: looking at device '/class/usb_device/usbdev1.15' from subsystem 'usb_device'
run_program: 'deathaddercfg -C'
run_program: '/lib/udev/deathaddercfg' (stdout) 'run_program: program '/lib/udev/deathaddercfg' not found'
run_program: '/lib/udev/deathaddercfg' returned with status 1
run_program: 'usb_device_name --export usbdev1.15'
run_program: '/lib/udev/usb_device_name' (stdout) 'USB_BUS\01'
run_program: '/lib/udev/usb_device_name' (stdout) 'USB_DEV\x015'
run_program: '/lib/udev/usb_device_name' returned with status 0
udev_rules_get_name: rule applied, 'usbdev1.15' becomes 'bus/usb/001/015'
udev_device_event: device '/class/usb_device/usbdev1.15' already known, remove possible symlinks
udev_node_add: creating device node '/dev/bus/usb/001/015', major = '189', minor = '14', mode = '0664', uid = '0', gid = '0'
main: run: 'socket:/org/freedesktop/hal/udev_event'
main: run: 'socket:/org/kernel/udev/monitor'

My deathaddercfg tool uses libusb to find the device, if that matters
(I doubt it. It seems it's not called at all).
I also tried "touch /foobar" for RUN and it doesn't create the file /foobar.

-- 
Greetings Michael.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CIDÞVDEV
_______________________________________________
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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: My udev rule doesn't work
  2007-04-07 13:44 My udev rule doesn't work Michael Buesch
  2007-04-08 19:37 ` Kay Sievers
  2007-04-08 19:53 ` Michael Buesch
@ 2007-04-08 19:58 ` Michael Buesch
  2007-04-08 19:59 ` Michael Buesch
  2007-04-08 20:28 ` Bryan Kadzban
  4 siblings, 0 replies; 6+ messages in thread
From: Michael Buesch @ 2007-04-08 19:58 UTC (permalink / raw)
  To: linux-hotplug

On Sunday 08 April 2007 21:59, Michael Buesch wrote:
> On Sunday 08 April 2007 21:53, Michael Buesch wrote:
> > run_program: '/lib/udev/deathaddercfg' (stdout) 'run_program: program '/lib/udev/deathaddercfg' not found'
> > run_program: '/lib/udev/deathaddercfg' returned with status 1
> 
> 
> Oh I'm sorry. Did not see my error here.
> So when I put the tool (with full path) into PROGRAM, it's _not_
> called on the ADD event, but on udevtest it is and correctly configures the device.
> 
> 
> root@powermac:/etc/udev/rules.d# udevtest /class/usb_device/usbdev1.21
> main: looking at device '/class/usb_device/usbdev1.21' from subsystem 'usb_device'
> run_program: '/usr/local/bin/deathaddercfg -C'
> run_program: '/usr/local/bin/deathaddercfg' returned with status 0

Argh! Damn. I got it.
Stupid me.
/usr/local/bin is not in PATH at that time.
Sorry for the noise!
With full path in RUN it is called.

-- 
Greetings Michael.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CIDÞVDEV
_______________________________________________
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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: My udev rule doesn't work
  2007-04-07 13:44 My udev rule doesn't work Michael Buesch
                   ` (2 preceding siblings ...)
  2007-04-08 19:58 ` Michael Buesch
@ 2007-04-08 19:59 ` Michael Buesch
  2007-04-08 20:28 ` Bryan Kadzban
  4 siblings, 0 replies; 6+ messages in thread
From: Michael Buesch @ 2007-04-08 19:59 UTC (permalink / raw)
  To: linux-hotplug

On Sunday 08 April 2007 21:53, Michael Buesch wrote:
> run_program: '/lib/udev/deathaddercfg' (stdout) 'run_program: program '/lib/udev/deathaddercfg' not found'
> run_program: '/lib/udev/deathaddercfg' returned with status 1


Oh I'm sorry. Did not see my error here.
So when I put the tool (with full path) into PROGRAM, it's _not_
called on the ADD event, but on udevtest it is and correctly configures the device.


root@powermac:/etc/udev/rules.d# udevtest /class/usb_device/usbdev1.21
main: looking at device '/class/usb_device/usbdev1.21' from subsystem 'usb_device'
run_program: '/usr/local/bin/deathaddercfg -C'
run_program: '/usr/local/bin/deathaddercfg' returned with status 0
run_program: 'usb_device_name --export usbdev1.21'
run_program: '/lib/udev/usb_device_name' (stdout) 'USB_BUS\01'
run_program: '/lib/udev/usb_device_name' (stdout) 'USB_DEV\x021'
run_program: '/lib/udev/usb_device_name' returned with status 0
udev_rules_get_name: rule applied, 'usbdev1.21' becomes 'bus/usb/001/021'
udev_db_get_device: no db file to read /dev/.udev/db/class@usb_device@usbdev1.21: No such file or directory
udev_node_add: creating device node '/dev/bus/usb/001/021', major = '189', minor = '20', mode = '0664', uid = '0', gid = '0'
main: run: 'socket:/org/freedesktop/hal/udev_event'
main: run: 'socket:/org/kernel/udev/monitor

It seems that some sysfs attributes are missing when ADD event is happening, so the
rule doesn't match.
Kernel bug?

-- 
Greetings Michael.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CIDÞVDEV
_______________________________________________
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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: My udev rule doesn't work
  2007-04-07 13:44 My udev rule doesn't work Michael Buesch
                   ` (3 preceding siblings ...)
  2007-04-08 19:59 ` Michael Buesch
@ 2007-04-08 20:28 ` Bryan Kadzban
  4 siblings, 0 replies; 6+ messages in thread
From: Bryan Kadzban @ 2007-04-08 20:28 UTC (permalink / raw)
  To: linux-hotplug


[-- Attachment #1.1: Type: text/plain, Size: 468 bytes --]

Michael Buesch wrote:
> /usr/local/bin is not in PATH at that time.

More accurately, the *only* directory in the PATH is /lib/udev.  (Well
not really, but udevd doesn't use the PATH, either.  It just looks to
see if any / characters are in the program name, and if not, prepends
/lib/udev to it.  In all cases, it uses an exec* variant that doesn't
search the path.)

To run a program in any other directory, you need to give the full path
and filename.


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]

[-- Attachment #2: Type: text/plain, Size: 345 bytes --]

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

[-- Attachment #3: Type: text/plain, Size: 226 bytes --]

_______________________________________________
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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-04-08 20:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-07 13:44 My udev rule doesn't work Michael Buesch
2007-04-08 19:37 ` Kay Sievers
2007-04-08 19:53 ` Michael Buesch
2007-04-08 19:58 ` Michael Buesch
2007-04-08 19:59 ` Michael Buesch
2007-04-08 20:28 ` Bryan Kadzban

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.