Detailed explanation of udevadm command

udevadm Then a command and command specify the options. It controls the behavior of udev, handles kernel events, controls event queues, and provides a simple debugging mechanism.

Options:

–debug Print error message

–version Print version information

–help Help document

udevadm info options     Query the device information in the udev database. You can also query the properties of the device from the sysfs file system to help create the udev rules.

–query=type     Query the specified type of device from the database. –path and –name are required to specify the device. The legal query file is: device name, link, path, attribute.

–path=devpath      Device path

–name=file       Device nodes or links

–attribute-walk    Prints all the attributes of the sysfs record of the specified device to match the udev rule with the special device. This option prints all the device information on the chain, possibly to the sys directory.

–device-id-of-file=file Print master / slave device number

–export-db       Export contents in udev database

udevadm trigger [options]  Receives the device event sent by the kernel. It is mainly used for replaying coldplug event information.

(The kernel has detected the system’s hardware devices at startup and exported the hardware device information through the sysfs kernel virtual file system. Udev scans the sysfs file system, generates hotplug events based on hardware device information, and udev reads thisSome events generate corresponding hardware device files. The process is called coldplug because there is no actual hardware plug and pull action.

–verbose     Output the list of devices that will be triggered.

–dry-run      Not really triggering events

–type=type     Trigger a special device. The legal type is devices, subsystem, and failed. is devices by default.

–action=action  The triggered event is change by default.

–subsystem-match=subsystem  Trigger device events that match the subsystem. This option can be specified many times and support shell pattern matching.

–attr-match=attribute=value     Trigger the device event that matches the sysfs property. If the attribute values and attributes are specified together, the value of the attribute can be matched by shell pattern. If no value is specified, the existing property will be reconfirmed. This option can be specified many times.

–attr-nomatch=attribute=value   Do not trigger device events with matching properties. If you can use pattern matching. It can also be specified many times.

–property-match=property=value Matching attributes match the device. Support pattern matching can be specified several times.

–tag-match=property       Match labels to match the device. It can be specified many times.

–sysname-match=name     Matches the device with the same name as the sys device. Support pattern matching can be specified several times.

udevadm settle [options]  View the udev event queue and exit if all events are processed.

–timeout=seconds     The maximum time to wait for the event queue to be empty. The default is 180 seconds. If it is 0, quit immediately.

–seq-start=seqnum     Just wait for the given sequence number.

–seq-end=seqnum    Just wait until the given sequence number.

–exit-if-exists=file      If files exist, quit.

–quiet    Do not export any information.

udevadm monitor [options]  Listen to kernel events and events events sent by udev. Print the device sent by the event. Event timing can be analyzed by comparing the timestamp of the kernel or udev event.

–kernel  Output kernel event

–udev  Output udev events when udev rules execute

–property  Attribute of output event

–subsystem-match=string  Filtering events through subsystems or device types. Only udev device events that match the subsystem values are passed.

–tag-match=string  Through attribute filtering events, only the udev event that matches the label is passed.

udevadm test [options] devpath  Simulate a udev event and print out debug information.

Leave a Reply

Your email address will not be published. Required fields are marked *