[OpenWrt-Devel] umbim: registration set support
Ingo Feinerer
feinerer at logic.at
Thu Jan 10 09:57:59 EST 2019
Hi,
this mail gives a detailed background explanation and motivation for the patch
"[PATCH] umbim: add registration set support" (the analysis is probably too
lengthy to be included as a commit message).
I am using a Medion S4222 (MediaTek OEM) USB stick and it failed to
connect in OpenWrt:
# umbim -n -d /dev/cdc-wdm0 connect "drei.at"
sending (124): 03 00 00 00 7c 00 00 00 07 00 00 00 01 00 00 00 00 00 00 00 a2 89 cc 33 bc bb 8b 4f b6 b0 13 3e c2
aa e6 df 0c 00 00 00 01 00 00 00 4c 00 00 00 00 00 00 00 01 00 00 00 3c 00 00 00 0e 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 7e 5e 2a 7e 4e 6f 72 72 73 6b 65 6e 7e 5e 2a 7e 64
00 72 00 65 00 69 00 2e 00 61 00 74 00 00 00
header_type: 0003
header_length: 007C
header_transaction: 0007
reading (48): 03 00 00 80 30 00 00 00 07 00 00 00 01 00 00 00 00 00 00 00 a2 89 cc 33 bc bb 8b 4f b6 b0 13 3e c2 aa
e6 df 0c 00 00 00 07 00 00 00 00 00 00 00
header_type: 80000003
header_length: 0030
header_transaction: 0007
command_id: 000C
status_code: 0007
According to the MBIM specification the status code means:
MBIM_STATUS_NOT_REGISTERED 7
The operation failed because the device is not registered with any network.
Unfortunately, just calling the registration function in query mode
before the connect attempt is not enough in my setup:
# umbim -n -d /dev/cdc-wdm0 registration
nwerror: 0000 - unknown
registerstate: 0004 - roaming
registermode: 0001 - automatic
availabledataclasses: 0018 - (null)
currentcellularclass: 0001 - gsm
provider_id: 23205
provider_name: 23205
roamingtext: (null)
With the new function the connect method succeeds and gives me a working
IPv4 address.
# umbim -n -d /dev/cdc-wdm0 registration automatic
nwerror: 0000 - unknown
registerstate: 0003 - home
registermode: 0001 - automatic
availabledataclasses: 0018 - (null)
currentcellularclass: 0001 - gsm
provider_id: 23210
provider_name: 23210
roamingtext: (null)
As you see the registerstate is now "home" and there was a mobile
network code change (23205 -> 23210).
The MBIM specification mentions that both manual and automatic
registration could be possible. I only implemented automatic; this seems
to be in line with what mbimcli supports (--register-automatic); see
https://manpages.debian.org/stretch/libmbim-utils/mbimcli.1.en.html. I
assume that any argument (_argc > 0) triggers the setter so that the
call could look like
umbim ... registration automatic
or
umbim ... registration on
and allows one to extended it later for manual setting with additional
arguments for the manual registration process.
As the existing call convention (i.e., no arguments) is not modified
existing scripts (like /lib/netifd/proto/mbim.sh in OpenWrt) still
work without adaption.
Note that
rs->registeraction = htole32(MBIM_REGISTER_ACTION_AUTOMATIC)
is redundant as MBIM_REGISTER_ACTION_AUTOMATIC is defined as 0 (and the
whole buffer is memset to zero before) but I thought it is clearer for the
reader.
Thanks a lot for consideration!
Best regards,
Ingo
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list