linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Strange Rule Behaviour
@ 2006-04-15 21:04 Robert Kennedy
  2006-04-16  6:14 ` Andrey Borzenkov
  2006-04-16 14:53 ` Robert Kennedy
  0 siblings, 2 replies; 3+ messages in thread
From: Robert Kennedy @ 2006-04-15 21:04 UTC (permalink / raw)
  To: linux-hotplug

I have a simple rule that runs a script that creates extra cd related 
symlinks.

The rule is as follows:

ACTION="add", BUS="scsi", KERNEL="sr[0-9]*", SYSFS{type}="5", 
RUN+="/lib/udev/cdsymlinks.sh"

This rule works great.  When a new CDRW drive is plugged in, the script is 
called and creates additional symlinks.

I also have a rule to run the same script which will remove these cd 
symlinks when the CDRW driver is removed (e.g. removable CDRW drive).  I 
first tried this rule:

ACTION="remove", BUS="scsi", KERNEL="sr[0-9]*", SYSFS{type}="5", 
RUN+="/lib/udev/cdsymlinks.sh"

It did not work.  I could only get the rule to be matched and run when I 
changed the rule to:

ACTION="add", BUS="block", KERNEL="sr[0-9]*",  
RUN+="/lib/udev/cdsymlinks.sh"

I am curious why I had to change the remove rule.  Does anyone have any 
ideas?

Rob




-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid\x110944&bid$1720&dat\x121642
_______________________________________________
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] 3+ messages in thread

* Re: Strange Rule Behaviour
  2006-04-15 21:04 Strange Rule Behaviour Robert Kennedy
@ 2006-04-16  6:14 ` Andrey Borzenkov
  2006-04-16 14:53 ` Robert Kennedy
  1 sibling, 0 replies; 3+ messages in thread
From: Andrey Borzenkov @ 2006-04-16  6:14 UTC (permalink / raw)
  To: linux-hotplug

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sunday 16 April 2006 01:04, Robert Kennedy wrote:
> I have a simple rule that runs a script that creates extra cd related
> symlinks.
>
> The rule is as follows:
>
> ACTION="add", BUS="scsi", KERNEL="sr[0-9]*", SYSFS{type}="5",
> RUN+="/lib/udev/cdsymlinks.sh"
>
> This rule works great.  When a new CDRW drive is plugged in, the script is
> called and creates additional symlinks.
>

it is better to change this script to return list of symlinks and use

ACTION="add", BUS="scsi", KERNEL="sr[0-9]*", SYSFS{type}="5",
PROGRAM="/lib/udev/cdsymlinks.sh", SYMLINK="%c"

In this case symlinks will be deleted by udev in "remove". It also allows 
querying for them using udevinfo.


> I also have a rule to run the same script which will remove these cd
> symlinks when the CDRW driver is removed (e.g. removable CDRW drive).  I
> first tried this rule:
>
> ACTION="remove", BUS="scsi", KERNEL="sr[0-9]*", SYSFS{type}="5",
> RUN+="/lib/udev/cdsymlinks.sh"
>
> It did not work.  I could only get the rule to be matched and run when I
> changed the rule to:
>
> ACTION="add", BUS="block", KERNEL="sr[0-9]*",
> RUN+="/lib/udev/cdsymlinks.sh"
>
> I am curious why I had to change the remove rule.  Does anyone have any
> ideas?
>

sysfs entry for device is not available on "remove".

- -andrey
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)

iD8DBQFEQeC0R6LMutpd94wRAmXYAKDHS51SJqmn8EEej2ilw/ctIeIK+gCeI5eV
mil6gsxFFZhsEWh9nhI3POk=ePVn
-----END PGP SIGNATURE-----


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid\x110944&bid$1720&dat\x121642
_______________________________________________
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] 3+ messages in thread

* Re: Strange Rule Behaviour
  2006-04-15 21:04 Strange Rule Behaviour Robert Kennedy
  2006-04-16  6:14 ` Andrey Borzenkov
@ 2006-04-16 14:53 ` Robert Kennedy
  1 sibling, 0 replies; 3+ messages in thread
From: Robert Kennedy @ 2006-04-16 14:53 UTC (permalink / raw)
  To: linux-hotplug


>On Sunday 16 April 2006 01:04, Robert Kennedy wrote:
> > I have a simple rule that runs a script that creates extra cd related
> > symlinks.
> >
> > The rule is as follows:
> >
> > ACTION="add", BUS="scsi", KERNEL="sr[0-9]*", SYSFS{type}="5",
> > RUN+="/lib/udev/cdsymlinks.sh"
> >
> > This rule works great.  When a new CDRW drive is plugged in, the script 
>is
> > called and creates additional symlinks.
> >
>
>it is better to change this script to return list of symlinks and use
>
>ACTION="add", BUS="scsi", KERNEL="sr[0-9]*", SYSFS{type}="5",
>PROGRAM="/lib/udev/cdsymlinks.sh", SYMLINK="%c"
>
>In this case symlinks will be deleted by udev in "remove". It also allows
>querying for them using udevinfo.
>
>
> > I also have a rule to run the same script which will remove these cd
> > symlinks when the CDRW driver is removed (e.g. removable CDRW drive).  I
> > first tried this rule:
> >
> > ACTION="remove", BUS="scsi", KERNEL="sr[0-9]*", SYSFS{type}="5",
> > RUN+="/lib/udev/cdsymlinks.sh"
> >
> > It did not work.  I could only get the rule to be matched and run when I
> > changed the rule to:
> >
> > ACTION="add", BUS="block", KERNEL="sr[0-9]*",
> > RUN+="/lib/udev/cdsymlinks.sh"
> >
> > I am curious why I had to change the remove rule.  Does anyone have any
> > ideas?
> >
>
>sysfs entry for device is not available on "remove".
>
>- -andrey

Thanks audrey for the info.  I learn something new about udev everyday.

You probably already figured it out but I did not type out the remove rule 
properly.  It should have be written:

ACTION="remove", BUS="block", KERNEL="sr[0-9]*",  
RUN+="/lib/udev/cdsymlinks.sh"

I also found it strange that I needed to use BUS="scsi" with the add rule 
but I had to change it to BUS="block" in the remove rule.  Perhaps, it is 
because the CDRW drive, like all drives, is created as a block device.

Rob




-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid\x110944&bid$1720&dat\x121642
_______________________________________________
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] 3+ messages in thread

end of thread, other threads:[~2006-04-16 14:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-15 21:04 Strange Rule Behaviour Robert Kennedy
2006-04-16  6:14 ` Andrey Borzenkov
2006-04-16 14:53 ` Robert Kennedy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).