Udev规则未被应用

时间:2015-02-11 22:48:21

标签: android linux arduino udev chroot

我正在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 info --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”)。

1 个答案:

答案 0 :(得分:0)

事实证明我只需要做“服务udev重启”,突然间它开始工作了。以前我尝试过“udevadm control --reload-rules”,“udevadm control --reload”,“udevadm control trigger”,然后重新启动系统,但都没有。