diff --git a/man/udevadm.xml b/man/udevadm.xml index ec26cc3c07..b731f808bc 100644 --- a/man/udevadm.xml +++ b/man/udevadm.xml @@ -212,6 +212,13 @@ Do not actually trigger the event. + + + + + Suppress error logging in triggering events. + + diff --git a/shell-completion/bash/udevadm b/shell-completion/bash/udevadm index 8b1b962f2d..33d998395e 100644 --- a/shell-completion/bash/udevadm +++ b/shell-completion/bash/udevadm @@ -51,7 +51,7 @@ _udevadm() { [INFO_STANDALONE]='-r --root -a --attribute-walk -x --export -e --export-db -c --cleanup-db -w --wait-for-initialization' [INFO_ARG]='-q --query -p --path -n --name -P --export-prefix -d --device-id-of-file' - [TRIGGER_STANDALONE]='-v --verbose -n --dry-run -w --settle --wait-daemon' + [TRIGGER_STANDALONE]='-v --verbose -n --dry-run -q --quiet -w --settle --wait-daemon' [TRIGGER_ARG]='-t --type -c --action -s --subsystem-match -S --subsystem-nomatch -a --attr-match -A --attr-nomatch -p --property-match -g --tag-match -y --sysname-match --name-match -b --parent-match' diff --git a/shell-completion/zsh/_udevadm b/shell-completion/zsh/_udevadm index ae82d8aa70..5e989b4a1d 100644 --- a/shell-completion/zsh/_udevadm +++ b/shell-completion/zsh/_udevadm @@ -21,6 +21,7 @@ _udevadm_trigger(){ _arguments \ '--verbose[Print the list of devices which will be triggered.]' \ '--dry-run[Do not actually trigger the event.]' \ + '--quiet[Suppress error logging in triggering events.]' \ '--type=[Trigger a specific type of devices.]:types:(devices subsystems failed)' \ '--action=[Type of event to be triggered.]:actions:(add change remove)' \ '--subsystem-match=[Trigger events for devices which belong to a matching subsystem.]' \ diff --git a/src/udev/udevadm-trigger.c b/src/udev/udevadm-trigger.c index f866bb7f16..ade92286d4 100644 --- a/src/udev/udevadm-trigger.c +++ b/src/udev/udevadm-trigger.c @@ -23,6 +23,7 @@ static bool arg_verbose = false; static bool arg_dry_run = false; +static bool arg_quiet = false; static int exec_list(sd_device_enumerator *e, sd_device_action_t action, Set **settle_set) { const char *action_str; @@ -70,6 +71,7 @@ static int exec_list(sd_device_enumerator *e, sd_device_action_t action, Set **s bool ignore = IN_SET(r, -ENOENT, -ENODEV); int level = + arg_quiet ? LOG_DEBUG : r == -ENOENT ? LOG_DEBUG : r == -ENODEV ? LOG_WARNING : LOG_ERR; @@ -144,6 +146,7 @@ static int help(void) { " -V --version Show package version\n" " -v --verbose Print the list of devices while running\n" " -n --dry-run Do not actually trigger the events\n" + " -q --quiet Suppress error logging in triggering events\n" " -t --type= Type of events to trigger\n" " devices sysfs devices (default)\n" " subsystems sysfs subsystems and drivers\n" @@ -174,6 +177,7 @@ int trigger_main(int argc, char *argv[], void *userdata) { static const struct option options[] = { { "verbose", no_argument, NULL, 'v' }, { "dry-run", no_argument, NULL, 'n' }, + { "quiet", no_argument, NULL, 'q' }, { "type", required_argument, NULL, 't' }, { "action", required_argument, NULL, 'c' }, { "subsystem-match", required_argument, NULL, 's' }, @@ -217,7 +221,7 @@ int trigger_main(int argc, char *argv[], void *userdata) { if (r < 0) return r; - while ((c = getopt_long(argc, argv, "vnt:c:s:S:a:A:p:g:y:b:wVh", options, NULL)) >= 0) { + while ((c = getopt_long(argc, argv, "vnqt:c:s:S:a:A:p:g:y:b:wVh", options, NULL)) >= 0) { _cleanup_free_ char *buf = NULL; const char *key, *val; @@ -228,6 +232,9 @@ int trigger_main(int argc, char *argv[], void *userdata) { case 'n': arg_dry_run = true; break; + case 'q': + arg_quiet = true; + break; case 't': if (streq(optarg, "devices")) device_type = TYPE_DEVICES;