View: 1027|Reply: 0

creating static USB ports on Orange Pi Zero

[Copy link]

3

threads

6

posts

63

credits

Registered member

Rank: 2

credits
63
Published in 2024-2-19 06:44:29 | Show all floors |Read mode
  1. #!/bin/bash

  2. # Split the first command line argument by '/'
  3. IFS='/' read -r -a items <<< "$1"

  4. # Iterate through the items
  5. for ((i=0; i<${#items[@]}; i++)); do
  6.     # Check if the current item matches the pattern 'usb' followed by one or more digits
  7.     if [[ ${items[$i]} =~ ^usb[0-9]+$ ]]; then
  8.         # Print the next item in the list and exit the loop
  9.         echo "${items[$((i+1))]}"
  10.         break
  11.     fi
  12. done
Copy code
I was able to get static USB ports on an Orange Zero Pi with adding a udev rule refencing the script above like: ACTION=="add", KERNEL=="ttyUSB[0-9]*", PROGRAM="/etc/udev/rules.d/usb-parse-devpath.sh %p", SYMLINK+="ttyUSB_%c"
You need to log in before you can reply login | Register

Points Rule

Quick reply Top Return list