summaryrefslogtreecommitdiff
path: root/sys/dev/usb
diff options
context:
space:
mode:
authorStuart Henderson <sthen@cvs.openbsd.org>2021-07-04 19:22:33 +0000
committerStuart Henderson <sthen@cvs.openbsd.org>2021-07-04 19:22:33 +0000
commit599a5b60ae6421481d1c471377405b41d63b3095 (patch)
tree136001103a6167ab1ba6703dd5dd8e7d0165b075 /sys/dev/usb
parent09a791688aed0f5980e16a2eba19339640528963 (diff)
store provider ID in umb(4), and display it in ifconfig. OK stsp deraadt
Previously only the provider's display name was used. The text used depends on how the SIM is configured and not just on the network in use (for example, an MVNO SIM on another network will often display the MVNO's name rather than that of the underlying network). I have a SIM that roams to any network in my country - whichever network it roams onto, the display name is the same, so you can't tell which network you're really using. By printing the provider ID (in GSM-land this is MCC+MNC) it's easy to lookup and check this. As the provider was printed on the ifconfig line also showing subscriber-id and ICCID it was already a bit long, and adding the provider-id there is a bit too much, so move it to the output line showing APN, now looking like : subscriber-id 2400xxxxxxxxxxx ICC-id 8946203xxxxxxxxxxxxx : device EM7455 IMEI 01458xxxxxxxxxx firmware SWI9X30C_02.24.0 : APN key provider Tele2 IoT provider-id 23420
Diffstat (limited to 'sys/dev/usb')
-rw-r--r--sys/dev/usb/if_umb.c5
-rw-r--r--sys/dev/usb/if_umb.h4
2 files changed, 6 insertions, 3 deletions
diff --git a/sys/dev/usb/if_umb.c b/sys/dev/usb/if_umb.c
index 9c585cf61af..2dac7d3fd1d 100644
--- a/sys/dev/usb/if_umb.c
+++ b/sys/dev/usb/if_umb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_umb.c,v 1.45 2021/05/18 14:23:03 kevlo Exp $ */
+/* $OpenBSD: if_umb.c,v 1.46 2021/07/04 19:22:31 sthen Exp $ */
/*
* Copyright (c) 2016 genua mbH
@@ -1490,9 +1490,10 @@ umb_decode_register_state(struct umb_softc *sc, void *data, int len)
sc->sc_info.regmode = letoh32(rs->regmode);
sc->sc_info.cellclass = letoh32(rs->curcellclass);
- /* XXX should we remember the provider_id? */
umb_getinfobuf(data, len, rs->provname_offs, rs->provname_size,
sc->sc_info.provider, sizeof (sc->sc_info.provider));
+ umb_getinfobuf(data, len, rs->provid_offs, rs->provid_size,
+ sc->sc_info.providerid, sizeof (sc->sc_info.providerid));
umb_getinfobuf(data, len, rs->roamingtxt_offs, rs->roamingtxt_size,
sc->sc_info.roamingtxt, sizeof (sc->sc_info.roamingtxt));
diff --git a/sys/dev/usb/if_umb.h b/sys/dev/usb/if_umb.h
index 082c0f0acd9..0b602b54258 100644
--- a/sys/dev/usb/if_umb.h
+++ b/sys/dev/usb/if_umb.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_umb.h,v 1.9 2021/03/30 15:59:04 patrick Exp $ */
+/* $OpenBSD: if_umb.h,v 1.10 2021/07/04 19:22:32 sthen Exp $ */
/*
* Copyright (c) 2016 genua mbH
@@ -282,6 +282,8 @@ struct umb_info {
uint32_t cellclass;
#define UMB_PROVIDERNAME_MAXLEN 20
uint16_t provider[UMB_PROVIDERNAME_MAXLEN];
+#define UMB_PROVIDERID_MAXLEN 20
+ uint16_t providerid[UMB_PROVIDERID_MAXLEN];
#define UMB_PHONENR_MAXLEN 22
uint16_t pn[UMB_PHONENR_MAXLEN];
#define UMB_SUBSCRIBERID_MAXLEN 15