diff --git a/config/client_config/80-raspap-net-devices.rules b/config/client_config/80-raspap-net-devices.rules index 33e6584c..ddec8203 100644 --- a/config/client_config/80-raspap-net-devices.rules +++ b/config/client_config/80-raspap-net-devices.rules @@ -1,3 +1,3 @@ -SUBSYSTEM=="net", ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="14db", NAME="hilink%n", TAG+="systemd", ENV{SYSTEMD_WANTS}="start start_huawei_hilink.service" +SUBSYSTEM=="net", ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="14db", NAME="hilink%n", TAG+="systemd", ENV{SYSTEMD_WANTS}="start start_huawei_hilink@hilink%n.service" diff --git a/config/client_config/onoff_huawei_hilink.sh b/config/client_config/onoff_huawei_hilink.sh index cd050016..9b3f8413 100644 --- a/config/client_config/onoff_huawei_hilink.sh +++ b/config/client_config/onoff_huawei_hilink.sh @@ -33,14 +33,19 @@ while [ -n "$1" ]; do shift done -if [ ! _loginState ] && [ -z "$hilink_password" ] || [ -z "$hilink_pin" ]; then _getAuthRouter; fi - if [ ! -z "$devname" ]; then # get host IP for given device name gw=$(ip route list | sed -rn "s/default via (([0-9]{1,3}\.){3}[0-9]{1,3}).*dev $devname.*/\1/p") if [ -z "$gw" ]; then exit; fi # device name not found in routing list -> abort hilink_host="$gw" fi +if [ -z "$hilink_password" ] || [ -z "$hilink_pin" ]; then + _getAuthRouter + if [ ! -z "$raspap_user" ]; then hilink_user="$raspap_user"; fi + if [ ! -z "$raspap_password" ]; then hilink_password="$raspap_password"; fi + if [ ! -z "$raspap_pin" ]; then hilink_pin="$raspap_pin"; fi +fi + echo "Hilink: switch device at $hilink_host to mode $datamode" | systemd-cat status="usage: -c 1/0 to disconnect/connect"