差别
这里会显示出您选择的修订版和当前版本之间的差别。
两侧同时换到之前的修订记录 前一修订版 后一修订版 | 前一修订版 | ||
public:it:linux:udev [2023/11/30 13:12] – oakfire | public:it:linux:udev [2023/12/25 15:38] (当前版本) – oakfire | ||
---|---|---|---|
行 4: | 行 4: | ||
- `KERNEL / SUBSYSTEM / DRIVER / ATTR` 只匹配本设备不匹配父设备. | - `KERNEL / SUBSYSTEM / DRIVER / ATTR` 只匹配本设备不匹配父设备. | ||
- 字符匹配: | - 字符匹配: | ||
- | ``` | + | ```bash |
* - match any character, zero or more times | * - match any character, zero or more times | ||
? - match any character exactly once | ? - match any character exactly once | ||
行 10: | 行 10: | ||
``` | ``` | ||
- 替换符 | - 替换符 | ||
- | ``` | + | |
- | $kernel, %k: 设备的内核设备名称,例如:sda、cdrom。 | + | ```bash |
- | $number, %n: 设备的内核号码,例如:sda3 的内核号码是 | + | $kernel, %k The kernel name for this device. |
- | $devpath, %p: 设备的 | + | $number, %n The kernel number for this device. For example, "sda3" has kernel number |
- | $id, %b: 设备在 | + | $devpath, %p The devpath |
- | $sysfs{file}, %s{file}: | + | $id, %b The name of the device matched while searching the devpath |
- | $env{key}, %E{key}: 一个环境变量的值。 | + | $driver The driver name of the device matched while searching the devpath upwards for SUBSYSTEMS, KERNELS, DRIVERS, and ATTRS. |
- | $major, %M: 设备的 major 号。 | + | $attr{file}, %s{file} The value of a sysfs attribute found at the device where all keys of the rule have matched. If the matching |
- | $minor %m: 设备的 minor 号。 | + | device does not have such an attribute, and a previous KERNELS, SUBSYSTEMS, DRIVERS, or ATTRS test selected a |
- | $result, %c: PROGRAM 返回的结果。 | + | parent |
- | $parent, | + | If the attribute is a symlink, the last element of the symlink target is returned as the value. |
- | $root, %r: | + | %%: 符号 % 本身。 |
- | $tempnode, %N: 临时设备名。 | + | $$: 符号 $ 本身。 |
- | %%: 符号 % 本身。 | + | |
- | $$: 符号 $ 本身。 | + | |
``` | ``` | ||
- 获取设备信息: | - 获取设备信息: | ||
行 35: | 行 33: | ||
- 或者 `udevadm control -R` | - 或者 `udevadm control -R` | ||
- `NAME=` 只对网路设备起作用 | - `NAME=` 只对网路设备起作用 | ||
- | ``` | + | ```bash |
NAME | NAME | ||
The name to use for a network interface. See | The name to use for a network interface. See | ||
行 46: | 行 44: | ||
## 示例 | ## 示例 | ||
- ubuntu默认的usb storage mount 规则 `/ | - ubuntu默认的usb storage mount 规则 `/ | ||
- | ``` | + | ```bash |
KERNEL!=" | KERNEL!=" | ||
ACTION==" | ACTION==" | ||
行 56: | 行 54: | ||
- 指定类型 | - 指定类型 | ||
- | ``` | + | ```bash |
ACTION==" | ACTION==" | ||
``` | ``` | ||
</ | </ |