linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* How to trigger a udev rule
@ 2011-03-03  6:21 Thomas Bechtold
  2011-03-03  6:36 ` Andrey Borzenkov
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Thomas Bechtold @ 2011-03-03  6:21 UTC (permalink / raw)
  To: linux-hotplug

[-- Attachment #1: Type: text/plain, Size: 464 bytes --]

Hi,

i have a udev rule and want to trigger this rule with "udevadm trigger".
The rule is:

### only check /dev/ttyS1 (atmel_usart.1) for modem ###
ACTION!="add|change", GOTO="mm_platform_device_whitelist_end"
SUBSYSTEM!="platform", GOTO="mm_platform_device_whitelist_end"
DRIVERS=="atmel_usart",KERNELS=="atmel_usart.1",ENV{ID_MM_PLATFORM_DRIVER_PROBE}="1"
LABEL="mm_platform_device_whitelist_end"


Any idea how to trigger this?


Cheers,

Tom

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

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

* Re: How to trigger a udev rule
  2011-03-03  6:21 How to trigger a udev rule Thomas Bechtold
@ 2011-03-03  6:36 ` Andrey Borzenkov
  2011-03-03  6:49 ` J. Bakshi
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Andrey Borzenkov @ 2011-03-03  6:36 UTC (permalink / raw)
  To: linux-hotplug

On Thu, Mar 3, 2011 at 9:21 AM, Thomas Bechtold
<thomasbechtold@jpberlin.de> wrote:
> Hi,
>
> i have a udev rule and want to trigger this rule with "udevadm trigger".
> The rule is:
>
> ### only check /dev/ttyS1 (atmel_usart.1) for modem ###
> ACTION!="add|change", GOTO="mm_platform_device_whitelist_end"
> SUBSYSTEM!="platform", GOTO="mm_platform_device_whitelist_end"
> DRIVERS="atmel_usart",KERNELS="atmel_usart.1",ENV{ID_MM_PLATFORM_DRIVER_PROBE}="1"
> LABEL="mm_platform_device_whitelist_end"
>
>
> Any idea how to trigger this?
>

You can't trigger specific rule. You can trigger processing for
specific device; and check whether this rule is executed as part of
it.

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

* Re: How to trigger a udev rule
  2011-03-03  6:21 How to trigger a udev rule Thomas Bechtold
  2011-03-03  6:36 ` Andrey Borzenkov
@ 2011-03-03  6:49 ` J. Bakshi
  2011-03-03  8:54 ` Martin Pitt
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: J. Bakshi @ 2011-03-03  6:49 UTC (permalink / raw)
  To: linux-hotplug

On Thu, 03 Mar 2011 07:21:27 +0100
Thomas Bechtold <thomasbechtold@jpberlin.de> wrote:

> Hi,
> 
> i have a udev rule and want to trigger this rule with "udevadm trigger".
>

I am also interested to know how to trigger udev rule / event 

Thank

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

* Re: How to trigger a udev rule
  2011-03-03  6:21 How to trigger a udev rule Thomas Bechtold
  2011-03-03  6:36 ` Andrey Borzenkov
  2011-03-03  6:49 ` J. Bakshi
@ 2011-03-03  8:54 ` Martin Pitt
  2011-03-03  9:52 ` Thomas Bechtold
  2011-03-03 10:39 ` Andrey Borzenkov
  4 siblings, 0 replies; 6+ messages in thread
From: Martin Pitt @ 2011-03-03  8:54 UTC (permalink / raw)
  To: linux-hotplug

[-- Attachment #1: Type: text/plain, Size: 1163 bytes --]

Hello Thomas,

funny that you ask, a few days ago someone asked exactly the same
thing in #udev.

Thomas Bechtold [2011-03-03  7:21 +0100]:
> ### only check /dev/ttyS1 (atmel_usart.1) for modem ###
> ACTION!="add|change", GOTO="mm_platform_device_whitelist_end"
> SUBSYSTEM!="platform", GOTO="mm_platform_device_whitelist_end"
> DRIVERS=="atmel_usart",KERNELS=="atmel_usart.1",ENV{ID_MM_PLATFORM_DRIVER_PROBE}="1"
> LABEL="mm_platform_device_whitelist_end"

I'm afraid udevadm trigger doesn't support the same parental matching
as udev rules themselves do, so I don't think there can be a precise
trigger unless you already know the corresponding /dev/ttySn device
node. If you do, then just do

  udevadm trigger --sysname-match=ttySn

If you dont, it shouldn't matter much to trigger all ttyS devices:

  udevadm trigger --sysname-match=ttyS*

BTW, you can also try with --verbose --dry-run (also works as user) to
see what it would do, and refine the match until it works to your
needs.

Martin
-- 
Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: How to trigger a udev rule
  2011-03-03  6:21 How to trigger a udev rule Thomas Bechtold
                   ` (2 preceding siblings ...)
  2011-03-03  8:54 ` Martin Pitt
@ 2011-03-03  9:52 ` Thomas Bechtold
  2011-03-03 10:39 ` Andrey Borzenkov
  4 siblings, 0 replies; 6+ messages in thread
From: Thomas Bechtold @ 2011-03-03  9:52 UTC (permalink / raw)
  To: linux-hotplug

Hi Martin,

On 03/03/11 09:54, Martin Pitt wrote:
> Hello Thomas,
>
> funny that you ask, a few days ago someone asked exactly the same
> thing in #udev.

that was me:)

> Thomas Bechtold [2011-03-03  7:21 +0100]:
>> ### only check /dev/ttyS1 (atmel_usart.1) for modem ###
>> ACTION!="add|change", GOTO="mm_platform_device_whitelist_end"
>> SUBSYSTEM!="platform", GOTO="mm_platform_device_whitelist_end"
>> DRIVERS="atmel_usart",KERNELS="atmel_usart.1",ENV{ID_MM_PLATFORM_DRIVER_PROBE}="1"
>> LABEL="mm_platform_device_whitelist_end"
>
> I'm afraid udevadm trigger doesn't support the same parental matching
> as udev rules themselves do, so I don't think there can be a precise
> trigger unless you already know the corresponding /dev/ttySn device
> node. If you do, then just do
>
>    udevadm trigger --sysname-match=ttySn

i know the device name. it's always ttyS1. But your trigger does not 
match the rule:

# udevadm trigger --sysname-match=ttyS1 --verbose
/sys/devices/platform/atmel_usart.1/tty/ttyS1


I tried to do this with udevadm (modemmanager is running in background 
and log is written to sdtout):

# udevadm trigger --action­d --subsystem-match=tty 
--subsystem-match=platform --sysname-match=ttyS1 --verbose
/sys/devices/platform/atmel_usart.1/tty/ttyS1

Here, ModemManager  does nothing.



When i execute the command with ttyS0, the output is:

# udevadm trigger --action­d --subsystem-match=tty 
--subsystem-match=platform --sysname-match=ttyS0 --verbose
/sys/devices/platform/atmel_usart.1/tty/ttyS0
modem-manager[772]: <debug> [1299145393.216952] [mm-manager.c:802] 
device_added(): (tty/ttyS0): port's parent platform driver is not 
whitelisted

Here, ModemManager detects the trigger.

I think the question is how to set DRIVERS="atmel_usart" and 
KERNELS="atmel_usart.1" !?

Cheers,

Tom



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

* Re: How to trigger a udev rule
  2011-03-03  6:21 How to trigger a udev rule Thomas Bechtold
                   ` (3 preceding siblings ...)
  2011-03-03  9:52 ` Thomas Bechtold
@ 2011-03-03 10:39 ` Andrey Borzenkov
  4 siblings, 0 replies; 6+ messages in thread
From: Andrey Borzenkov @ 2011-03-03 10:39 UTC (permalink / raw)
  To: linux-hotplug

On Thu, Mar 3, 2011 at 12:52 PM, Thomas Bechtold
<thomasbechtold@jpberlin.de> wrote:

> i know the device name. it's always ttyS1. But your trigger does not match
> the rule:
>

Then you have to fix the rule :) because it won't be applied to real
device as well.

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

end of thread, other threads:[~2011-03-03 10:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-03  6:21 How to trigger a udev rule Thomas Bechtold
2011-03-03  6:36 ` Andrey Borzenkov
2011-03-03  6:49 ` J. Bakshi
2011-03-03  8:54 ` Martin Pitt
2011-03-03  9:52 ` Thomas Bechtold
2011-03-03 10:39 ` Andrey Borzenkov

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).