mma*_*nry 4 permissions hardware usb udev arduino
我很难让 Arduino Tiny AVR 编程器(又名 PMG-11801)在我的 Ubuntu 18.04 笔记本电脑上工作。这是一个 Arduino 设备,可在 Arduino IDE 中对 ATtiny85 芯片进行编程。
我已经阅读了来自不同地方的几篇论坛帖子,并尝试了一种解决方案,该解决方案看起来对许多其他人都有效,但对我来说却不起作用。这就是我所做的。
mmachenry$ lsusb
... other devices ...
Bus 001 Device 013: ID 1781:0c9f Multiple Vendors USBtiny
... other devices ...
Run Code Online (Sandbox Code Playgroud)
我记下 1781:0c9f 作为下一步的供应商和产品 ID。
从我发现的各种网页来看,我似乎需要 /etc/udev/rules.d 中的一个条目来允许非 root 用户使用此设备。我添加了它,它看起来像这样:
mmachenry$ cat /etc/udev/rules.d/99-USBtiny.rules
SUBSYSTEM=="usb", ATTR{idVendor}=="1781", ATTR{idProduct}=="0c9f", GROUP="adm", MODE="0666"
Run Code Online (Sandbox Code Playgroud)
另请注意,我属于正确的组。
mmachenry$ groups
mmachenry adm dialout cdrom sudo dip plugdev docker lpadmin sambashare
Run Code Online (Sandbox Code Playgroud)
为了使其生效,请在创建该规则文件后立即运行这些规则。
sudo service udev restart
sudo udevadm control --reload-rules
Run Code Online (Sandbox Code Playgroud)
根据诺伯特评论的要求,我对我的用户组进行了健全性检查,但似乎没有任何问题,因为没有输出。
mmachenry@mmachenry-laptop:~$ sudo update-passwd --sanity-check --verbose
Run Code Online (Sandbox Code Playgroud)
但是当我运行 avrdude 时,我的权限被拒绝。
mmachenry$ hardware/tools/avr/bin/avrdude -C/home/mmachenry/Downloads/arduino-1.8.5-linux64/arduino-1.8.5/hardware/tools/avr/etc/avrdude.conf -vv -pattiny85 -cusbtiny
avrdude: Version 6.3, compiled on Jan 17 2017 at 11:00:16
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "/home/mmachenry/Downloads/arduino-1.8.5-linux64/arduino-1.8.5/hardware/tools/avr/etc/avrdude.conf"
User configuration file is "/home/mmachenry/.avrduderc"
User configuration file does not exist or is not a regular file, skipping
Using Port : usb
Using Programmer : usbtiny
avrdude: usbdev_open(): Found USBtinyISP, bus:device: 001:013
avrdude: Warning: cannot open USB device: Permission denied
avrdude: Error: Could not find USBtiny device (0x1781/0xc9f)
avrdude done. Thank you.
Run Code Online (Sandbox Code Playgroud)
然而,当使用 sudo 运行命令时,我得到了很多不同的、积极的输出。
sudo hardware/tools/avr/bin/avrdude -C/home/mmachenry/Downloads/arduino-1.8.5-linux64/arduino-1.8.5/hardware/tools/avr/etc/avrdude.conf -vv -pattiny85 -cusbtiny
avrdude: Version 6.3, compiled on Jan 17 2017 at 11:00:16
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "/home/mmachenry/Downloads/arduino-1.8.5-linux64/arduino-1.8.5/hardware/tools/avr/etc/avrdude.conf"
User configuration file is "/home/mmachenry/.avrduderc"
User configuration file does not exist or is not a regular file, skipping
Using Port : usb
Using Programmer : usbtiny
avrdude: usbdev_open(): Found USBtinyISP, bus:device: 001:013
AVR Part : ATtiny85
Chip Erase delay : 400000 us
PAGEL : P00
BS2 : P00
RESET disposition : possible i/o
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
eeprom 65 12 4 0 no 512 4 0 4000 4500 0xff 0xff
flash 65 6 32 0 yes 8192 64 128 30000 30000 0xff 0xff
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
lock 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
lfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
efuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
Programmer Type : USBtiny
Description : USBtiny simple USB programmer, http://www.ladyada.net/make/usbtinyisp/
avrdude: programmer operation not supported
avrdude: Using SCK period of 10 usec
CMD: [ac 53 00 00] [ac 52 53 00]
avrdude: AVR device initialized and ready to accept instructions
Reading | | 0% 0.00sCMD: [30 00 00 00] [00 30 00 1e]
CMD: [30 00 01 00] [00 30 00 93]
Reading | ################# | 33% 0.00sCMD: [30 00 02 00] [00 30 00 0b]
Reading | ################################################## | 100% 0.00s
avrdude: Device signature = 0x1e930b (probably t85)
CMD: [50 00 00 00] [00 50 00 e2]
CMD: [50 00 00 00] [00 50 00 e2]
CMD: [50 00 00 00] [00 50 00 e2]
CMD: [58 08 00 00] [00 58 08 df]
CMD: [58 08 00 00] [00 58 08 df]
CMD: [58 08 00 00] [00 58 08 df]
avrdude: safemode: hfuse reads as DF
CMD: [50 08 00 00] [00 50 08 ff]
CMD: [50 08 00 00] [00 50 08 ff]
CMD: [50 08 00 00] [00 50 08 ff]
avrdude: safemode: efuse reads as FF
CMD: [50 00 00 00] [00 50 00 e2]
CMD: [50 00 00 00] [00 50 00 e2]
CMD: [50 00 00 00] [00 50 00 e2]
CMD: [58 08 00 00] [00 58 08 df]
CMD: [58 08 00 00] [00 58 08 df]
CMD: [58 08 00 00] [00 58 08 df]
avrdude: safemode: hfuse reads as DF
CMD: [50 08 00 00] [00 50 08 ff]
CMD: [50 08 00 00] [00 50 08 ff]
CMD: [50 08 00 00] [00 50 08 ff]
avrdude: safemode: efuse reads as FF
avrdude: safemode: Fuses OK (E:FF, H:DF, L:E2)
avrdude done. Thank you.
Run Code Online (Sandbox Code Playgroud)
在 Arduino IDE 中运行它具有相同的效果。作为普通用户,我的权限被拒绝。当我以 root 身份运行 IDE 时,它可以正常工作并将我的程序上传到 Arduino。请注意,该设备被识别为 USB 设备,因为它是 usbtinyISP,而不是像某些 Arduino 那样被识别为串行设备。
为什么普通用户访问该设备的权限仍然被拒绝?
谢谢。
确保您的 udev 规则正确:
SUBSYSTEM=="usb", ATTRS{product}=="USBtiny", ATTRS{idProduct}=="0c9f", ATTRS{idVendor}=="1781", MODE="0660", GROUP="dialout"
Run Code Online (Sandbox Code Playgroud)确保刷新 udev:
sudo udevadm control --reload-rules && sudo udevadm trigger
Run Code Online (Sandbox Code Playgroud)确保拔出并重新插入 USB 设备!
最后一个是我花了一些时间才弄清楚的!
| 归档时间: |
|
| 查看次数: |
19109 次 |
| 最近记录: |