Skip to content

Instantly share code, notes, and snippets.

View galenseitz's full-sized avatar

Galen Seitz galenseitz

  • Portland, OR
View GitHub Profile
@galenseitz
galenseitz / 10-persistent-serial.sh
Last active May 11, 2024 18:43 — forked from Leo-PL/10-persistent-serial.sh
Persistent serial port names for USB-serial on OpenWrt hotplugd
[ "${ACTION}" = "bind" -o "${ACTION}" = "unbind" ] || exit 0
[ "${SUBSYSTEM}" = "usb-serial" ] || exit 0
[ -n "${DEVICENAME}" -a -n "${DEVPATH}" ] || exit 1
if [ "${ACTION}" = "bind" ]; then
subsystem="$(basename $(readlink /sys${DEVPATH}/../subsystem))"
[ "$subsystem" = "usb" ] || exit 0
replace_whitespace="s/^[ \t]*|[ \t]*$//g; s/[ \t]+/_/g"