Skip to contentSkip to conversation

Udev question PROGRAM= question

DISCUSSION Jim Gifford 2 participants 5 messages Mar 15, 2005

lore
Share & tools
lore
#0 lore raw

If I run a program during the rules creation, example rule

    KERNEL="fd[0-9]*",      PROGRAM="/etc/udev/scripts/floppy-devices.sh %k"

When the device gets removed, how do I tell it to remove everything, or run the same program, to remove the /dev entries??

Signature · 15 lines
----
Jim Gifford
[email protected]



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
#1 lore raw
Quoted 4 lines · Jim Gifford

If I run a program during the rules creation, example rule

    KERNEL="fd[0-9]*",      PROGRAM="/etc/udev/scripts/floppy-devices.sh %k"

When the device gets removed, how do I tell it to remove everything, or run the same program, to remove the /dev entries??

PROGRAM= is used to return a string that can be matched against with RESULT=, or be used to set the name of a node with %c. You should not do anything else on with a callout.

On "remove", udev will remove the node for you and no callout will run.

Kay

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#2 lore raw
In reply to Jim Gifford
Quoted 10 lines · Kay Sievers

PROGRAM= is used to return a string that can be matched against with RESULT=, or be used to set the name of a node with %c. You should not do anything else on with a callout.

On "remove", udev will remove the node for you and no callout will run.

Kay

What do you do when the result is more than one node??

Signature · 15 lines
----
Jim Gifford
[email protected]



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
#3 lore raw
In reply to Jim Gifford
Quoted 10 lines · Kay Sievers
Quoted 6 lines · Jim Gifford

If I run a program during the rules creation, example rule
KERNEL="fd[0-9]*", PROGRAM="/etc/udev/scripts/floppy-devices.sh %k"
When the device gets removed, how do I tell it to remove everything, or run the same program, to remove the /dev entries??

Quoted 6 lines

PROGRAM= is used to return a string that can be matched against with RESULT=, or be used to set the name of a node with %c. You should not do anything else on with a callout.

Kay, let me rephrase my response.
The output of my script is the following
# ./* fd0
fd0 b 2 0
fd0u360 b 2 12
fd0u720 b 2 16
fd0u800 b 2 120
fd0u820 b 2 52
fd0u830 b 2 68
fd0u1040 b 2 84
fd0u1120 b 2 88
fd0u1440 b 2 28
fd0u1600 b 2 124
fd0u1680 b 2 44
fd0u1722 b 2 60
fd0u1743 b 2 76
fd0u1760 b 2 96
fd0u1840 b 2 116
fd0u1920 b 2 100
fd0u2880 b 2 32
fd0u3200 b 2 104
fd0u3520 b 2 108
fd0u3840 b 2 112

What would my udev rule be?

Signature · 15 lines
----
Jim Gifford
[email protected]



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
#4 lore raw
In reply to Jim Gifford
Quoted 42 lines · Jim Gifford
Quoted 10 lines · Kay Sievers
Quoted 6 lines · Jim Gifford

If I run a program during the rules creation, example rule
KERNEL="fd[0-9]*", PROGRAM="/etc/udev/scripts/floppy-devices.sh %k"
When the device gets removed, how do I tell it to remove everything, or run the same program, to remove the /dev entries??

Quoted 6 lines

PROGRAM= is used to return a string that can be matched against with RESULT=, or be used to set the name of a node with %c. You should not do anything else on with a callout.

Kay, let me rephrase my response.
The output of my script is the following
# ./* fd0
fd0 b 2 0
fd0u360 b 2 12
fd0u720 b 2 16
fd0u800 b 2 120
fd0u820 b 2 52
fd0u830 b 2 68
fd0u1040 b 2 84
fd0u1120 b 2 88
fd0u1440 b 2 28
fd0u1600 b 2 124
fd0u1680 b 2 44
fd0u1722 b 2 60
fd0u1743 b 2 76
fd0u1760 b 2 96
fd0u1840 b 2 116
fd0u1920 b 2 100
fd0u2880 b 2 32
fd0u3200 b 2 104
fd0u3520 b 2 108
fd0u3840 b 2 112

Quoted 1 line

What would my udev rule be?

This does not fit into the udev model. We can only support devices that have a sane sysfs kernel representation.
You may call MAKEDEV it with a dev.d/ script triggered for the fd* device.

Kay

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel