Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision | Next revisionBoth sides next revision | ||
| zh:docs:guide-user:base-system:hotplug [2019/04/09 09:14] – [usb 文件夹] czhongm | zh:docs:guide-user:base-system:hotplug [2019/04/09 09:28] – [示例] czhongm | ||
|---|---|---|---|
| Line 123: | Line 123: | ||
| === 符号链接代替设备重命名 === | === 符号链接代替设备重命名 === | ||
| - | An other script to create a symlink instead of renaming the device.\\ | + | 另一个用于创建符号链接而不是重命名设备的脚本。\\ |
| - | I test if DEVICE_NAME is empty because when I plug usb device I retrieve two add event, and the first come before created device, so symlink fails. | + | 因为当我插入一个usb设备时会收到2个add事件,而为了确保在创建符号链接前设备已经创建,我在这里增加了一个判断DEVICE_NAME是否为空. |
| <code bash> | <code bash> | ||
| cat << " | cat << " | ||
| Line 154: | Line 154: | ||
| </ | </ | ||
| - | === Script that detects if plugged | + | === 检测插入的usb设备是否蓝牙的脚本 |
| <code bash> | <code bash> | ||
| Line 181: | Line 181: | ||
| </ | </ | ||
| - | === Auto start mjpg-streamer | + | === 当usb摄像头插入时自动启动mjpg-streamer === |
| <code bash> | <code bash> | ||
| cat << " | cat << " | ||
| Line 197: | Line 197: | ||
| </ | </ | ||
| - | === Custom automount script for xfs === | + | === xfs的自定义自动挂载脚本 |
| <code bash> | <code bash> | ||
| cat << " | cat << " | ||
| - | # if a new block device is connected | + | # 如果新的block设备已连接 |
| if [ " | if [ " | ||
| - | # getting device | + | # 获取设备 |
| detected_uuid=$( xfs_admin -u / | detected_uuid=$( xfs_admin -u / | ||
| - | # deciding mountpoint for known UUID | + | # 确定已知UUID的挂载点 |
| mountpoint="" | mountpoint="" | ||
| case " | case " | ||
| Line 215: | Line 215: | ||
| esac | esac | ||
| - | # | + | # |
| if [ " | if [ " | ||
| mount / | mount / | ||
| fi | fi | ||
| fi | fi | ||
| - | # unmounting happens automatically at device disconnection anyway so no logic for that | + | # 无论如何,卸载在设备断开时自动发生,因此没有逻辑操作 |
| EOF | EOF | ||
| </ | </ | ||