Skip to content

Instantly share code, notes, and snippets.

@hobbyquaker
Last active September 5, 2019 16:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hobbyquaker/63adb691c6e3954295cf3070e21a420d to your computer and use it in GitHub Desktop.
Save hobbyquaker/63adb691c6e3954295cf3070e21a420d to your computer and use it in GitHub Desktop.
create udev symlink for usb serial tty
#!/bin/bash
DEV="$1"
LINK="$2"
INFO=$(udevadm info -a -n $DEV)
VENDOR=$(echo "$INFO" | grep '{idVendor}' | head -n1)
PRODUCT=$(echo "$INFO" | grep '{idProduct}' | head -n1)
SERIAL=$(echo "$INFO" | grep '{serial}' | head -n1)
echo "SUBSYSTEM==\"tty\", ${VENDOR}, ${PRODUCT}, ${SERIAL}, SYMLINK+=\"$2\""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment