我在Android设备上运行Linux chroot环境,并且尝试与基于Atmel atmega2560(源自Arduino Mega的微控制器)的微控制器进行通信。进行“ ls -ld / dev / ttyACM0”将显示调制解调器的以下权限:
crw------- 1 root root 166, 0 Feb 11 22:28 /dev/ttyACM0
“ lsusb”告诉我:
Bus 003 Devices: ID 03eb:204b Atmel Corp. LUFA USB to Serial Adpater Project
“ udevadm信息--attribute-walk --name = ttyACM0”说:
Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.
looking at device '/devices/platform/sunxi_hcd_host0/usb3/3-1/3-1:1.0/tty/ttyACM0':
KERNEL=="ttyACM0"
SUBSYSTEM=="tty"
DRIVER==""
looking at parent device '/devices/platform/sunxi_hcd_host0/usb3/3-1/3-1:1.0':
KERNELS=="3-1:1.0"
SUBSYSTEMS=="usb"
DRIVERS=="cdc_acm"
ATTRS{bInterfaceClass}=="02"
ATTRS{bmCapabilities}=="6"
ATTRS{bInterfaceSubClass}=="02"
ATTRS{bInterfaceProtocol}=="01"
ATTRS{bNumEndpoints}=="01"
ATTRS{supports_autosuspend}=="1"
ATTRS{bAlternateSetting}==" 0"
ATTRS{bInterfaceNumber}=="00"
looking at parent device '/devices/platform/sunxi_hcd_host0/usb3/3-1':
KERNELS=="3-1"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{bDeviceSubClass}=="00"
ATTRS{bDeviceProtocol}=="00"
ATTRS{devpath}=="1"
ATTRS{idVendor}=="03eb"
ATTRS{speed}=="12"
ATTRS{bNumInterfaces}==" 2"
ATTRS{bConfigurationValue}=="1"
ATTRS{bMaxPacketSize0}=="8"
ATTRS{busnum}=="3"
ATTRS{devnum}=="20"
ATTRS{configuration}==""
ATTRS{bMaxPower}=="200mA"
ATTRS{authorized}=="1"
ATTRS{bmAttributes}=="c0"
ATTRS{bNumConfigurations}=="1"
ATTRS{maxchild}=="0"
ATTRS{bcdDevice}=="8888"
ATTRS{avoid_reset_quirk}=="0"
ATTRS{quirks}=="0x0"
ATTRS{serial}=="55330343534351415012"
ATTRS{version}==" 1.10"
ATTRS{urbnum}=="12"
ATTRS{manufacturer}=="RRD (www.ru"
ATTRS{removable}=="unknown"
ATTRS{idProduct}=="204b"
ATTRS{bDeviceClass}=="02"
ATTRS{product}=="RUMBA - ATmega 2560 co"
looking at parent device '/devices/platform/sunxi_hcd_host0/usb3':
KERNELS=="usb3"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{bDeviceSubClass}=="00"
ATTRS{bDeviceProtocol}=="00"
ATTRS{devpath}=="0"
ATTRS{idVendor}=="1d6b"
ATTRS{speed}=="12"
ATTRS{bNumInterfaces}==" 1"
ATTRS{bConfigurationValue}=="1"
ATTRS{bMaxPacketSize0}=="64"
ATTRS{authorized_default}=="1"
ATTRS{busnum}=="3"
ATTRS{devnum}=="1"
ATTRS{configuration}==""
ATTRS{bMaxPower}==" 0mA"
ATTRS{authorized}=="1"
ATTRS{bmAttributes}=="e0"
ATTRS{bNumConfigurations}=="1"
ATTRS{maxchild}=="1"
ATTRS{bcdDevice}=="0304"
ATTRS{avoid_reset_quirk}=="0"
ATTRS{quirks}=="0x0"
ATTRS{serial}=="sunxi_hcd_host0"
ATTRS{version}==" 1.10"
ATTRS{urbnum}=="777"
ATTRS{manufacturer}=="Linux 3.4.39 sunxi_hcd-hcd"
ATTRS{removable}=="unknown"
ATTRS{idProduct}=="0001"
ATTRS{bDeviceClass}=="09"
ATTRS{product}=="sunxi_hcd host driver"
looking at parent device '/devices/platform/sunxi_hcd_host0':
KERNELS=="sunxi_hcd_host0"
SUBSYSTEMS=="platform"
DRIVERS=="sunxi_hcd_host0"
looking at parent device '/devices/platform':
KERNELS=="platform"
SUBSYSTEMS==""
DRIVERS==""
因此,我创建了文件“ /etc/udev/rules.d/99-arduino.rules”,其中包含:
SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="204b", MODE:="0666"
试图允许我的用户具有读/写权限。我不能仅以root权限运行我的应用程序,我需要ttyACM *的所有权(请注意,我也尝试过OWNER =“ myusername”而不是MODE:=“ 0666”)。
最佳答案
事实证明,我只需要执行“ service udev restart”,就突然开始工作了。以前,我尝试过“ udevadm控制--reload-rules”,“ udevadm控制--reload”,“ udevadm控制触发器”,然后重新启动系统,但没有一个起作用。
关于android - 未应用Udev规则,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/28466059/