-
Notifications
You must be signed in to change notification settings - Fork 8
/
60-nano-tiny.rules
35 lines (26 loc) · 1.15 KB
/
60-nano-tiny.rules
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# supporting udev rule for NanoVNA and tinySA devices
# provide unique device symlinks, useful if you have more identical devices connected
# skip if no TTY device like ttyUSBn or ttyACMn is ADDed
ACTION!="add", GOTO="nano_tiny_end"
SUBSYSTEM!="tty", GOTO="nano_tiny_end"
KERNEL!="ttyUSB[0-9]*|ttyACM[0-9]*", GOTO="nano_tiny_end"
# provide access to USB ID entries like ID_VENDOR_ID etc.
SUBSYSTEMS=="usb", IMPORT{builtin}="usb_id"
# skip if not "STMicroelectronics" "Virtual COM Port"
ENV{ID_VENDOR_ID}!="0483", GOTO="nano_tiny_end"
ENV{ID_MODEL_ID}!="5740", GOTO="nano_tiny_end"
# create a generic symlink for the device that was ADDED LAST!
ENV{ID_VENDOR}=="nanovna.com", SYMLINK+="nanovna"
ENV{ID_VENDOR}=="tinysa.org", SYMLINK+="tinysa"
# now try to create unique symlinks
# skip old "serial number" string "400"
ENV{ID_SERIAL_SHORT}=="400", GOTO="nano_tiny_end"
# skip empty serial number string
ENV{ID_SERIAL_SHORT}=="", GOTO="nano_tiny_end"
ENV{ID_VENDOR}=="nanovna.com", \
SYMLINK+="nanovna_$env{ID_SERIAL_SHORT}", \
GOTO="nano_tiny_end"
ENV{ID_VENDOR}=="tinysa.org", \
SYMLINK+="tinysa_$env{ID_SERIAL_SHORT}", \
GOTO="nano_tiny_end"
LABEL="nano_tiny_end"