Revert "ethmngr: removed deprecated ethport hotplug handler"

This reverts commit dcfa48d1f7.
This commit is contained in:
Markus Gothe 2025-03-30 14:41:48 +02:00
parent 78eb76e913
commit ee6a27dc76
2 changed files with 24 additions and 1 deletions

View file

@ -5,7 +5,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=ethmngr
PKG_VERSION:=3.0.7
PKG_VERSION:=3.0.6
LOCAL_DEV:=0
ifneq ($(LOCAL_DEV),1)

View file

@ -0,0 +1,23 @@
#!/bin/sh
[ -n "$PORT" -a -n "$LINK" ] || exit 0
case "$PORT" in
# do not generate ethport ubus event
# for wifi, dsl and brige devices
wl*|wds*|atm*|ptm*|br-*)
exit 0
;;
esac
speed=0
duplex=full
if [ "$LINK" = "up" ]; then
devspeed="$(ubus -t 2 call network.device status "{\"name\":\"$PORT\"}" | jsonfilter -e @.speed)"
speed=${devspeed:0:-1}
duplex=${devspeed:0-1}
[ "$duplex" == "H" ] && duplex="half" || duplex="full"
fi
ubus send ethport "{\"ifname\":\"$PORT\",\"link\":\"$LINK\",\"speed\":\"$speed\",\"duplex\":\"$duplex\"}"