From a0294b76252d8c84656218cafd458e6739361247 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sun, 28 Nov 2004 13:41:15 +0100 Subject: [PATCH] [PATCH] update the man pages and correct Usage: hints Add UDEV_LOG to the man udev man page. Remove mention of specific variables from the udevd/udevsend man page as we changed to pass the whole environment. Correct printed Usage: of udevtest and udevinfo. Init the config in udevtest earlier to accept input with and without the sysfs mount point. --- udev.8.in | 20 ++++++++++++-------- udevd.8 | 29 ++++++++++------------------- udevinfo.c | 2 +- udevtest.8 | 3 ++- udevtest.c | 19 ++++++++++--------- 5 files changed, 35 insertions(+), 38 deletions(-) diff --git a/udev.8.in b/udev.8.in index 728ddb1a4..7bdf56097 100644 --- a/udev.8.in +++ b/udev.8.in @@ -4,22 +4,24 @@ udev \- Linux configurable dynamic device naming support .SH SYNOPSIS .BI udev " hotplug-subsystem" .P -The environment must provide the following variables: +The following variables are read from the environment: .TP .B ACTION .IR add " or " remove -signifies the connection or disconnection of a device. -.TP +signifies the addition or the removal of a device. +.P .B DEVPATH The sysfs devpath of the device without the mountpoint but a leading slash. .P -Additional optional environment variables: -.TP +.B SUBSYSTEM +The subsystem the device belongs to. Alternatively the subsystem may +be passed as the first argument. +.P .B UDEV_CONFIG_FILE Overrides the default location of the .B udev config file. -.TP +.P .B UDEV_NO_DEVD The default behavior of .B udev @@ -34,7 +36,6 @@ provides a dynamic device directory containing only the files for actually present devices. It creates or removes device node files usually located in the /dev directory, or it renames network interfaces. .br - .P As part of the .B hotplug @@ -373,9 +374,12 @@ The name of a program must end with suffix, to be recognized. .br In addition to the hotplug environment variables, +.B UDEV_LOG +is set if udev is configured to use the syslog facility. Executed programs may +want to follow that setting. .B DEVNAME is exported to make the name of the created node, or the name the network -device is renamed to, available to the executed program. The programs in every +device is renamed to, available to the executed program. The programs in every directory are sorted in lexical order, while the directories are searched in the following order: .sp diff --git a/udevd.8 b/udevd.8 index 1de7a3cba..1a5940fef 100644 --- a/udevd.8 +++ b/udevd.8 @@ -3,19 +3,6 @@ udevd, udevdsend \- udev event serializer daemon and udev event sender .SH SYNOPSIS .BI udevsend " hotplug-subsystem" -.sp -The environment must provide the following variables: -.TP -.B ACTION -.IR add " or " remove -signifies the connection or disconnection of a device. -.TP -.B DEVPATH -The sysfs devpath of the device without the mountpoint but a leading slash. -.TP -.B SEQNUM -The sequence number of the event provided by the kernel. -If unset, the event bypasses the queue and will be executed immediately. .SH "DESCRIPTION" .B udevd allows the serialization of @@ -24,15 +11,19 @@ events. The events generated by the kernel may arrive in random order in userspace, that makes it neccessary to reorder them. .br .B udevd -takes care of the kernel supplied sequence number and arranges the events for -execution in the correct order. Missing sequences delay the execution of the -following events until a timeout is reached. +takes care of the kernel supplied +.B SEQNUM +sequence number and arranges the events for execution in the correct order. +Missing sequences delay the execution of the following events until a timeout +is reached. Events without any sequence number are bypassing the queue and +will be executed immediately. .br For each event a .BR udev (8) -instance is executed in the background. All further events for the same device -are delayed until the execution is finished. This way there will never be more -than one instance running for a single device at the same time. +instance is executed in the background with the complete environment received +by the hotplug event. All further events for the same device are delayed until +the execution is finished. This way there will never be more than one instance +running for a single device at the same time. .br .B udevd receives the events from diff --git a/udevinfo.c b/udevinfo.c index fe847b875..340496b42 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -439,7 +439,7 @@ exit: } help: - printf("Usage: [-anpqrdVh]\n" + printf("Usage: udevinfo [-anpqrdVh]\n" " -q TYPE query database for the specified value:\n" " 'name' name of device node\n" " 'symlink' pointing to node\n" diff --git a/udevtest.8 b/udevtest.8 index 6be7e089c..13b57f03b 100644 --- a/udevtest.8 +++ b/udevtest.8 @@ -2,7 +2,8 @@ .SH NAME udevtest \- simulates a udev run to test the configured rules .SH SYNOPSIS -.BI udevtest " sysfs_device_path" +.B udevtest +.IR "sysfs_device_path " [ subsystem ] .SH "DESCRIPTION" .B udevtest simulates a diff --git a/udevtest.c b/udevtest.c index 37ec767e1..9cc23f0ac 100644 --- a/udevtest.c +++ b/udevtest.c @@ -55,19 +55,23 @@ int main(int argc, char *argv[], char *envp[]) char *devpath; char path[SYSFS_PATH_MAX]; char temp[NAME_SIZE]; - char *subsystem = ""; struct udevice udev; + char *subsystem = NULL; info("version %s", UDEV_VERSION); - if (argv[1] == NULL) { - info("udevinfo expects the DEVPATH of the sysfs device as a argument"); + if (argc < 2 || argc > 3) { + info("Usage: udevtest [subsystem]"); return 1; } + /* initialize our configuration */ + udev_init_config(); + /* remove sysfs_path if given */ - if (strncmp(argv[1], sysfs_path, strlen(sysfs_path)) == 0) - devpath = argv[1] + strlen(sysfs_path); + if (strncmp(argv[1], sysfs_path, strlen(sysfs_path)) == 0) { + devpath = &argv[1][strlen(sysfs_path)] ; + } else if (argv[1][0] != '/') { /* prepend '/' if missing */ @@ -86,13 +90,10 @@ int main(int argc, char *argv[], char *envp[]) return 2; } - /* initialize our configuration */ - udev_init_config(); - /* initialize the naming deamon */ namedev_init(); - if (argv[2] != NULL) + if (argc == 3) subsystem = argv[2]; /* fill in values and test_run flag*/ -- 2.30.2