conn

A script repository to manage connections in Linux.
git clone git://r-36.net/conn
Log | Files | Refs | README | LICENSE

f3507g-x201-init (1010B)


      1 #!/bin/sh
      2 
      3 #
      4 # The control interface.
      5 #
      6 CONTROL_DEVICE="/dev/ttyACM1"
      7 #
      8 # Your SIM card PIN.
      9 #
     10 PIN="7471"
     11 #
     12 # The APN of your provider.
     13 #
     14 APN="surfo2"
     15 
     16 case "$1" in
     17 	-s)
     18 		modprobe zaurus
     19 
     20 		echo -n "Powering up F3507g card.."
     21 		rfkill unblock wwan
     22 		while [ ! -c $CONTROL_DEVICE ];
     23 		do
     24 			sleep 0.5
     25 			echo -n "."
     26 		done
     27 		echo "done"
     28 
     29 		echo -n "Turning on F3507g card..."
     30 		sleep 5 
     31 		if [ -n "$PIN" ]; then
     32 			echo -n "PIN..."
     33 			chat -v "" "AT+CPIN?" "SIM PIN" "AT" "OK" \
     34 				"AT+CPIN=\"$PIN\"" "OK" > $CONTROL_DEVICE \
     35 				< $CONTROL_DEVICE
     36 		fi
     37 		echo -n "CFUN..."
     38 		chat -v "" "AT+CPIN?" "OK" "AT+CFUN=1" "+PACSP0" "AT" \
     39 			"OK" > $CONTROL_DEVICE < $CONTROL_DEVICE
     40 		echo "done"
     41 		;;
     42 	-k)
     43 		echo -n "Turning off F3507g card..."
     44 		chat -v "" "AT+CFUN=4" "OK" > $CONTROL_DEVICE < $CONTROL_DEVICE
     45 		echo "done"
     46 
     47 		echo -n "Powering down F3507g card.."
     48 		rfkill block wwan
     49 		rmmod zaurus
     50 		rmmod cdc_ether
     51 		echo "done"
     52 		;;
     53 	-r)
     54 		$0 -k
     55 		$0 -s
     56 		;;
     57 	*)
     58 		echo "usage: $0 [-s|-k|-r]"
     59 		;;
     60 esac
     61 exit 0
     62