From 5bfe1cdae38c39a4fe7ca891aac31233165e3531 Mon Sep 17 00:00:00 2001 From: Artur Artamonov Date: Thu, 18 Jul 2013 16:51:06 +0300 Subject: query3g pre-release changes. added modem info search, added apnfinder by id, apn provider database, supported modem database --- package/query3g/files/usr/bin/query3g.sh | 42 ++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 package/query3g/files/usr/bin/query3g.sh (limited to 'package/query3g/files/usr/bin/query3g.sh') diff --git a/package/query3g/files/usr/bin/query3g.sh b/package/query3g/files/usr/bin/query3g.sh new file mode 100755 index 000000000..33cfe2379 --- /dev/null +++ b/package/query3g/files/usr/bin/query3g.sh @@ -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 -- cgit v1.2.3