WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: persistant rules  (Read 2763 times)

Offline bellad

  • Jr. Member
  • **
  • Posts: 65
persistant rules
« on: June 18, 2015, 05:03:55 AM »
hi,
i've 2 usb serial
after one change eeprom serial ( 0001 to 1740 )
i put in
Code: [Select]
/etc/udev/rules.d/99.persistantusb.rules
Code: [Select]
SUBSYSTEM=="tty", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", ATTRS{serial}=="0001", SYMLINK+="ttyUSB0"
SUBSYSTEM=="tty", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", ATTRS{serial}=="1740", SYMLINK+="ttyUSB1"

but no good ,always :
 serial 0001 = ttyUSB1
and serial 1740 = ttyUSB0


bellad.flnet.org

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: persistant rules
« Reply #1 on: June 18, 2015, 05:30:56 AM »
What is the output of 'udevadem monitor' when you plugin the adapters?
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline bellad

  • Jr. Member
  • **
  • Posts: 65
Re: persistant rules
« Reply #2 on: June 18, 2015, 05:45:35 AM »
Code: [Select]
monitor will print the received events for:
UDEV - the event which udev sends out after rule processing
KERNEL - the kernel uevent

KERNEL[167.560923] add      /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/1-1.3.3 (usb)
UDEV  [167.565360] add      /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/1-1.3.3 (usb)
KERNEL[167.568718] add      /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/1-1.3.3/1-1.3.3:1.0 (usb)
UDEV  [167.571235] add      /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/1-1.3.3/1-1.3.3:1.0 (usb)
KERNEL[167.745585] add      /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/1-1.3.3/1-1.3.3:1.0/ttyUSB0 (usb-serial)
KERNEL[167.746242] add      /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/1-1.3.3/1-1.3.3:1.0/ttyUSB0/tty/ttyUSB0 (tty)
UDEV  [167.750128] add      /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/1-1.3.3/1-1.3.3:1.0/ttyUSB0 (usb-serial)
UDEV  [167.759509] add      /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/1-1.3.3/1-1.3.3:1.0/ttyUSB0/tty/ttyUSB0 (tty)
KERNEL[173.188238] add      /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/1-1.3.4 (usb)
KERNEL[173.193216] add      /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/1-1.3.4/1-1.3.4:1.0 (usb)
KERNEL[173.373352] add      /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/1-1.3.4/1-1.3.4:1.0/ttyUSB1 (usb-serial)
KERNEL[173.374518] add      /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/1-1.3.4/1-1.3.4:1.0/ttyUSB1/tty/ttyUSB1 (tty)
UDEV  [173.378614] add      /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/1-1.3.4 (usb)
UDEV  [173.381459] add      /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/1-1.3.4/1-1.3.4:1.0 (usb)
UDEV  [173.384335] add      /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/1-1.3.4/1-1.3.4:1.0/ttyUSB1 (usb-serial)
UDEV  [173.406067] add      /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/1-1.3.4/1-1.3.4:1.0/ttyUSB1/tty/ttyUSB1 (tty)
bellad.flnet.org

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: persistant rules
« Reply #3 on: June 18, 2015, 12:46:37 PM »
BTW, why do you want to swap the interfaces, why can't accept device names as they are?
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Online Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11591
Re: persistant rules
« Reply #4 on: June 18, 2015, 02:45:25 PM »
Hi bellad
Are you sure that the serial number was changed? See what this says:
Code: [Select]
udevadm info -a -n /dev/ttyUSB0
udevadm info -a -n /dev/ttyUSB1

Offline bellad

  • Jr. Member
  • **
  • Posts: 65
Re: persistant rules
« Reply #5 on: June 23, 2015, 08:04:01 AM »
hello,
i try
Code: [Select]
udevadm info -a -n /dev/ttyUSB0 but RPI crash

with
Code: [Select]
sudo udevadm info --query=all --name=ttyUSB is good

Code: [Select]
tc@box:~$ sudo udevadm info --query=all --name=ttyUSB1
P: /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/1-1.3.4/1-1.3.4:1.0/ttyUSB1/tty/ttyUSB1
N: ttyUSB1
S: serial/by-id/usb-Silicon_Labs_CP2102_USB_to_UART_Bridge_Controller_0001-if00-port0
S: serial/by-path/platform-bcm2708_usb-usb-0:1.3.4:1.0-port0
E: DEVLINKS=/dev/serial/by-id/usb-Silicon_Labs_CP2102_USB_to_UART_Bridge_Controller_0001-if00-port0 /dev/serial/by-path/platform-bcm2708_usb-usb-0:1.3.4:1.0-port0
E: DEVNAME=/dev/ttyUSB1
E: DEVPATH=/devices/platform/bcm2708_usb/usb1/1-1/1-1.3/1-1.3.4/1-1.3.4:1.0/ttyUSB1/tty/ttyUSB1
E: ID_BUS=usb
E: ID_MODEL=CP2102_USB_to_UART_Bridge_Controller
E: ID_MODEL_ENC=CP2102\x20USB\x20to\x20UART\x20Bridge\x20Controller
E: ID_MODEL_ID=ea60
E: ID_PATH=platform-bcm2708_usb-usb-0:1.3.4:1.0
E: ID_PATH_TAG=platform-bcm2708_usb-usb-0_1_3_4_1_0
E: ID_REVISION=0100
E: ID_SERIAL=Silicon_Labs_CP2102_USB_to_UART_Bridge_Controller_0001
E: ID_SERIAL_SHORT=0001
E: ID_TYPE=generic
E: ID_USB_DRIVER=cp210x
E: ID_USB_INTERFACES=:ff0000:
E: ID_USB_INTERFACE_NUM=00
E: ID_VENDOR=Silicon_Labs
E: ID_VENDOR_ENC=Silicon\x20Labs
E: ID_VENDOR_ID=10c4
E: MAJOR=188
E: MINOR=1
E: SUBSYSTEM=tty
E: USEC_INITIALIZED=31965230

tc@box:~$ sudo udevadm info --query=all --name=ttyUSB0
P: /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/1-1.3.3/1-1.3.3:1.0/ttyUSB0/tty/ttyUSB0
N: ttyUSB0
S: serial/by-id/usb-Silicon_Labs_CP2102_USB_to_UART_Bridge_Controller_1740-if00-port0
S: serial/by-path/platform-bcm2708_usb-usb-0:1.3.3:1.0-port0
E: DEVLINKS=/dev/serial/by-id/usb-Silicon_Labs_CP2102_USB_to_UART_Bridge_Controller_1740-if00-port0 /dev/serial/by-path/platform-bcm2708_usb-usb-0:1.3.3:1.0-port0
E: DEVNAME=/dev/ttyUSB0
E: DEVPATH=/devices/platform/bcm2708_usb/usb1/1-1/1-1.3/1-1.3.3/1-1.3.3:1.0/ttyUSB0/tty/ttyUSB0
E: ID_BUS=usb
E: ID_MODEL=CP2102_USB_to_UART_Bridge_Controller
E: ID_MODEL_ENC=CP2102\x20USB\x20to\x20UART\x20Bridge\x20Controller
E: ID_MODEL_ID=ea60
E: ID_PATH=platform-bcm2708_usb-usb-0:1.3.3:1.0
E: ID_PATH_TAG=platform-bcm2708_usb-usb-0_1_3_3_1_0
E: ID_REVISION=0100
E: ID_SERIAL=Silicon_Labs_CP2102_USB_to_UART_Bridge_Controller_1740
E: ID_SERIAL_SHORT=1740
E: ID_TYPE=generic
E: ID_USB_DRIVER=cp210x
E: ID_USB_INTERFACES=:ff0000:
E: ID_USB_INTERFACE_NUM=00
E: ID_VENDOR=Silicon_Labs
E: ID_VENDOR_ENC=Silicon\x20Labs
E: ID_VENDOR_ID=10c4
E: MAJOR=188
E: MINOR=0
E: SUBSYSTEM=tty
E: USEC_INITIALIZED=31958878
bellad.flnet.org

Online Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11591
Re: persistant rules
« Reply #6 on: June 23, 2015, 10:11:21 AM »
Hi bellad
What happens if you change:
Code: [Select]
ATTRS{serial}==to:
Code: [Select]
ENV{ID_SERIAL_SHORT}==

Offline bellad

  • Jr. Member
  • **
  • Posts: 65
Re: persistant rules
« Reply #7 on: June 23, 2015, 10:13:13 AM »
yes I already tried, it's the same
bellad.flnet.org