Eu quero alterar o nome do nó do dispositivo e a propriedade quando eu conectar a placa STM32F4
no meu laptop.
Estes são os passos que segui:
1- Para obter as informações sobre o dispositivo ( link )
udevadm info -a -p $(udevadm info -q path -n /dev/bus/usb/001/005)
O resultado é:
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:14.0/usb1/1-2':
KERNEL=="1-2"
SUBSYSTEM=="usb"
DRIVER=="usb"
ATTR{bDeviceSubClass}=="00"
ATTR{bDeviceProtocol}=="00"
ATTR{devpath}=="2"
ATTR{idVendor}=="0483"
ATTR{speed}=="12"
ATTR{bNumInterfaces}==" 1"
ATTR{bConfigurationValue}=="1"
ATTR{bMaxPacketSize0}=="64"
ATTR{busnum}=="1"
ATTR{devnum}=="5"
ATTR{configuration}==""
ATTR{bMaxPower}=="100mA"
ATTR{authorized}=="1"
ATTR{bmAttributes}=="80"
ATTR{bNumConfigurations}=="1"
ATTR{maxchild}=="0"
ATTR{bcdDevice}=="0100"
ATTR{avoid_reset_quirk}=="0"
ATTR{quirks}=="0x0"
ATTR{version}==" 2.00"
ATTR{urbnum}=="13"
ATTR{ltm_capable}=="no"
ATTR{manufacturer}=="STMicroelectronics"
ATTR{removable}=="removable"
ATTR{idProduct}=="3748"
ATTR{bDeviceClass}=="00"
ATTR{product}=="STM32 STLink"
looking at parent device '/devices/pci0000:00/0000:00:14.0/usb1':
KERNELS=="usb1"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{bDeviceSubClass}=="00"
ATTRS{bDeviceProtocol}=="01"
ATTRS{devpath}=="0"
ATTRS{idVendor}=="1d6b"
ATTRS{speed}=="480"
ATTRS{bNumInterfaces}==" 1"
ATTRS{bConfigurationValue}=="1"
ATTRS{bMaxPacketSize0}=="64"
ATTRS{authorized_default}=="1"
ATTRS{busnum}=="1"
ATTRS{devnum}=="1"
ATTRS{configuration}==""
ATTRS{bMaxPower}=="0mA"
ATTRS{authorized}=="1"
ATTRS{bmAttributes}=="e0"
ATTRS{bNumConfigurations}=="1"
ATTRS{maxchild}=="4"
ATTRS{bcdDevice}=="0402"
ATTRS{avoid_reset_quirk}=="0"
ATTRS{quirks}=="0x0"
ATTRS{serial}=="0000:00:14.0"
ATTRS{version}==" 2.00"
ATTRS{urbnum}=="85"
ATTRS{ltm_capable}=="no"
ATTRS{manufacturer}=="Linux 4.2.0-42-generic xhci-hcd"
ATTRS{removable}=="unknown"
ATTRS{idProduct}=="0002"
ATTRS{bDeviceClass}=="09"
ATTRS{product}=="xHCI Host Controller"
looking at parent device '/devices/pci0000:00/0000:00:14.0':
KERNELS=="0000:00:14.0"
SUBSYSTEMS=="pci"
DRIVERS=="xhci_hcd"
ATTRS{irq}=="25"
ATTRS{subsystem_vendor}=="0x1179"
ATTRS{broken_parity_status}=="0"
ATTRS{class}=="0x0c0330"
ATTRS{driver_override}=="(null)"
ATTRS{consistent_dma_mask_bits}=="64"
ATTRS{dma_mask_bits}=="64"
ATTRS{local_cpus}=="0f"
ATTRS{device}=="0x1e31"
ATTRS{enable}=="1"
ATTRS{msi_bus}=="1"
ATTRS{local_cpulist}=="0-3"
ATTRS{vendor}=="0x8086"
ATTRS{subsystem_device}=="0xfb31"
ATTRS{numa_node}=="-1"
ATTRS{d3cold_allowed}=="1"
looking at parent device '/devices/pci0000:00':
KERNELS=="pci0000:00"
SUBSYSTEMS==""
DRIVERS==""
2- Adicionei a regra em etc/udev/rules.d/10-locales.rules
:
KERNEL=="1-2", SUBSYSTEM=="usb", ATTR{manufacturer}=="STMicroelectronics", MODE="0666", NAME="STM32_board"
3- reiniciou o serviço do udev:
sudo serivce udev restart
Eu estava esperando por um nó de dispositivo / dev / STM32_board criado quando eu conectei o dispositivo, mas ele não foi criado, alterando =
com :=
nas chaves de atribuição não resolve o problema.
Você poderia, por favor, ajudar
Tags udev usb-device linux