@@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=uqmi
-PKG_RELEASE:=5
+PKG_RELEASE:=6
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/uqmi.git
@@ -10,6 +10,7 @@ proto_qmi_init_config() {
available=1
no_device=1
proto_config_add_string "device:device"
+ proto_config_add_string imsi
proto_config_add_string apn
proto_config_add_string auth
proto_config_add_string username
@@ -28,12 +29,12 @@ proto_qmi_init_config() {
proto_qmi_setup() {
local interface="$1"
- local dataformat connstat
- local device apn auth username password pincode delay modes pdptype profile dhcpv6 autoconnect plmn timeout $PROTO_DEFAULT_OPTIONS
+ local dataformat connstat imsi_actual
+ local device imsi apn auth username password pincode delay modes pdptype profile dhcpv6 autoconnect plmn timeout $PROTO_DEFAULT_OPTIONS
local ip4table ip6table
local cid_4 pdh_4 cid_6 pdh_6
local ip_6 ip_prefix_length gateway_6 dns1_6 dns2_6
- json_get_vars device apn auth username password pincode delay modes pdptype profile dhcpv6 autoconnect plmn ip4table ip6table timeout $PROTO_DEFAULT_OPTIONS
+ json_get_vars device imsi apn auth username password pincode delay modes pdptype profile dhcpv6 autoconnect plmn ip4table ip6table timeout $PROTO_DEFAULT_OPTIONS
[ "$timeout" = "" ] && timeout="10"
@@ -83,6 +84,16 @@ proto_qmi_setup() {
fi
done
+ [ -n "$imsi" ] && {
+ imsi_actual="$(uqmi -s -d "$device" --get-imsi | cut -d'"' -f2)"
+ [ "$imsi" = "$imsi_actual" ] || {
+ echo "Configured IMSI doesn't match SIM card."
+ proto_notify_error "$interface" SIM_WRONG
+ proto_set_available "$interface" 0
+ return 1
+ }
+ }
+
if uqmi -s -d "$device" --get-pin-status | grep '"Not supported"' > /dev/null; then
[ -n "$pincode" ] && {
uqmi -s -d "$device" --verify-pin1 "$pincode" > /dev/null || uqmi -s -d "$device" --uim-verify-pin1 "$pincode" > /dev/null || {
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). We may need to add locking in dev.c function int qmi_device_open(struct qmi_dev *qmi, const char *path) to avoid multiple instances of uqmi operating on the same chardev. Signed-off-by: Daniel Golle <daniel@makrotopia.org> --- package/network/utils/uqmi/Makefile | 2 +- .../utils/uqmi/files/lib/netifd/proto/qmi.sh | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-)