mirror of
https://github.com/systemd/systemd.git
synced 2024-10-27 01:55:22 +03:00
udevadm trigger: introduce --type=all option
This commit is contained in:
parent
873cf95c2f
commit
1baeee5784
@ -280,9 +280,9 @@
|
||||
<term><option>-t</option></term>
|
||||
<term><option>--type=<replaceable>TYPE</replaceable></option></term>
|
||||
<listitem>
|
||||
<para>Trigger a specific type of devices. Valid types are:
|
||||
<command>devices</command>, <command>subsystems</command>.
|
||||
The default value is <command>devices</command>.</para>
|
||||
<para>Trigger a specific type of devices. Valid types are <literal>all</literal>,
|
||||
<literal>devices</literal>, and <literal>subsystems</literal>. The default value is
|
||||
<literal>devices</literal>.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
|
@ -118,7 +118,7 @@ _udevadm() {
|
||||
if __contains_word "$prev" ${OPTS[TRIGGER_ARG]}; then
|
||||
case $prev in
|
||||
-t|--type)
|
||||
comps='devices subsystems'
|
||||
comps='all devices subsystems'
|
||||
;;
|
||||
-c|--action)
|
||||
comps=$( udevadm trigger --action help )
|
||||
|
@ -24,7 +24,7 @@ _udevadm_trigger(){
|
||||
'--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)' \
|
||||
'--type=[Trigger a specific type of devices.]:types:(all devices subsystems failed)' \
|
||||
'--action=[Type of event to be triggered.]:actions:(add change remove move online offline bind unbind)' \
|
||||
'--subsystem-match=[Trigger events for devices which belong to a matching subsystem.]' \
|
||||
'--subsystem-nomatch=[Do not trigger events for devices which belong to a matching subsystem.]' \
|
||||
|
@ -271,6 +271,7 @@ int trigger_main(int argc, char *argv[], void *userdata) {
|
||||
enum {
|
||||
TYPE_DEVICES,
|
||||
TYPE_SUBSYSTEMS,
|
||||
TYPE_ALL,
|
||||
} device_type = TYPE_DEVICES;
|
||||
sd_device_action_t action = SD_DEVICE_CHANGE;
|
||||
_cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *e = NULL;
|
||||
@ -313,6 +314,8 @@ int trigger_main(int argc, char *argv[], void *userdata) {
|
||||
device_type = TYPE_DEVICES;
|
||||
else if (streq(optarg, "subsystems"))
|
||||
device_type = TYPE_SUBSYSTEMS;
|
||||
else if (streq(optarg, "all"))
|
||||
device_type = TYPE_ALL;
|
||||
else
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Unknown type --type=%s", optarg);
|
||||
break;
|
||||
@ -495,6 +498,11 @@ int trigger_main(int argc, char *argv[], void *userdata) {
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to scan devices: %m");
|
||||
break;
|
||||
case TYPE_ALL:
|
||||
r = device_enumerator_scan_devices_and_subsystems(e);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to scan devices and subsystems: %m");
|
||||
break;
|
||||
default:
|
||||
assert_not_reached();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user