1
0
Fork 2
RobotKernal-UESTC/Docs/Linux开发板遇到问题和解决方案/USBHID权限问题.md

29 lines
893 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#### USBHID非root用户在linux下无权限问题
解决需要设置udev规则来实现。
![image-20240417114720051](C:\Users\李瑞瑞\AppData\Roaming\Typora\typora-user-images\image-20240417114720051.png)
通常情况下udev规则文件的命名规则是按照数字和规则名称的顺序来加载的。数字越小的规则文件会先被加载而数字越大的规则文件会后被加载。因此可以选择一个数字较大的数字作为规则文件的名称以确保在其他规则文件之后加载。
1. 创建规则文件
```bash
sudo gedit /etc/udev/rules.d/99-usb-serial.rules
```
2. 写入规则
```bash
SUBSYSTEM=="usb" ATTRS{idVendor}=="YOUR_VENDOR_ID", ATTRS{idProduct}=="YOUR_PRODUCT_ID", MODE:="0777"
```
3. 重新加载udev规则以使更改生效
```bash
sudo udevadm control --reload-rules
sudo udevadm trigger
```