$ cat /etc/udev/udev.conf # Ubuntu # see udev.conf(5) for details # # udevd is also started in the initrd. When this file is modified you might # also want to rebuild the initrd, so that it will include the modified configuration.
# 使用shell风格的模式匹配(实际都是正则这里不过多接受了) * - match any character, zero or more times ? - match any character exactly once [] - match any single character specified in the brackets, ranges are also permitted
USB Hard Disk 描述:USB硬盘可与我上面描述的USB相机相比较,然而典型的使用模式是不同的。 在相机的例子中我解释了我对sdb节点不感兴趣——它真正的用途只是用于分区(例如fdisk),但我为什么要对相机进行分区!?当然如果你有一个100GB的USB硬盘,这是完全可以理解的,你可能想要分区,在这种情况下,我们可以利用udev的字符串替换:
1 2 3 4 5
# This rule creates symlinks such as: # /dev/usbhd - The fdiskable node # /dev/usbhd1 - The first partition (mountable) # /dev/usbhd2 - The second partition (mountable) KERNEL=="sd*", SUBSYSTEMS=="scsi", ATTRS{model}=="USB 2.0 Storage Device", SYMLINK+="usbhd%n"
USB Card Reader 描述:USB读卡器(CompactFlash、SmartMedia等)是另一种有不同使用要求的USB存储设备,比如下面将有节点命名:cfrdr, cfrdr1, cfrdr2, cfrdr3,…, cfrdr15。
-p, --path=DEVPATH #要查询的设备的/sys路径 # e.g. [/sys]/class/block/sda. This option is an alternative to the positional argument with a /sys/ prefix. udevadm info --path=/class/block/sda is equivalent to udevadm info /sys/class/block/sda.
-n, --name=FILE # 查询的设备节点或符号链接的名称(/dev) #e.g. [/dev]/sda. This option is an alternative to the positional argument with a /dev/ prefix. udevadm info --name=sda is equivalent to udevadm info /dev/sda.
-r, --root Print absolute paths in name or symlink query.
-a, --attribute-walk Print all sysfs properties of the specified device that can be used in udev rules to match the specified device. It prints all devices along the chain, up to the root of sysfs that can be used in udev rules.
-x, --export Print output as key/value pairs. Values are enclosed in single quotes. This takes effects only when --query=property or --device-id-of-file=FILE is specified.
-P, --export-prefix=NAME Add a prefix to the key name of exported values. This implies --export.
-d, --device-id-of-file=FILE Print major/minor numbers of the underlying device, where the file lives on. If this is specified, all positional arguments are ignored.
-e, --export-db Export the content of the udev database.
-e, --export-db Export the content of the udev database.
-c, --cleanup-db Cleanup the udev database.
-w[SECONDS], --wait-for-initialization[=SECONDS] Wait for device to be initialized. If argument SECONDS is not specified, the default is to wait forever.
-v, --verbose Print the list of devices which will be triggered.
-n, --dry-run Do not actually trigger the event.
-t, --type=TYPE Trigger a specific type of devices. Valid types are: devices, subsystems. The default value is devices.
-c, --action=ACTION Type of event to be triggered. Possible actions are "add", "remove", "change", "move", "online", "offline", "bind", and "unbind". Also, the special value "help" can be used to list the possible actions. The default value is "change".
-s, --subsystem-match=SUBSYSTEM Trigger events for devices which belong to a matching subsystem. This option supports shell style pattern matching. When this option is specified more than once, then each matching result is ORed, that is, all the devices in each subsystem are triggered.
-S, --subsystem-nomatch=SUBSYSTEM Do not trigger events for devices which belong to a matching subsystem. This option supports shell style pattern matching. When this option is specified more than once, then each matching result is ANDed, that is, devices whichdo not match all specified subsystems are triggered.
-a, --attr-match=ATTRIBUTE=VALUE Trigger events for devices with a matching sysfs attribute. If a value is specified along with the attribute name, the content of the attribute is matched against the given value using shell style pattern matching. If no value is specified, the existence of the sysfs attribute is checked. When this option is specified multiple times, then each matching result is ANDed, that is, only devices which have all specified attributes are triggered.
-A, --attr-nomatch=ATTRIBUTE=VALUE Do not trigger events for devices with a matching sysfs attribute. If a value is specified along with the attribute name, the content of the attribute is matched against the given value using shell style pattern matching. If no value is specified, the existence of the sysfs attribute is checked. When this option is specified multiple times, then each matching result is ANDed, that is, only devices which have none of the specified attributes are triggered. -g, --tag-match=PROPERTY Trigger events for devices with a matching tag. When this option is specified multiple times, then each matching result is ANDed, that is, devices which have all specified tags are triggered.
-y, --sysname-match=NAME Trigger events for devices forwhich the last component (i.e. the filename) of the /sys path matches the specified PATH. This option supports shell style pattern matching. When this option is specified more than once, then each matching result is ORed, that is, all devices which have any of the specified NAME are triggered.
--name-match=NAME Trigger events for devices with a matching device path. When this option is specified more than once, then each matching result is ORed, that is, all specified devices are triggered.
-b, --parent-match=SYSPATH Trigger events for all children of a given device. When this option is specified more than once, then each matching result is ORed, that is, all children of each specified device are triggered.
-w, --settle Apart from triggering events, also waits for those events to finish. Note that this is different from calling udevadm settle. udevadm settle waits for all events to finish. This option only waits for events triggered by the same command to finish.
--wait-daemon[=SECONDS] Before triggering uevents, waitfor systemd-udevd daemon to be initialized. Optionally takes timeout value. Default timeout is 5 seconds. This is equivalent to invoke invoking udevadm control --ping before udevadm trigger.
settle : 监视udev事件队列,如果所有当前事件都被处理,则退出。
1 2 3 4 5 6
-t, --timeout=SECONDS Maximum number of seconds to waitfor the event queue to become empty. The default value is 120 seconds. A value of 0 will check if the queue is empty and always return immediately.
-E, --exit-if-exists=FILE Stop waiting if file exists.
-e, --exit Signal and waitfor systemd-udevd to exit. No option except for --timeout can be specified after this option. Note that systemd-udevd.service contains Restart=always and so as a result, this option restarts systemd-udevd. If you want to stop systemd-udevd.service, please use the following: systemctl stop systemd-udevd-control.socket systemd-udevd-kernel.socket systemd-udevd.service
-l, --log-priority=value Set the internal log level of systemd-udevd. Valid values are the numerical syslog priorities or their textual representations: emerg, alert, crit, err, warning, notice, info, and debug.
-s, --stop-exec-queue Signal systemd-udevd to stop executing new events. Incoming events will be queued.
-S, --start-exec-queue Signal systemd-udevd to enable the execution of events.
-R, --reload Signal systemd-udevd to reload the rules files and other databases like the kernel module index. Reloading rules and databases does not apply any changes to already existing devices; the new configuration will only be applied to new events.
-p, --property=KEY=value Set a global property for all events.
-m, --children-max=value Set the maximum number of events, systemd-udevd will handle at the same time.
--ping Send a ping message to systemd-udevd and waitfor the reply. This may be useful to check that systemd-udevd daemon is running.
-t, --timeout=seconds The maximum number of seconds to waitfor a reply from systemd-udevd.
-u, --udev Print the udev event after the rule processing.
-p, --property Also print the properties of the event.
-s, --subsystem-match=string[/string] Filter kernel uevents and udev events by subsystem[/devtype]. Only events with a matching subsystem value will pass. When this option is specified more than once, then each matching result is ORed, that is, all devices in the specified subsystems are monitored.
-t, --tag-match=string Filter udev events by tag. Only udev events with a given tag attached will pass. When this option is specified more than once, then each matching result is ORed, that is, devices which have one of the specified tags are monitored.
test :针对一个设备,在不需要 uevent 触发的情况下模拟一次 udev的运行,并输出查询规则文件的过程、所执行的行为、规则文件的执行结果。
1 2 3 4 5 6 7
-a, --action=ACTION Type of event to be simulated. Possible actions are "add", "remove", "change", "move", "online", "offline", "bind", and "unbind". Also, the special value "help" can be used to list the possible actions. The default value is "add".
-N, --resolve-names=early|late|never Specify when udevadm should resolve names of users and groups. When set to early (the default), names will be resolved when the rules are parsed. When set to late, names will be resolved for every event. When set to never, names will never be resolved and all devices will be owned by root.
方式1.请访问本博主的B站【WeiyiGeek】首页关注UP主, 将自动随机获取解锁验证码。
Method 2.Please visit 【My Twitter】. There is an article verification code in the homepage.
方式3.扫一扫下方二维码,关注本站官方公众号
回复:验证码
将获取解锁(有效期7天)本站所有技术文章哟!