JetHome: Add RS485 ports aliases in /dev/serial/rs485 for JetHub D1/D1+

This commit is contained in:
Vyacheslav Bocharov 2023-07-20 16:16:26 +03:00 committed by Igor
parent 22ed391b16
commit 4d5edf5eda
2 changed files with 27 additions and 0 deletions

View File

@ -210,6 +210,11 @@ family_tweaks_bsp() {
# Ethernet LED setup
run_host_command_logged cp -v "$SRC/packages/bsp/jethub/$BOARD/05-jethub_set_eth_leds.rules" "$destination/etc/udev/rules.d/"
fi
if [[ "$BOARD" == jethubj100 ]]; then
# Add /dev/serial/rs485 aliases
run_host_command_logged cp -v "$SRC/packages/bsp/jethub/$BOARD/90-jethub-rs485-aliases.rules" "$destination/etc/udev/rules.d/"
fi
run_host_command_logged mkdir -pv "$destination/etc/udev/rules.d"
run_host_command_logged mkdir -pv "$destination/usr/local/bin"

View File

@ -0,0 +1,22 @@
ACTION=="remove", GOTO="serial_end"
SUBSYSTEM!="tty", GOTO="serial_end"
SUBSYSTEMS=="usb", IMPORT{builtin}="usb_id", IMPORT{builtin}="hwdb --subsystem=usb"
# /dev/serial/by-path/, /dev/serial/by-id/ for USB devices
KERNEL!="ttyUSB[0-9]*", GOTO="serial_end"
SUBSYSTEMS=="usb-serial", ENV{.ID_PORT}="$attr{port_number}"
IMPORT{builtin}="path_id"
ENV{ID_BUS}=="", GOTO="serial_end"
ENV{ID_SERIAL}=="", GOTO="serial_end"
ENV{ID_USB_INTERFACE_NUM}=="", GOTO="serial_end"
# CP2105, rev >1.8
ENV{ID_PATH}=="platform-xhci-hcd.0.auto-usb-0:1.1:1.*", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea70", SYMLINK+="serial/rs485/ttyRS485-$env{ID_USB_INTERFACE_NUM}"
# CP2104, rev <=1.8
ENV{ID_PATH}=="platform-xhci-hcd.0.auto-usb-0:1.1:1.0", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", SYMLINK+="serial/rs485/ttyRS485-0"
ENV{ID_PATH}=="platform-xhci-hcd.0.auto-usb-0:1.2:1.0", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", SYMLINK+="serial/rs485/ttyRS485-1"
LABEL="serial_end"