summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mk/modules.mk4
-rw-r--r--package/comgt/Makefile5
-rw-r--r--package/comgt/files/hsoauth.comgt34
-rw-r--r--package/comgt/files/hsoconnect.comgt19
-rw-r--r--package/comgt/files/hsodata.comgt27
-rw-r--r--package/comgt/files/hsodisconnect.comgt19
-rw-r--r--package/comgt/files/hsostatus.comgt14
-rw-r--r--package/comgt/files/waitready.comgt34
-rw-r--r--package/pkgmaker2
-rw-r--r--package/ppp/Makefile16
-rw-r--r--package/ppp/files/hso.if-down12
-rw-r--r--package/ppp/files/hso.if-up66
-rwxr-xr-xpackage/ppp/files/ppp.pre-up12
-rw-r--r--target/linux/config/Config.in.misc4
-rw-r--r--target/linux/config/Config.in.usb8
15 files changed, 259 insertions, 17 deletions
diff --git a/mk/modules.mk b/mk/modules.mk
index 1a8b5c1cd..23f76df11 100644
--- a/mk/modules.mk
+++ b/mk/modules.mk
@@ -1176,6 +1176,10 @@ $(eval $(call KMOD_template,USB_PEGASUS,usb-pegasus,\
$(MODULES_DIR)/kernel/drivers/net/usb/pegasus \
,75))
+$(eval $(call KMOD_template,USB_HSO,usb-hso,\
+ $(MODULES_DIR)/kernel/drivers/net/usb/hso \
+,75))
+
$(eval $(call KMOD_template,SND_USB_AUDIO,snd-usb-audio,\
$(MODULES_DIR)/kernel/sound/usb/snd-usb-lib \
$(MODULES_DIR)/kernel/sound/usb/snd-usb-audio \
diff --git a/package/comgt/Makefile b/package/comgt/Makefile
index 50816d485..8f2c25db7 100644
--- a/package/comgt/Makefile
+++ b/package/comgt/Makefile
@@ -5,7 +5,7 @@ include ${TOPDIR}/rules.mk
PKG_NAME:= comgt
PKG_VERSION:= 0.32
-PKG_RELEASE:= 1
+PKG_RELEASE:= 2
PKG_MD5SUM:= db2452680c3d953631299e331daf49ef
PKG_DESCR:= 3G/GPRS datacard control tool
PKG_SECTION:= console
@@ -21,12 +21,11 @@ $(eval $(call PKG_template,COMGT,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG
CONFIG_STYLE:= manual
INSTALL_STYLE:= manual
-
ALL_TARGET= comgt
do-install:
${INSTALL_DIR} ${IDIR_COMGT}/usr/bin ${IDIR_COMGT}/etc/comgt
${INSTALL_BIN} ${WRKBUILD}/comgt ${IDIR_COMGT}/usr/bin/comgt
- ${INSTALL_DATA} ./files/dial.comgt ${IDIR_COMGT}/etc/comgt/dial.comgt
+ ${INSTALL_DATA} ./files/*.comgt ${IDIR_COMGT}/etc/comgt/
include ${TOPDIR}/mk/pkg-bottom.mk
diff --git a/package/comgt/files/hsoauth.comgt b/package/comgt/files/hsoauth.comgt
new file mode 100644
index 000000000..ea81ee3ca
--- /dev/null
+++ b/package/comgt/files/hsoauth.comgt
@@ -0,0 +1,34 @@
+opengt
+ set com 115200n81
+ set senddelay 0.02
+ waitquiet 1 0.2
+
+:start
+ flash 0.1
+
+:getuser
+ let $u=$env("USER")
+ let a=len($u)
+ if a=0 goto continue
+
+:getpass
+ let $p=$env("PASS")
+
+:auth
+ print "User: ",$u,"\n"
+ print "Pass: ",$p,"\n"
+ send "AT$QCPDPP=1,1,\""
+ send $p
+ send "\",\""
+ send $u
+ send "\"^m"
+ waitfor 2 "OK"
+ if % = -1 goto error
+ if % = 0 goto continue
+
+:error
+ exit 1
+
+:continue
+ exit 0
+
diff --git a/package/comgt/files/hsoconnect.comgt b/package/comgt/files/hsoconnect.comgt
new file mode 100644
index 000000000..721a86c68
--- /dev/null
+++ b/package/comgt/files/hsoconnect.comgt
@@ -0,0 +1,19 @@
+opengt
+ set com 115200n81
+ set senddelay 0.02
+ waitquiet 1 0.2
+ flash 0.1
+
+:start
+ send "AT_OWANCALL=1,1,0^m"
+ waitfor 2 "OK"
+ if % = -1 goto error
+ if % = 0 goto continue
+
+
+:error
+ exit 1
+
+:continue
+ exit 0
+
diff --git a/package/comgt/files/hsodata.comgt b/package/comgt/files/hsodata.comgt
new file mode 100644
index 000000000..92d2d8e3a
--- /dev/null
+++ b/package/comgt/files/hsodata.comgt
@@ -0,0 +1,27 @@
+opengt
+ set com 115200n81
+ set senddelay 0.02
+ waitquiet 1 0.2
+ flash 0.1
+
+ let c=1
+:start
+ send "AT_OWANDATA=1^m"
+ waitfor 2 "ERROR"
+ if % = 0 goto repeat
+ send "AT_OWANDATA=1^m"
+ get 2 "^m" $s
+ get 2 "^m" $s
+ print $s
+ print "\n"
+ exit 0
+
+:repeat
+ sleep 3
+ inc c
+ if c > 15 goto error
+ goto start
+
+:error
+ exit 1
+
diff --git a/package/comgt/files/hsodisconnect.comgt b/package/comgt/files/hsodisconnect.comgt
new file mode 100644
index 000000000..755a0a318
--- /dev/null
+++ b/package/comgt/files/hsodisconnect.comgt
@@ -0,0 +1,19 @@
+opengt
+ set com 115200n81
+ set senddelay 0.02
+ waitquiet 1 0.2
+ flash 0.1
+
+:start
+ send "AT_OWANCALL=1,0,0^m"
+ waitfor 2 "OK"
+ if % = -1 goto error
+ if % = 0 goto continue
+
+
+:error
+ exit 1
+
+:continue
+ exit 0
+
diff --git a/package/comgt/files/hsostatus.comgt b/package/comgt/files/hsostatus.comgt
new file mode 100644
index 000000000..83f13f0a8
--- /dev/null
+++ b/package/comgt/files/hsostatus.comgt
@@ -0,0 +1,14 @@
+opengt
+ set com 115200n81
+ set senddelay 0.02
+ waitquiet 1 0.2
+ flash 0.1
+
+:start
+ send "AT_OWANCALL?^m"
+ get 2 "^m" $s
+ get 2 "^m" $s
+ print $s
+ print "\n"
+ exit 0
+
diff --git a/package/comgt/files/waitready.comgt b/package/comgt/files/waitready.comgt
new file mode 100644
index 000000000..0de4df5d4
--- /dev/null
+++ b/package/comgt/files/waitready.comgt
@@ -0,0 +1,34 @@
+# wait till the sim is ready
+opengt
+ set com 115200n81
+ set senddelay 0.02
+ waitquiet 1 0.2
+ flash 0.1
+:start
+ print "Waiting for SIM..."
+ let c=0
+:waitready
+ send "AT+CPIN?^m"
+ waitfor 2 "SIM PUK","SIM PIN","READY","ERROR","ERR"
+ if % = -1 goto tryagain
+ if % = 0 goto simready
+ if % = 1 goto simready
+ if % = 2 goto simready
+ if % = 3 goto tryagain
+ if % = 4 goto tryagain
+
+:tryagain
+ if c > 120 goto waittimeout
+ let c=c+2
+ print "."
+ goto waitready
+
+:waittimeout
+ print " Timeout
+"
+ exit 1
+
+:simready
+ print " OK
+"
+ exit 0
diff --git a/package/pkgmaker b/package/pkgmaker
index 0e8e21372..3ec2dd4d8 100644
--- a/package/pkgmaker
+++ b/package/pkgmaker
@@ -12,7 +12,7 @@ GMAKE="$GMAKE --no-print-directory"
typeset -L$x_cols pbar
# check for trailing whitespace
-grep -H "[[:space:]]$" */Makefile && print "Found trailing whitespace, please fix"
+grep -H '[[:space:]]$' */Makefile && print "Found trailing whitespace, please fix"
# build a cache of “ipkg package name” → “package conf option” for
# use with dependency resolution
diff --git a/package/ppp/Makefile b/package/ppp/Makefile
index 9623bc58d..cd28e86db 100644
--- a/package/ppp/Makefile
+++ b/package/ppp/Makefile
@@ -5,7 +5,7 @@ include ${TOPDIR}/rules.mk
PKG_NAME:= ppp
PKG_VERSION:= 2.4.5
-PKG_RELEASE:= 3
+PKG_RELEASE:= 4
PKG_MD5SUM:= 4621bc56167b6953ec4071043fe0ec57
PKG_DESCR:= Point-to-Point Protocol software
PKG_SECTION:= net
@@ -14,6 +14,7 @@ PKG_DEPENDS:= kmod-ppp
PKG_URL:= http://ppp.samba.org
PKG_SITES:= ftp://ftp.samba.org/pub/ppp/
PKG_DEPENDS_PPPOE:= kmod-pppoe
+PKG_DEPENDS_UMTS:= comgt
include ${TOPDIR}/mk/package.mk
@@ -24,7 +25,7 @@ $(eval $(call PKG_template,PPP_MOD_RADIUS,ppp-mod-radius,${PKG_VERSION}-${PKG_RE
$(eval $(call PKG_template,PPP_MOD_CHAT,ppp-mod-chat,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION}))
$(eval $(call PKG_template,PPP_MOD_PPPDUMP,ppp-mod-pppdump,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION}))
$(eval $(call PKG_template,PPP_MOD_PPPSTATS,ppp-mod-pppstats,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION}))
-$(eval $(call PKG_template,PPP_MOD_PPPUMTS,ppp-mod-pppumts,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION}))
+$(eval $(call PKG_template,PPP_MOD_PPPUMTS,ppp-mod-pppumts,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS_UMTS},${PKG_DESCR},${PKG_SECTION}))
CONFIGURE_ENV+= UNAME_S="Linux"
XAKE_FLAGS+= CC="${TARGET_CC}" \
@@ -104,12 +105,13 @@ mod-pppstats-install:
mod-pppumts-install:
${INSTALL_DIR} ${IDIR_PPP_MOD_PPPUMTS}/etc/ppp/templates
- ${INSTALL_DIR} ${IDIR_PPP_MOD_PPPUMTS}/etc/ppp/ip-{down,up}.d
${INSTALL_DATA} ./files/etc/ppp/templates/umts \
${IDIR_PPP_MOD_PPPUMTS}/etc/ppp/templates/
- ${INSTALL_BIN} ./files/etc/ppp/ip-up.d/umts \
- ${IDIR_PPP_MOD_PPPUMTS}/etc/ppp/ip-up.d/
- ${INSTALL_BIN} ./files/etc/ppp/ip-down.d/umts \
- ${IDIR_PPP_MOD_PPPUMTS}/etc/ppp/ip-down.d/
+ $(INSTALL_DIR) ${IDIR_PPP_MOD_PPPUMTS}/etc/network/if-pre-up.d
+ $(INSTALL_DIR) ${IDIR_PPP_MOD_PPPUMTS}/etc/network/if-post-down.d
+ $(INSTALL_BIN) ./files/hso.if-up \
+ ${IDIR_PPP_MOD_PPPUMTS}/etc/network/if-pre-up.d/06-hso
+ $(INSTALL_BIN) ./files/hso.if-down \
+ ${IDIR_PPP_MOD_PPPUMTS}/etc/network/if-post-down.d/06-hso
include ${TOPDIR}/mk/pkg-bottom.mk
diff --git a/package/ppp/files/hso.if-down b/package/ppp/files/hso.if-down
new file mode 100644
index 000000000..6e4b4d655
--- /dev/null
+++ b/package/ppp/files/hso.if-down
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+[ "$IFACE" == "hso0" ] || exit 0
+
+[ -f /tmp/hso-connect ] || exit 0
+
+PID=$(cat /tmp/hso-connect)
+ps | grep "$PID" | grep -q hso-connect.sh && kill "$PID"
+comgt -s -d /dev/ttyHS0 /etc/comgt/hsodisconnect.comgt
+rm -f /tmp/hso-connect
+ip address flush hso0
+ip link set hso0 down
diff --git a/package/ppp/files/hso.if-up b/package/ppp/files/hso.if-up
new file mode 100644
index 000000000..d08beda31
--- /dev/null
+++ b/package/ppp/files/hso.if-up
@@ -0,0 +1,66 @@
+#!/bin/sh
+
+[ "$IFACE" == "hso0" ] || exit 0
+
+TTY=${IF_HSO_DEVICE:-/dev/ttyHS0}
+# wait for card to initialize
+COUNT=0
+while [ $((COUNT++)) -lt 20 ]; do
+ [ -c "$TTY" ] && break
+ [ $COUNT -eq 20 ] && {
+ logger "$0: '$TTY' not found"
+ exit 1
+ }
+ sleep 1
+done
+
+if [ "$IF_PIN" ]; then
+ COMGTPIN="$IF_PIN" comgt -d "$TTY" PIN
+fi
+
+if [ "$IF_APN" ]; then
+ COMGTAPN="$IF_APN" comgt -d "$TTY" APN
+fi
+
+# only run once!
+[ -f /tmp/hso-connect ] && exit 0
+
+while :
+do
+ # get connection status
+ STATUS=$(comgt -s -d "$TTY" /etc/comgt/hsostatus.comgt |
+ tr -d " " |
+ grep -v ^$ |
+ cut -d , -f 2)
+ # dial if connection status is disabled
+ if [ "$STATUS" -eq "0" ] ; then
+ comgt -s -d "$TTY" /etc/comgt/hsoconnect.comgt
+ DATA=$(comgt -s -d "$TTY" /etc/comgt/hsodata.comgt)
+ if [ "$?" -ne 0 ] ; then
+ continue
+ fi
+ DATA=$(echo $DATA |
+ tr -d " " |
+ grep -v ^$)
+ IP=$(echo $DATA | cut -d , -f 2)
+ NS1=$(echo $DATA | cut -d , -f 4)
+ NS2=$(echo $DATA | cut -d , -f 5)
+ ip address flush dev hso0 2> /dev/null
+ ip address add "$IP/32" dev hso0
+ ip link set hso0 up
+ def=$(ip route show |grep default | wc -l)
+ [ $def -eq 1 ] && ip route del default
+ ip route add default dev hso0
+ echo "nameserver $NS1" > /etc/resolv.conf
+ echo "nameserver $NS2" >> /etc/resolv.conf
+ . /etc/rc.conf
+ # get time via ntpclient if available
+ [ -x /usr/sbin/ntpclient ] && ntpclient -s -h pool.ntp.org
+ # get time via rdate if available
+ [ -x /usr/sbin/rdate ] && rdate -nv pool.ntp.org
+ # restart ntpd when enabled
+ test x"${ntpd:-NO}" = x"NO" || /etc/init.d/ntpd restart
+ fi
+ sleep 10
+done &
+echo $! > /tmp/hso-connect
diff --git a/package/ppp/files/ppp.pre-up b/package/ppp/files/ppp.pre-up
index 79fb063ba..7f28f32da 100755
--- a/package/ppp/files/ppp.pre-up
+++ b/package/ppp/files/ppp.pre-up
@@ -93,21 +93,21 @@ umts)
comgt -s /etc/comgt/waitready.comgt -d $IF_PPP_DEVICE || exit 1
# set pincode
- if [ "$IF_UMTS_PINCODE" ]; then
- COMGTPIN="$IF_UMTS_PINCODE" comgt PIN -d $IF_PPP_DEVICE || ERROR=1
+ if [ "$IF_PIN" ]; then
+ COMGTPIN="$IF_PIN" comgt PIN -d $IF_PPP_DEVICE || exit 1
fi
# set APN
- COMGTAPN="$IF_UMTS_APN" comgt APN -d $IF_PPP_DEVICE || ERROR=1
+ COMGTAPN="$IF_APN" comgt APN -d $IF_PPP_DEVICE || exit 1
# set umts/gprs mode if available (Option cards only)
- case "$IF_UMTS_MODE" in
+ case "$IF_MODE" in
gprs_only) comgt 2G -d $IF_PPP_DEVICE ;;
umts_only) comgt 3G -d $IF_PPP_DEVICE ;;
umts_first) comgt 3G2G -d $IF_PPP_DEVICE ;;
"") ;;
- *) echo "unknown umts-mode, exiting"
- ERROR=1
+ *) echo "unknown mode, exiting"
+ exit 1
;;
esac
;;
diff --git a/target/linux/config/Config.in.misc b/target/linux/config/Config.in.misc
index eb2737eed..b7aad4e23 100644
--- a/target/linux/config/Config.in.misc
+++ b/target/linux/config/Config.in.misc
@@ -4,6 +4,10 @@ config ADK_LINUX_INITRAMFS_BUILTIN
boolean
default n
+config ADK_KERNEL_RFKILL
+ boolean
+ default n
+
menu "Miscellaneous devices support"
config ADK_KERNEL_WATCHDOG
diff --git a/target/linux/config/Config.in.usb b/target/linux/config/Config.in.usb
index 3111b1692..8f2f5cf1b 100644
--- a/target/linux/config/Config.in.usb
+++ b/target/linux/config/Config.in.usb
@@ -169,6 +169,14 @@ config ADK_KPACKAGE_KMOD_USB_PEGASUS
default n
depends on ADK_PACKAGE_KMOD_USB_CONTROLLER
+config ADK_KPACKAGE_KMOD_USB_HSO
+ prompt "kmod-usb-hso...................... Support for USB HSO devices"
+ tristate
+ select ADK_KERNEL_RFKILL
+ select ADK_KPACKAGE_KMOD_USB_STORAGE
+ default n
+ depends on ADK_PACKAGE_KMOD_USB_CONTROLLER
+
config ADK_KPACKAGE_KMOD_USB_PRINTER
prompt "kmod-usb-printer.................. Support for USB printers"
tristate