[OpenWrt-Devel] [PATCH 1/2] wwan: Add support for CDC (Huawei 'HiLink') Modems

Jakub Jančo kubco2 at gmail.com
Tue Mar 1 04:34:30 EST 2016


On Tue, Mar 1, 2016 at 9:43 AM, John Crispin <blogic at openwrt.org> wrote:
> i have spent ages thinking about this. the main problem is that the unit
> wont go online unless we previously set the apn/pin, ... in the webui.
> although having a unified wwan proto is great and we should have hilink
> support in it, i fear that this will be rather ambiguous to users as
> they set the pin in uci and then it wont get applied. so i have heavy
> heartedly decided to NAK this. i wish i had more time so we could hack
> up a tiny tool to set the webui setting from uci. although that is
> really would be an ugly hack.

By the way - mikrotik devices has PIN and APN settings for hilink too.
Maybe there are some devices which support it - it didnt work for me,
I had to set up things over webif.

I have done hack with wget to set PIN(huawei 3372h), but it is
umaintained for now and I cant test it because we have device on
"production" router.
Problem can be a lot of APIs. And it needs to be able use cookies and
post data.(If I remember I had to download full wget)


If someone want play with it:
In connect.post the PIN code is not variabled.
----------- config.sh
#!/bin/sh
gateway_ip="192.168.8.1"
base_url="http://${gateway_ip}"
cookie_file="/tmp/cookie"
connect_data="connect.post"
connect_url="${base_url}/api/dialup/mobile-dataswitch"
unlocksim_data="unlocksim.post"
unlocksim_url="${base_url}/api/pin/operate"

token_url="${base_url}/html/home.html"
request_token=$(wget -q -t 0 "$token_url" -O - --save-cookies
"$cookie_file" --keep-session-cookies | grep csrf_token | head -n1 |
cut -d'"' -f4)
----------------------------------------------------------------------------------------------------------------------------------------------------------
----------- connect.sh
#!/bin/sh

. config.sh

[ -n "$request_token" ] || {
    echo No request token found
    exit 1
}

wget -q -t 0 --load-cookies "$cookie_file"
--header="__RequestVerificationToken: $request_token" \
   --post-file="$connect_data" "$connect_url" -O -
----------------------------------------------------------------------------------------------------------------------------------------------------------
----------- unlocksim.sh
#!/bin/sh

. config.sh

[ -n "$request_token" ] || {
    echo No request token found
    exit 1
}

wget -q -t 0 --load-cookies "$cookie_file"
--header="__RequestVerificationToken: $request_token" \
    --post-file="$unlocksim_data" "$unlocksim_url" -O -
----------------------------------------------------------------------------------------------------------------------------------------------------------
----------- connect.post
<?xml version="1.0"
encoding="UTF-8"?><request><dataswitch>0</dataswitch></request>
----------------------------------------------------------------------------------------------------------------------------------------------------------
----------- connect.post
<request><OperateType>0</OperateType><CurrentPin>0000</CurrentPin><NewPin></NewPin><PukCode></PukCode></request>
----------------------------------------------------------------------------------------------------------------------------------------------------------










--
S pozdravom Jakub Janco
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list