Hi to all
Quick start guide to use wap-lte modem:
- boot the board using openwrt-ar71xx-mikrotik-rb-nor-flash-16M-initramfs-kernel.bin (got it from the latest build)
- ssh root[at]192.168.1.1, download openwrt-ar71xx-mikrotik-rb-nor-flash-16M-squashfs-sysupgrade.bin and install openwrt on flash using:
mtd erase /dev/mtd5 sysupgrade -F openwrt-ar71xx-mikrotik-rb-nor-flash-16M-squashfs-sysupgrade.bin (the device reboots ...)
- again ssh root[at]192.168.1.1, then install needed packages:
opkg update opkg install kmod-usb-acm kmod-usb-core kmod-usb-core kmod-usb-ehci kmod-usb-ohci kmod-usb-ohci-pci \ kmod-usb2 kmod-usb2-pci kmod-usb3 kmod-usb-net-rndis kmod-usb-net-cdc-ncm libsqlite3 \ comgt comgt-ncm tio ppp-mod-pptp kmod-nf-nathelper-extra hostapd-utils
then install additional files:
/etc/gcom/r11.gcom
# stabilisce una connessione con modem mikrotik
opengt
print "DIALOGUE BEGINS\n"
set com 115200n81
set senddelay 0.1
waitquiet 3 0.5
set clocal on
flash 0.1
send "AT&F^m"
send "ATE1^m"
send "AT+CFUN=0^m"
send "AT+CFUN=4^m"
# 4g+3g
send "AT*BAND=11,79,147,480,589829,0,2,0^m"
send "AT+CMEE=2^m"
send "AT+CGREG=1^m"
send "AT+CNMI=0,0,0,0,0^m"
send 'AT*CGDFLT=0,"IP","'
send $env("pdptype")
send '","'
send $env("apn")
send '",,,,,,,,,,1,0,,,,,,,1^m'
send "AT+CFUN=1^m"
waitfor 60 "+CGEV: EPS PDN ACT"
if % = -1 goto timeout
print "RECEIVED +CGEV: EPS PDN ACT\n"
get 1 "^m" $p
print "profile="$p"\n"
send 'AT+CGDCONT?^m'
send "AT+CGCONTRDP="
send $p
send "^m"
print "Polite exit\n"
exit 0
:timeout
print "Timeout, exit.\n"
exit 1
/lib/netifd/proto/r11.sh
#!/bin/sh
[ -n "$INCLUDE_ONLY" ] || {
. /lib/functions.sh
. ../netifd-proto.sh
init_proto "$@"
}
proto_r11_init_config() {
no_device=1
available=1
proto_config_add_string "device:device"
proto_config_add_string apn
proto_config_add_string auth
proto_config_add_string username
proto_config_add_string password
proto_config_add_string pincode
proto_config_add_string delay
proto_config_add_string mode
proto_config_add_string pdptype
proto_config_add_int profile
proto_config_add_defaults
}
proto_r11_setup() {
local interface="$1"
local manufacturer initialize setmode connect finalize ifname devname devpath
local device apn auth username password pincode delay mode pdptype profile $PROTO_DEFAULT_OPTIONS
json_get_vars device apn auth username password pincode delay mode pdptype profile $PROTO_DEFAULT_OPTIONS
[ "$metric" = "" ] && metric="0"
[ -n "$profile" ] || profile=1
pdptype=`echo "$pdptype" | awk '{print toupper($0)}'`
[ "$pdptype" = "IP" -o "$pdptype" = "IPV6" -o "$pdptype" = "IPV4V6" ] || pdptype="IP"
[ -n "$ctl_device" ] && device=$ctl_device
[ -n "$device" ] || {
echo "No control device specified"
proto_notify_error "$interface" NO_DEVICE
proto_set_available "$interface" 0
return 1
}
device="$(readlink -f $device)"
[ -e "$device" ] || {
echo "Control device not valid"
proto_set_available "$interface" 0
return 1
}
devname="$(basename "$device")"
case "$devname" in
'tty'*)
devpath="$(readlink -f /sys/class/tty/$devname/device)"
ifname="$( ls "$devpath"/../*/net )"
;;
*)
devpath="$(readlink -f /sys/class/usbmisc/$devname/device/)"
ifname="$( ls "$devpath"/net )"
;;
esac
[ -n "$ifname" ] || {
echo "The interface could not be found."
proto_notify_error "$interface" NO_IFACE
proto_set_available "$interface" 0
return 1
}
[ -n "$delay" ] && sleep "$delay"
echo "MODEM ATTIVO:" $device
gcom -d "$device" -s /etc/gcom/r11.gcom
[ $? -ne 0 ] && {
echo "Error connecting"
proto_notify_error "$interface" CONNECT_FAILED
return 1
}
echo "Setting up $ifname"
proto_init_update "$ifname" 1
proto_add_data
json_add_string "manufacturer" "$manufacturer"
proto_close_data
proto_send_update "$interface"
[ "$pdptype" = "IP" -o "$pdptype" = "IPV4V6" ] && {
json_init
json_add_string name "${interface}_4"
json_add_string ifname "@$interface"
json_add_string proto "dhcp"
proto_add_dynamic_defaults
ubus call network add_dynamic "$(json_dump)"
}
[ "$pdptype" = "IPV6" -o "$pdptype" = "IPV4V6" ] && {
json_init
json_add_string name "${interface}_6"
json_add_string ifname "@$interface"
json_add_string proto "dhcpv6"
json_add_string extendprefix 1
proto_add_dynamic_defaults
ubus call network add_dynamic "$(json_dump)"
}
}
proto_r11_teardown() {
local interface="$1"
local manufacturer disconnect
local device profile
json_get_vars device profile
[ -n "$ctl_device" ] && device=$ctl_device
[ -n "$profile" ] || profile=1
echo "Stopping network $interface ($device)"
disconnect="AT+CFUN=0"
eval COMMAND="$disconnect" gcom -d "$device" -s /etc/gcom/runcommand.gcom || {
echo "Failed to disconnect"
proto_notify_error "$interface" DISCONNECT_FAILED
return 1
}
echo "proto_init_update"
proto_init_update "*" 0
echo "proto_send_update"
proto_send_update "$interface"
echo "esco da proto_r11_teardown"
}
[ -n "$INCLUDE_ONLY" ] || {
add_protocol r11
}
add to /etc/config/network the following entry:
config interface 'wan'
option proto 'r11'
option device '/dev/ttyACM1'
option apn 'your-apn-here'
That'a all folks !
These instructions create a new protocol, called r11.
Now you have only to ifup/ifdown wan.
Notice:
Pay attention to the band selection, here is for 4g+3g networks.
If you want change band please refer to http://eko.one.pl/?p=modem-r11elte.
Axinno