Jan Kundrát | 55fb064 | 2020-03-27 18:44:19 +0100 | [diff] [blame] | 1 | #!/bin/sh |
2 | |||||
3 | set -ex | ||||
4 | |||||
5 | for candidate in osc oscW eth2; do | ||||
6 | if [[ -d "/sys/class/net/${candidate}" ]]; then | ||||
7 | NETDEV="${candidate}" | ||||
8 | break | ||||
9 | fi | ||||
10 | done | ||||
11 | |||||
12 | if [[ ! -n "${NETDEV+set}" ]]; then | ||||
13 | echo "Unrecognized SFP device name" | ||||
14 | exit 1 | ||||
15 | fi | ||||
16 | |||||
17 | # SFP: green lit for "link" | ||||
18 | # SFP: green blinking for activity | ||||
19 | cd /sys/class/leds/sfp:green | ||||
20 | echo netdev > trigger | ||||
21 | echo "${NETDEV}" > device_name | ||||
22 | echo 1 > link | ||||
23 | echo 1 > rx | ||||
24 | echo 1 > tx |