[OpenWrt-Devel] [PATCH v3] uqmi: allow matching IMSI for qmi networks
Bjørn Mork
bjorn at mork.no
Mon Nov 5 12:09:33 EST 2018
Piotr Dymacz <pepe2k at gmail.com> writes:
> On 05.11.2018 00:46, Daniel Golle wrote:
>> Introduce 'imsi' configuration option for proto 'qmi' network
>> interfaces. Setting it makes sure the configuration only gets used
>> on the intended SIM card. In this way, one can have many configurations
>> for different SIM cards selected automatically when the card was either
>> swapped physically or in software (as possible on the APU3 board).
>> In order to allow multiple configurations using the same character
>> device, add locking in netifd protocol handler to avoid overlapping
>> execution of uqmi of the same device.
>
> As the general idea seems correct, I find it very limited and maybe
> problematic (is IMSI number always available before SIM is
> unlocked?). Personally, I would prefer to introduce a
> generic/universal solution, not limited to any of the wwan protocols.
I agree.
But you are right that ICCID is a much better SIM identificator. The
IMSI isn't available until after PIN unlocking. And the PIN code is
definitely one of the variables you might want to select by SIM... Using
IMSI makes this impossible.
Tested a few modems to see how they present the SIM state:
1) Huawei E3372h-153 (Telia branded), MBIM mode:
bjorn at miraculix:~$ umbim -d /dev/cdc-wdm1 -n caps
devicetype: 0002 - removable
cellularclass: 0001
voiceclass: 0001 - no-voice
simclass: 0002
dataclass: 8000003F
smscaps: 0003
controlcaps: 0001
maxsessions: 0003
deviceid: 86875702101xxxx
firmwareinfo: 22.200.05.00.07
hardwareinfo: CL2E3372HM
a) No SIM inserted (someone should fix the umbim error handling
here...):
bjorn at miraculix:~$ umbim -d /dev/cdc-wdm1 -t 4 -n subscriber
message not long enough
b) Valid SIM, PIN1 locked:
bjorn at miraculix:~$ umbim -d /dev/cdc-wdm1 -n -t 4 subscriber
readystate: 0006 - device-locked
simiccid: 8947030512101100xxxx
subscriberid: (null)
c) Unlocked:
bjorn at miraculix:~$ umbim -d /dev/cdc-wdm1 -n -t 4 subscriber
readystate: 0001 - initialized
simiccid: 8947030512101100xxxx
subscriberid: 24201305013xxxx
2) Huawei E392u-12, QMI:
bjorn at miraculix:~$ uqmi -d /dev/cdc-wdm1 --get-capabilities
{
"max_tx_channel_rate": 50000000,
"max_rx_channel_rate": 100000000,
"data_service": "simultaneous_cs_ps",
"sim": "supported",
"networks": [
"gsm",
"umts",
"lte"
]
}
a) No SIM inserted:
bjorn at miraculix:~$ uqmi -d /dev/cdc-wdm1 --get-imsi
"UIM uninitialized"
bjorn at miraculix:~$ uqmi -d /dev/cdc-wdm1 --get-iccid
"Invalid arguments given"
b) Valid SIM, PIN1 locked:
bjorn at miraculix:~$ uqmi -d /dev/cdc-wdm1 --get-imsi
"UIM uninitialized"
bjorn at miraculix:~$ uqmi -d /dev/cdc-wdm1 --get-iccid
"8947030111021700xxxx"
c) Unlocked:
bjorn at miraculix:~$ uqmi -d /dev/cdc-wdm1 --get-imsi
"24201301000xxxx"
bjorn at miraculix:~$ uqmi -d /dev/cdc-wdm1 --get-iccid
"8947030111021700xxxx"
3) D-Link DWM-156 A7 (Mediatek MTK2), MBIM mode
bjorn at miraculix:~$ umbim -d /dev/cdc-wdm1 -n caps
devicetype: 0002 - removable
cellularclass: 0001
voiceclass: 0003 - simultaneous-voice-data
simclass: 0002
dataclass: 001F
smscaps: 0003
controlcaps: 0001
maxsessions: 0002
deviceid: 35561905015xxxx
firmwareinfo: MOLY.WR8.W1231.DC.WG.MP.V3
hardwareinfo: MTK2
a) No SIM inserted:
bjorn at miraculix:~$ umbim -d /dev/cdc-wdm1 -n -t 4 subscriber
readystate: 0002 - sim-not-inserted
simiccid: (null)
subscriberid: (null)
b) Valid SIM, PIN1 locked:
bjorn at miraculix:~$ umbim -d /dev/cdc-wdm1 -n -t 4 subscriber
readystate: 0006 - device-locked
simiccid: 8947030111021700xxxx
subscriberid: (null)
c) Unlocked (cheated while unlocking, as this modem didn't play well with umbim):
bjorn at miraculix:~$ umbim -d /dev/cdc-wdm1 -n -t 4 subscriber
readystate: 0001 - initialized
simiccid: 8947030111021700xxxx
subscriberid: 24201301000xxxx
4) Huawei E367u-2, MBIM mode:
bjorn at miraculix:~$ umbim -d /dev/cdc-wdm1 -n caps
devicetype: 0002 - removable
cellularclass: 0001
voiceclass: 0001 - no-voice
simclass: 0002
dataclass: 8000001F
smscaps: 0003
controlcaps: 0001
maxsessions: 0001
deviceid: 35361304880xxxx
firmwareinfo: 11.810.09.00.00
hardwareinfo: CP1E367UM
a) No SIM inserted:
bjorn at miraculix:~$ umbim -d /dev/cdc-wdm1 -n -t 4 subscriber
message not long enough
b) Valid SIM, PIN1 locked:
bjorn at miraculix:~$ umbim -d /dev/cdc-wdm1 -n -t 4 subscriber
readystate: 0006 - device-locked
simiccid: 9874301011207100xxxx
subscriberid: (null)
c) Unlocked:
bjorn at miraculix:~$ umbim -d /dev/cdc-wdm1 -n -t 4 subscriber
readystate: 0001 - initialized
simiccid: 9874301011207100xxxx
subscriberid: 24201301000xxxx
5) Sierra Wireless EM7565, QMI mode
bjorn at miraculix:~$ uqmi -d /dev/cdc-wdm1 --get-capabilities
{
"max_tx_channel_rate": 50000000,
"max_rx_channel_rate": 100000000,
"data_service": "non_simultaneous_cs_ps",
"sim": "supported",
"networks": [
"umts",
"lte"
]
}
a) Has no support for UIM messages via DMS:
bjorn at miraculix:~$ uqmi -d /dev/cdc-wdm1 --get-imsi 2>/dev/null
"Not supported"
bjorn at miraculix:~$ uqmi -d /dev/cdc-wdm1 --get-iccid 2>/dev/null
"Not supported"
6) Sierra Wireless EM7455, MBIM mode
bjorn at miraculix:~$ umbim -d /dev/cdc-wdm0 -n caps
devicetype: 0003 - remote
cellularclass: 0001
voiceclass: 0001 - no-voice
simclass: 0002
dataclass: 003C
smscaps: 0003
controlcaps: 0001
maxsessions: 0008
deviceid: 01458200078xxxx
firmwareinfo: SWI9X30C_02.24.05.06
hardwareinfo: EM7455
a) No SIM inserted:
Didn't test - too much hassle removing the SIM from my laptop ;-)
b) Valid SIM, PIN1 locked:
bjorn at miraculix:~$ umbim -d /dev/cdc-wdm0 -n -t 4 subscriber
readystate: 0006 - device-locked
simiccid: 8947030512101100xxxx
subscriberid: (null)
c) Unlocked:
bjorn at miraculix:~$ umbim -d /dev/cdc-wdm0 -n -t 4 subscriber
readystate: 0001 - initialized
simiccid: 8947030512101100xxxx
subscriberid: 24201305013xxxx
> I've been using for years slightly different approach which, in the
> same or modified version, might suit better than your idea, also in
> multi-SIM and/or multi-modem solutions or for users often changing SIM
> cards in a single device. Let me try to explain the idea below.
>
> Instead of keeping SIM/operator related configuration (apn,
> pincode...) within the modem network configuration section (glued to a
> specific interface), we introduce a generic 'sim' config file
> (/etc/config/sim), as part of the wwan package, which by default
> contains only one, default configuration (no pin, no auth, generic
> apn, lets say: 'internet'). If the user wants to setup additional
> _SIM-specific_ configuration, section should be named with the SIM
> ICCID number, for example:
>
> config sim
> option apn 'internet'
>
> ...
>
> config sim '1234567890ABCDEFGHI'
> option apn 'internet6'
> option pincode '0000'
> option auth 'PAP'
> option username 'user'
> option password 'pass'
>
> ...
Moving the existing apn and auth parts from 'interface' config to new
'sim' sections will complicate stuff. Auto-converting the configs can
only solve part of the problem. Outdated docs is worse. And I don't see
a big upside here. Am I missing something?
AFIACS, you can define an 'interface' for each of your SIMs, and achieve
the same as separate 'sim' sections would do.
> SIM ICCID is known to the user (operators print it on the SIM itself)
> and available for the software in advance, even before pin-unlocking.
Yes
> Essentially, this idea maps whole or almost whole configuration
> required for Internet access to SIM, instead of the modem (or, device
> interface in system). During interface setup/bring-up, SIM
> configuration is searched for a specific section (based on the ICCID
> of the SIM in use) and in case it's missing, default one is used.
I believe you can do the same with multiple 'interface' sections,
where only the ones with a matching 'iccid' are activated?
> Of course, this approach requires all available wwan protocols to
> support fetching ICCID from the SIM and also inform the user about
> missing SIM-specific configuration if it's required (SIM requires PIN
> but SIM-specific configuration is missing).
> Plus, some kind of migration mechanism would be required for current
> solution (SIM configuration in network config file).
A common set of settings for all/most types of 3G/LTE modems would be
nice. But support for the remaining protocols can be added later, can't
it?
I think Daniel's patch looks like a fine start, assuming s/IMSI/ICCID/,
which doesn't prevent further work towards unified LTE modem
configuration.
Bjørn
_______________________________________________
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