직렬 USB가 표시되지 않음(Udev 문제 해결)

직렬 USB가 표시되지 않음(Udev 문제 해결)

USBtiny 기반 AVR 프로그래머를 위한 udev 규칙을 작성하려고 합니다. 젠투가 아닌 다른 시스템에서는 USB 장치가 에 표시됩니다 /dev/ttyUSB0. 나는 그것이 내 시스템에 비슷한 것으로 나타날 것으로 기대합니다 /dev/ttyACM0.

USB-직렬 변환기를 연결할 수 있고 /dev/ttyUSB0.

이것은 eudev가 설치된 최신 Gentoo openrc 시스템입니다.

"udevadm monitor"를 실행할 때 장치를 연결하면 다음이 발생하는 것을 볼 수 있습니다.

KERNEL[1859.422447] add      /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1 (usb)
KERNEL[1859.422777] add      /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1:1.0 (usb)
KERNEL[1859.423050] bind     /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1 (usb)
UDEV  [1859.990399] add      /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1 (usb)
UDEV  [1859.991792] add      /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1:1.0 (usb)
UDEV  [1859.996016] bind     /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1 (usb)

나는 "/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1"을 잡고 정보를 확인했습니다.

% udevadm info -a -p /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1                                   

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/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1':
    KERNEL=="1-1.1"
    SUBSYSTEM=="usb"
    DRIVER=="usb"
    ATTR{configuration}==""
    ATTR{bMaxPacketSize0}=="8"
    ATTR{bDeviceClass}=="ff"
    ATTR{bcdDevice}=="0105"
    ATTR{bNumInterfaces}==" 1"
    ATTR{bConfigurationValue}=="1"
    ATTR{manufacturer}=="Adafruit"
    ATTR{bNumConfigurations}=="1"
    ATTR{authorized}=="1"
    ATTR{speed}=="1.5"
    ATTR{idProduct}=="0c9f"
    ATTR{urbnum}=="9"
    ATTR{devnum}=="6"
    ATTR{product}=="USBtiny"
    ATTR{maxchild}=="0"
    ATTR{bmAttributes}=="80"
    ATTR{bDeviceSubClass}=="00"
    ATTR{bMaxPower}=="100mA"
    ATTR{rx_lanes}=="1"
    ATTR{removable}=="removable"
    ATTR{idVendor}=="1781"
    ATTR{version}==" 1.10"
    ATTR{avoid_reset_quirk}=="0"
    ATTR{bDeviceProtocol}=="00"
    ATTR{tx_lanes}=="1"
    ATTR{ltm_capable}=="no"
    ATTR{devpath}=="1.1"
    ATTR{busnum}=="1"
    ATTR{quirks}=="0x0"

  looking at parent device '/devices/pci0000:00/0000:00:1a.0/usb1/1-1':
    KERNELS=="1-1"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{configuration}==""
    ATTRS{bMaxPacketSize0}=="64"
    ATTRS{bDeviceClass}=="09"
    ATTRS{bcdDevice}=="0000"
    ATTRS{bNumInterfaces}==" 1"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{authorized}=="1"
    ATTRS{speed}=="480"
    ATTRS{idProduct}=="0020"
    ATTRS{urbnum}=="193"
    ATTRS{devnum}=="2"
    ATTRS{maxchild}=="6"
    ATTRS{bmAttributes}=="e0"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{bMaxPower}=="0mA"
    ATTRS{rx_lanes}=="1"
    ATTRS{removable}=="fixed"
    ATTRS{idVendor}=="8087"
    ATTRS{version}==" 2.00"
    ATTRS{avoid_reset_quirk}=="0"
    ATTRS{bDeviceProtocol}=="01"
    ATTRS{tx_lanes}=="1"
    ATTRS{ltm_capable}=="no"
    ATTRS{devpath}=="1"
    ATTRS{busnum}=="1"
    ATTRS{quirks}=="0x0"

  looking at parent device '/devices/pci0000:00/0000:00:1a.0/usb1':
    KERNELS=="usb1"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{configuration}==""
    ATTRS{bMaxPacketSize0}=="64"
    ATTRS{bDeviceClass}=="09"
    ATTRS{bcdDevice}=="0505"
    ATTRS{bNumInterfaces}==" 1"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{manufacturer}=="Linux 5.5.1-gentoo ehci_hcd"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{authorized}=="1"
    ATTRS{speed}=="480"
    ATTRS{idProduct}=="0002"
    ATTRS{urbnum}=="134"
    ATTRS{devnum}=="1"
    ATTRS{product}=="EHCI Host Controller"
    ATTRS{maxchild}=="3"
    ATTRS{bmAttributes}=="e0"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{bMaxPower}=="0mA"
    ATTRS{rx_lanes}=="1"
    ATTRS{removable}=="unknown"
    ATTRS{idVendor}=="1d6b"
    ATTRS{interface_authorized_default}=="1"
    ATTRS{authorized_default}=="1"
    ATTRS{version}==" 2.00"
    ATTRS{avoid_reset_quirk}=="0"
    ATTRS{serial}=="0000:00:1a.0"
    ATTRS{bDeviceProtocol}=="00"
    ATTRS{tx_lanes}=="1"
    ATTRS{ltm_capable}=="no"
    ATTRS{devpath}=="0"
    ATTRS{busnum}=="1"
    ATTRS{quirks}=="0x0"

  looking at parent device '/devices/pci0000:00/0000:00:1a.0':
    KERNELS=="0000:00:1a.0"
    SUBSYSTEMS=="pci"
    DRIVERS=="ehci-pci"
    ATTRS{broken_parity_status}=="0"
    ATTRS{subsystem_device}=="0x2163"
    ATTRS{dma_mask_bits}=="32"
    ATTRS{vendor}=="0x8086"
    ATTRS{local_cpus}=="f"
    ATTRS{companion}==""
    ATTRS{class}=="0x0c0320"
    ATTRS{numa_node}=="-1"
    ATTRS{msi_bus}=="1"
    ATTRS{device}=="0x3b3c"
    ATTRS{local_cpulist}=="0-3"
    ATTRS{driver_override}=="(null)"
    ATTRS{d3cold_allowed}=="1"
    ATTRS{irq}=="23"
    ATTRS{revision}=="0x06"
    ATTRS{consistent_dma_mask_bits}=="32"
    ATTRS{ari_enabled}=="0"
    ATTRS{uframe_periodic_max}=="100"
    ATTRS{enable}=="1"
    ATTRS{subsystem_vendor}=="0x17aa"

  looking at parent device '/devices/pci0000:00':
    KERNELS=="pci0000:00"
    SUBSYSTEMS==""
    DRIVERS==""

그렇다면 다음 udev 규칙이 작동할 것 같습니다:

# /etc/udev/rules.d/99-usbtiny.rules
SUBSYSTEM=="usb", ATTR{manufacturer}=="Adafruit", ATTR{product}=="USBtiny", ATTR{idProduct}=="0c9f", ATTR{idVendor}=="1781", MODE="0660", GROUP="plugdev", SYMLINK+="usbtiny%n"

인터넷에서 다른 곳에서 본 것과 똑같습니다. 한 가지 차이점은 idVendor가 ATTRS인 것처럼 보이지만 "udevadm info" 출력의 상위 노드 속성이 아니라는 것입니다.

규칙을 다시 로드하는 프로세스는 "udevadm control -R"을 실행하는 것이었습니다. 또한 udev "/etc/init.d/udev restart"를 다시 시작하고 재부팅을 시도했습니다. 장치는 /dev/ 아래에 항목을 만들지 않습니다. udev 규칙의 "SYMLINK" 부분 없이 위의 모든 작업을 시도했습니다.

lsusb를 사용하여 장치를 볼 수 있습니다.

 % lsusb                                                                                                             
Bus 002 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 006: ID 1781:0c9f Multiple Vendors USBtiny

커널이 dmesg의 꼬리에서도 이를 볼 수 있다는 것을 알고 있습니다.

[ 1859.351137] usb 1-1.1: new low-speed USB device number 6 using ehci-pci
[ 1859.440168] usb 1-1.1: New USB device found, idVendor=1781, idProduct=0c9f, bcdDevice= 1.05
[ 1859.440172] usb 1-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 1859.440175] usb 1-1.1: Product: USBtiny
[ 1859.440177] usb 1-1.1: Manufacturer: Adafruit

다른 문제 해결 팁이 있는 사람이 있나요? 내가 말했듯이, 내가 가지고 있는 USB 직렬 변환기는 /dev/ 아래에 장치로 등록되어 있으며 "udevadm monitor" 출력에서 ​​제대로 볼 수 있습니다. 나는 작은 것을 놓친 것 같은 느낌이 들었고 며칠 동안 이것에 대해 머리를 두드렸다. 어떤 조언이라도 감사하겠습니다.

또한 커널에 모든 직렬 USB 드라이버가 내장되어 있습니다.

  --- USB Serial Converter support
[*]   USB Serial Console device support
[*]   USB Generic Serial Driver
<*>   USB Serial Simple Driver
<*>   USB AIRcable Bluetooth Dongle Driver
<*>   USB ARK Micro 3116 USB Serial Driver
<*>   USB Belkin and Peracom Single Port Serial Driver
<*>   USB Winchiphead CH341 Single Port Serial Driver
<*>   USB ConnectTech WhiteHEAT Serial Driver
<*>   USB Digi International AccelePort USB Serial Driver
<*>   USB CP210x family of UART Bridge Controllers
<*>   USB Cypress M8 USB Serial Driver
<*>   USB Empeg empeg-car Mark I/II Driver
<*>   USB FTDI Single Port Serial Driver
<*>   USB Handspring Visor / Palm m50x / Sony Clie Driver
<*>   USB PocketPC PDA Driver
<*>   USB IR Dongle Serial Driver
<*>   USB Inside Out Edgeport Serial Driver
<*>   USB Inside Out Edgeport Serial Driver (TI device
<*>   USB Fintek F81232 Single Port Serial Driver
<*>   USB Fintek F81532/534 Multi-Ports Serial Driver
<*>   USB Garmin GPS driver
<*>   USB IPWireless (3G UMTS TDD) Driver
<*>   USB Infinity USB Unlimited Phoenix Driver
<*>   USB Keyspan PDA Single Port Serial Driver
<*>   USB Keyspan USA-xxx Serial Driver
<*>   USB KL5KUSB105 (Palmconnect) Driver
<*>   USB KOBIL chipcard reader
<*>   USB MCT Single Port Serial Driver
<*>   USB Metrologic Instruments USB-POS Barcode Scanner Driver
<*>   USB Moschip 7720 Serial Driver
<*>   USB Moschip 7840/7820 USB Serial Driver
<*>   USB Moxa UPORT Serial Driver
<*>   USB Navman GPS device
<*>   USB Prolific 2303 Single Port Serial Driver
<*>   USB Ours Technology Inc. OTi-6858 USB To RS232 Bridge Controller
<*>   USB Qualcomm Auxiliary Serial Port Driver
<*>   USB Qualcomm Serial modem
<*>   USB SPCP8x5 USB To Serial Driver
<*>   USB Safe Serial (Encapsulated) Driver
  [ ]     USB Secure Encapsulated Driver - Padded
<*>   USB Sierra Wireless Driver
<*>   USB Symbol Barcode driver (serial mode
<*>   USB TI 3410/5052 Serial Driver
<*>   USB REINER SCT cyberJack pinpad/e-com chipcard reader
<*>   USB Xircom / Entrega Single Port Serial Driver
<*>   USB driver for GSM and CDMA modems
<*>   USB ZyXEL omni.net LCD Plus Driver
<*>   USB Opticon Barcode driver (serial mode)
<*>   Xsens motion tracker serial interface driver
<*>   USB-Wishbone adapter interface driver
<*>   USB Quatech SSU-100 Single Port Serial Driver
<*>   USB Quatech Serial Driver for USB 2 devices
<*>   USB Renesas uPD78F0730 Single Port Serial Driver
<*>   USB Debugging Device

여기에서 몇 가지 다른 질문을 살펴봤지만 /dev/.

이를 위해 내가 겪은 주요 리소스는 다음과 같습니다.

답변1

모든 USB 장치가 직렬 포트와 유사한 장치로 표시되는 것은 아닙니다. 특히 USBtinyISP는 직렬 포트를 전혀 에뮬레이트하지 않고 libusb기본 USB 통신을 통해 액세스됩니다.

또한 Adafruit의 USBtinyISP도 있는데, USB 공급업체 및 제품 ID는 각각 0x1781 및 0x0c9f입니다. 그것은 생산 도 장치 /dev/ttyUSB*도 하지 않을 /dev/ttyACM*것이지만 avrdude그것과 잘 통신할 것입니다.

Bus 001 Device 006: ID 1781:0c9f Multiple Vendors USBtiny

귀하의 경우 USBtinyISP는 버스 1, 장치 6에서 감지되었으므로 libusb장치와 통신하는 데 사용되는 장치 노드는 입니다 /dev/bus/usb/001/006. udev 규칙이 이미 해당 장치에 적용되고 있을 수 있습니다.

또한 적어도 Debian에서는 avrdude패키지에 이미 udev 규칙 파일이 포함되어 있습니다. /lib/udev/rules.d/60-avrdude.rules시스템 기본 udev 규칙 파일과 마찬가지로 설치되며 /etc/udev/rules.d로컬 사용자 정의/재정의만 가능합니다. 해당 파일에는 이미 USBtinyISP가 포함되어 있습니다.

기본적으로 USBtinyISP를 사용하도록 지시하려면 다음 줄을 포함하는 파일을 직접 avrdude생성할 수 있습니다 .~/.avrduderc

default_programmer = "usbtiny";

그러면 모든 avrdude명령줄에서 프로그래머 유형을 지정해야 하는 요구 사항이 제거됩니다.

답변2

당신은 언급 ATTR{idVendor}하고 유사합니다. 그래야 할까요 ATTRS{...}? 나는 또한 최소한의 규칙이 더 낫다는 것을 발견했습니다.

예를 들어 Debian 시스템에는 다음이 있습니다.

% cat /etc/udev/rules.d/ols.rules               
#Rules for Openbench Logix Snifferslogic. Creates a nice link to the ols
ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="fc92", MODE="0666", SYMLINK+="OpenLogicSniffer"

그래서 나는 다음을 시도할 것이다:

ATTRS{idVendor}=="1781", ATTRS{idProduct}=="0c9f", MODE="0660", GROUP="plugdev", SYMLINK+="usbtiny%n"

답변3

MODE="0660" 대신 MODE="0666"을 사용해야 한다고 생각합니다.

관련 정보