From b63df4c5414a40d087c9a07702273099d7e6cf73 Mon Sep 17 00:00:00 2001 From: Artur Artamonov Date: Tue, 23 Jul 2013 17:24:16 +0300 Subject: query3g inccorect file name --- package/query3g/files/usr/bin/query3g | 42 ++++++++++++++++++++++++++++++++ package/query3g/files/usr/bin/query3g.sh | 42 -------------------------------- 2 files changed, 42 insertions(+), 42 deletions(-) create mode 100755 package/query3g/files/usr/bin/query3g delete mode 100755 package/query3g/files/usr/bin/query3g.sh diff --git a/package/query3g/files/usr/bin/query3g b/package/query3g/files/usr/bin/query3g new file mode 100755 index 000000000..33cfe2379 --- /dev/null +++ b/package/query3g/files/usr/bin/query3g @@ -0,0 +1,42 @@ +#!/bin/sh + +reset=/usr/bin/usbreset +comgt=/usr/bin/gcom +script=/usr/share/query3g.gcom + +last_reset="x" + +wan_proto="$(uci -q get network.wan.proto)" + +if [ "$wan_proto" = "3g" ]; then + ifdown wan +fi + +for port in 0 1 2 3 4 5 6 7 8 9; do + for tty in $(find /sys/devices/ -name "ttyUSB$port" -type d | sort -u); do + [ -f "$tty/../../idProduct" ] || continue + + local dir="$(cd "$tty/../.."; pwd)" + local uid="$(basename "$dir")" + local dev="/dev/$(basename "$tty")" + local vid="$(cat "$tty/../../idVendor")" + local pid="$(cat "$tty/../../idProduct")" + + if [ "$last_reset" != "$vid:$pid" ] && [ "$vid:$pid" != "0685:7000" ]; then + last_reset="$vid:$pid" +# $reset "$vid:$pid" >/dev/null + + local try=0 + while [ $((try++)) -lt 5 ] && [ ! -e "$dev" ]; do sleep 1; done + fi + + if $comgt -s "$script" -d "$dev" 2>/dev/null; then + echo "PORT:$dev" + echo "VID:$vid" + echo "PID:$pid" + echo "UID:$uid" + exit 0 + fi + done +done +exit 1 diff --git a/package/query3g/files/usr/bin/query3g.sh b/package/query3g/files/usr/bin/query3g.sh deleted file mode 100755 index 33cfe2379..000000000 --- a/package/query3g/files/usr/bin/query3g.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/sh - -reset=/usr/bin/usbreset -comgt=/usr/bin/gcom -script=/usr/share/query3g.gcom - -last_reset="x" - -wan_proto="$(uci -q get network.wan.proto)" - -if [ "$wan_proto" = "3g" ]; then - ifdown wan -fi - -for port in 0 1 2 3 4 5 6 7 8 9; do - for tty in $(find /sys/devices/ -name "ttyUSB$port" -type d | sort -u); do - [ -f "$tty/../../idProduct" ] || continue - - local dir="$(cd "$tty/../.."; pwd)" - local uid="$(basename "$dir")" - local dev="/dev/$(basename "$tty")" - local vid="$(cat "$tty/../../idVendor")" - local pid="$(cat "$tty/../../idProduct")" - - if [ "$last_reset" != "$vid:$pid" ] && [ "$vid:$pid" != "0685:7000" ]; then - last_reset="$vid:$pid" -# $reset "$vid:$pid" >/dev/null - - local try=0 - while [ $((try++)) -lt 5 ] && [ ! -e "$dev" ]; do sleep 1; done - fi - - if $comgt -s "$script" -d "$dev" 2>/dev/null; then - echo "PORT:$dev" - echo "VID:$vid" - echo "PID:$pid" - echo "UID:$uid" - exit 0 - fi - done -done -exit 1 -- cgit v1.2.3