microchip-pic-avr-tools / pyedbglib

Low-level protocol library for communicating with Microchip CMSIS-DAP based debuggers
MIT License
12 stars 4 forks source link

correct udev rules example in pypi.md #8

Open fulminemizzega opened 4 months ago

fulminemizzega commented 4 months ago

Hello, I've tried the udev rules documented in pypi.md, they are not working for me (under WSL2 - ubuntu 22.04, device is ATtiny817 Xplained Mini). They seem to be too specific, the device attribute SUBSYSTEM is not "usb":

udevadm info --attribute-walk --path=$(udevadm info --query=path --name=/dev/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/vhci_hcd.0/usb1/1-1/1-1:1.1/tty/ttyACM0':
    KERNEL=="ttyACM0"
    SUBSYSTEM=="tty"
    DRIVER==""

  looking at parent device '/devices/platform/vhci_hcd.0/usb1/1-1/1-1:1.1':
    KERNELS=="1-1:1.1"
    SUBSYSTEMS=="usb"
    DRIVERS=="cdc_acm"
    ATTRS{authorized}=="1"
    ATTRS{bAlternateSetting}==" 0"
    ATTRS{bInterfaceClass}=="02"
    ATTRS{bInterfaceNumber}=="01"
    ATTRS{bInterfaceProtocol}=="01"
    ATTRS{bInterfaceSubClass}=="02"
    ATTRS{bNumEndpoints}=="01"
    ATTRS{bmCapabilities}=="6"
    ATTRS{iad_bFirstInterface}=="01"
    ATTRS{iad_bFunctionClass}=="02"
    ATTRS{iad_bFunctionProtocol}=="01"
    ATTRS{iad_bFunctionSubClass}=="02"
    ATTRS{iad_bInterfaceCount}=="02"
    ATTRS{supports_autosuspend}=="0"

  looking at parent device '/devices/platform/vhci_hcd.0/usb1/1-1':
    KERNELS=="1-1"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{authorized}=="1"
    ATTRS{avoid_reset_quirk}=="0"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{bDeviceClass}=="ef"
    ATTRS{bDeviceProtocol}=="01"
    ATTRS{bDeviceSubClass}=="02"
    ATTRS{bMaxPacketSize0}=="32"
    ATTRS{bMaxPower}=="100mA"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{bNumInterfaces}==" 3"
    ATTRS{bcdDevice}=="1000"
    ATTRS{bmAttributes}=="80"
    ATTRS{busnum}=="1"
    ATTRS{configuration}==""
    ATTRS{devnum}=="5"
    ATTRS{devpath}=="1"
    ATTRS{idProduct}=="2145"
    ATTRS{idVendor}=="03eb"
    ATTRS{ltm_capable}=="no"
    ATTRS{manufacturer}=="ATMEL"
    ATTRS{maxchild}=="0"
    ATTRS{product}=="mEDBG CMSIS-DAP"
    ATTRS{quirks}=="0x0"
    ATTRS{removable}=="unknown"
    ATTRS{rx_lanes}=="1"
    ATTRS{serial}=="ATML2658061800009405"
    ATTRS{speed}=="12"
    ATTRS{tx_lanes}=="1"
    ATTRS{urbnum}=="17"
    ATTRS{version}==" 2.00"

  looking at parent device '/devices/platform/vhci_hcd.0/usb1':
    KERNELS=="usb1"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{authorized}=="1"
    ATTRS{authorized_default}=="1"
    ATTRS{avoid_reset_quirk}=="0"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{bDeviceClass}=="09"
    ATTRS{bDeviceProtocol}=="01"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{bMaxPacketSize0}=="64"
    ATTRS{bMaxPower}=="0mA"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{bNumInterfaces}==" 1"
    ATTRS{bcdDevice}=="0515"
    ATTRS{bmAttributes}=="e0"
    ATTRS{busnum}=="1"
    ATTRS{configuration}==""
    ATTRS{devnum}=="1"
    ATTRS{devpath}=="0"
    ATTRS{idProduct}=="0002"
    ATTRS{idVendor}=="1d6b"
    ATTRS{interface_authorized_default}=="1"
    ATTRS{ltm_capable}=="no"
    ATTRS{manufacturer}=="Linux 5.15.153.1-microsoft-standard-WSL2 vhci_hcd"
    ATTRS{maxchild}=="8"
    ATTRS{product}=="USB/IP Virtual Host Controller"
    ATTRS{quirks}=="0x0"
    ATTRS{removable}=="unknown"
    ATTRS{rx_lanes}=="1"
    ATTRS{serial}=="vhci_hcd.0"
    ATTRS{speed}=="480"
    ATTRS{tx_lanes}=="1"
    ATTRS{urbnum}=="133"
    ATTRS{version}==" 2.00"

  looking at parent device '/devices/platform/vhci_hcd.0':
    KERNELS=="vhci_hcd.0"
    SUBSYSTEMS=="platform"
    DRIVERS=="vhci_hcd"
    ATTRS{driver_override}=="(null)"
    ATTRS{nports}=="16"
    ATTRS{usbip_debug}=="0"

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

The same command can be repeated for /dev/hidraw0 and /dev/usb/hiddev0 (that respectively have SUBSYSTEM=hidraw and SUBSYSTEM=usbmisc). The rules instead match with attribute SUBSYSTEMS (replacing SUBSYSTEM), because it is in a parent. The change in this PR adds "S" to the example rules.