From: Robert Love <rml@mvista.com>
To: linux-hotplug@vger.kernel.org
Subject: [patch] udev: cool test scripts
Date: Fri, 17 Oct 2003 22:35:22 +0000 [thread overview]
Message-ID: <marc-linux-hotplug-106643027816111@msgid-missing> (raw)
Hi, Greg.
I dunno if these are desired, but they are pretty useful to me.
This patch changes test.tty and test.block to add/remove each tty and
block device, respectively, on the system. Great way to
populate/unpopulate udev rapidly.
Its just a simple for loop over the sysfs entries.
Patch is against udev-003.
Robert Love
test.block | 18 ++++++++++--------
test.tty | 18 ++++++++++--------
2 files changed, 20 insertions(+), 16 deletions(-)
diff -urN udev-cvs/test.block udev/test.block
--- udev-cvs/test.block 2003-07-24 22:12:14.000000000 -0400
+++ udev/test.block 2003-10-17 18:30:07.314143640 -0400
@@ -1,10 +1,12 @@
-#!/bin/sh
-export ACTIONd
-#export ACTION=remove
+#! /bin/sh
+#
+# test.block - run udev(8) on each block device in /sys/block
-export DEVPATH=/block/hda
-export DEVPATH=/block/sda/sda1
-#export DEVPATH=/block/sda
+SYSFSDIR=/sys # change this for a nonstand sysfs mount point
+BIN=./udev # location of your udev binary
+export ACTIONd # 'add' or 'remove'
-
-./udev block
+for i in ${SYSFSDIR}/block/*; do
+ export DEVPATH="/"`echo $i | cut --delimiter='/' --fields=3-`
+ $BIN block
+done
diff -urN udev-cvs/test.tty udev/test.tty
--- udev-cvs/test.tty 2003-07-23 15:32:19.000000000 -0400
+++ udev/test.tty 2003-10-17 18:28:25.808574832 -0400
@@ -1,10 +1,12 @@
-#!/bin/sh
-export ACTIONd
-#export ACTION=remove
-export DEVPATH=/devices/pci0/00:09.0/usb1/1-1/1-1.1/ttyUSB7
-export DEVPATH=/class/tty/ttyUSB0
-#export DEVPATH=/block/hda
+#! /bin/sh
+#
+# test.tty - run udev(8) on each tty device in /sys/class/tty
+SYSFSDIR=/sys # change this for a nonstand sysfs mount point
+BIN=./udev # location of your udev binary
+export ACTIONd # 'add' or 'remove'
-#./udev block
-./udev tty
+for i in ${SYSFSDIR}/class/tty/*; do
+ export DEVPATH="/"`echo $i | cut --delimiter='/' --fields=3-`
+ $BIN tty
+done
-------------------------------------------------------
This SF.net email sponsored by: Enterprise Linux Forum Conference & Expo
The Event For Linux Datacenter Solutions & Strategies in The Enterprise
Linux in the Boardroom; in the Front Office; & in the Server Room
http://www.enterpriselinuxforum.com
_______________________________________________
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
next reply other threads:[~2003-10-17 22:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-10-17 22:35 Robert Love [this message]
-- strict thread matches above, loose matches on Subject: below --
2003-10-17 22:58 [patch] udev: cool test scripts Greg KH
2003-10-17 23:18 ` Robert Love
2003-10-18 0:18 ` Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=marc-linux-hotplug-106643027816111@msgid-missing \
--to=rml@mvista.com \
--cc=linux-hotplug@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).