After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 559488 - notify of SIM card failure
notify of SIM card failure
Status: RESOLVED OBSOLETE
Product: NetworkManager
Classification: Platform
Component: Mobile broadband
0.7.x
Other All
: Normal enhancement
: ---
Assigned To: NetworkManager maintainer(s)
NetworkManager maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2008-11-05 19:21 UTC by Antti Kaijanmäki
Modified: 2020-11-12 14:26 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Antti Kaijanmäki 2008-11-05 19:21:51 UTC
Please describe the problem:
If SIM-card is missing or not placed correctly NetworkManager does not inform the user about the situation. 

Steps to reproduce:
1. Remove the SIM-card from a mobile broadband modem
2. plug in the modem
3. try to activate a connection with that modem


Actual results:
User sees only "Disconnected" error and NM prints:

NetworkManager: <debug> [1225911597.081591] nm_serial_device_open(): (ttyUSB2) opening device...
NetworkManager: <info>  Activation (ttyUSB2) Stage 1 of 5 (Device Prepare) complete.
NetworkManager: <WARN>  check_pin_done(): PIN checking failed
NetworkManager: <info>  (ttyUSB2): device state change: 4 -> 9
NetworkManager: <debug> [1225911601.001497] nm_serial_device_close(): Closing device 'ttyUSB2'


Expected results:
nm-applet should display an error dialog saying:
"
SIM-card is not inserted or not in place.
Please, insert a SIM-card and make sure the card is placed properly according to the instructions manual. The SIM might also be misaligned, try to move it around a bit"

Does this happen every time?
yes.

Other information:
I have this Vodafone ExpressCard mobile broadband modem which has the stupidest SIM-slot I have never seen. The SIM can move like 1cm inside the slot and it's really hard to find the correct spot for the SIM. And on top of this you can easily place the SIM upside down as there is no instructions on the cards surface and the SIM fits there with ease. This is why the error dialog should also mention the misalignment.

I had to use cu to get the hang of the problem and to find the correct spot:

$ cu -s 115200 -l /dev/ttyUSB2 
Connected.
at+cpin?
+CME ERROR: SIM not inserted

(after moving the SIM around a while)
antti@starbacon:~/ppp-2.4.4rel$ cu -s 115200 -l /dev/ttyUSB2 
Connected.
at+cpin?
+CPIN: SIM PIN

OK
Comment 1 Dan Williams 2009-04-08 22:08:08 UTC
Probably has to wait for ModemManager since it's highly device dependent.  Other cards I've seen handle the errors differently, or the error simply doesn't refer to the SIM at all.
Comment 2 Marius Kotsbak 2013-02-02 19:43:32 UTC
(In reply to comment #1)
> Probably has to wait for ModemManager since it's highly device dependent. 
> Other cards I've seen handle the errors differently, or the error simply
> doesn't refer to the SIM at all.

Still not fixed with ModemManager:

Latest modemmanager master branch gives in log:

Feb 2 20:21:24 marius-T1005 ModemManager[1105]: <warn> Modem couldn't be initialized: Couldn't check unlock status: SIM failure

but there is no indication to the user (nm-applet behaves as if mobile broadband is unavailable).

Seems I get (from "src/mm-error-helpers.c"):

    { MM_MOBILE_EQUIPMENT_ERROR_SIM_FAILURE, "simfailure", "SIM failure" },

but should have got:

{ MM_MOBILE_EQUIPMENT_ERROR_SIM_NOT_INSERTED, "simnotinserted", "SIM not inserted" }

Anyway (any of them should be enough hint to the user), it seems like the error state is not propagated (src/mm-broadband-modem.c):

static void
iface_modem_initialize_ready (MMBroadbandModem *self,
                              GAsyncResult *result,
                              InitializeContext *ctx)
{
    GError *error = NULL;

    /* If the modem interface fails to get initialized, we will move the modem
     * to a FAILED state. Note that in this case we still export the interface. */
    if (!mm_iface_modem_initialize_finish (MM_IFACE_MODEM (self), result, &error)) {
        /* Report the new FAILED state */
        mm_warn ("Modem couldn't be initialized: %s", error->message);
        g_error_free (error);

        mm_iface_modem_update_state (MM_IFACE_MODEM (self),
                                     MM_MODEM_STATE_FAILED,
                                     MM_MODEM_STATE_CHANGE_REASON_UNKNOWN);

        /* Jump to the firmware step. We allow firmware switching even in failed
         * state */
        ctx->step = INITIALIZE_STEP_IFACE_FIRMWARE;
        initialize_step (ctx);
        return;
    }

Downstream bug report: https://bugs.launchpad.net/network-manager/+bug/1113703
Comment 3 Marius Kotsbak 2013-02-04 19:48:57 UTC
I tested using modem manager 0.6 (Ubuntu Precise) now with an external USB modem, where the missing SIM is not detected at init and thus the device is in the modem device list and it is possible to try connecting. When I do:

MM reports:

NetworkManager[5163]: <info> Activation (ttyUSB0) Stage 1 of 5 (Device Prepare) scheduled...
NetworkManager[5163]: <info> Activation (ttyUSB0) Stage 1 of 5 (Device Prepare) started...
NetworkManager[5163]: <info> Activation (ttyUSB0) Stage 1 of 5 (Device Prepare) complete.
NetworkManager[5163]: <warn> GSM modem enable failed: (32) Failed to find a usable modem character set
NetworkManager[5163]: <debug> [1360004871.251768] [nm-modem-gsm.c:150] translate_mm_error(): unmapped dbus error detected: 'org.freedesktop.ModemManager.Modem.UnsupportedCharset'
NetworkManager[5163]: <info> (ttyUSB0): device state change: prepare -> failed (reason 'modem-init-failed') [40 120 28]
NetworkManager[5163]: <debug> [1360004871.252465] [nm-manager.c:512] manager_device_state_changed(): stopping connectivity checks
NetworkManager[5163]: <warn> Activation (ttyUSB0) failed for connection 'Netcom Default'
NetworkManager[5163]: <debug> [1360004871.253379] [nm-device.c:4626] nm_device_queue_state(): (ttyUSB0): queued state change to disconnected (id 68)
NetworkManager[5163]: <debug> [1360004871.254205] [nm-device.c:4594] queued_set_state(): (ttyUSB0): running queued state change to disconnected (id 68)

And Network manager reports:

modem-manager[3823]: <debug> [1360004871.202712] [mm-at-serial-port.c:334] debug_log(): (ttyUSB2): --> 'AT^SYSCFG?<CR>'
modem-manager[3823]: <debug> [1360004871.217798] [mm-at-serial-port.c:334] debug_log(): (ttyUSB2): <-- '<CR><LF>^SYSCFG:2,0,3FFFFFFF,1,2<CR><LF><CR><LF>OK<CR><LF>'
modem-manager[3823]: <debug> [1360004871.218155] [mm-at-serial-port.c:334] debug_log(): (ttyUSB2): --> 'AT+CLCK=?<CR>'
modem-manager[3823]: <debug> [1360004871.231332] [mm-at-serial-port.c:334] debug_log(): (ttyUSB2): <-- '<CR><LF>+CME ERROR: 13<CR><LF>'
modem-manager[3823]: <debug> [1360004871.231572] [mm-serial-parsers.c:448] mm_serial_parser_v1_parse(): Got failure code 13: SIM failure
modem-manager[3823]: <debug> [1360004871.231668] [mm-serial-port.c:908] mm_serial_port_close(): (ttyUSB2) device open count is 1 (close)
modem-manager[3823]: <debug> [1360004871.231828] [mm-at-serial-port.c:334] debug_log(): (ttyUSB2): --> 'AT+CSCS=?<CR>'
modem-manager[3823]: <debug> [1360004871.244115] [mm-at-serial-port.c:334] debug_log(): (ttyUSB2): <-- '<CR><LF>+CME ERROR: 13<CR><LF>'
modem-manager[3823]: <debug> [1360004871.244339] [mm-serial-parsers.c:448] mm_serial_parser_v1_parse(): Got failure code 13: SIM failure
modem-manager[3823]: <debug> [1360004871.244566] [mm-at-serial-port.c:334] debug_log(): (ttyUSB2): --> 'AT+CMER=3,0,0,1<CR>'
modem-manager[3823]: <info>  [1360004871.245531] [mm-modem.c:764] mm_modem_set_state(): Modem /org/freedesktop/ModemManager/Modems/1: state changed (enabling -> disabled)
modem-manager[3823]: <debug> [1360004871.245635] [mm-serial-port.c:908] mm_serial_port_close(): (ttyUSB2) device open count is 0 (close)
modem-manager[3823]: <info>  [1360004871.245700] [mm-serial-port.c:924] mm_serial_port_close(): (ttyUSB2) closing serial port...
modem-manager[3823]: <info>  [1360004871.246878] [mm-serial-port.c:956] mm_serial_port_close(): (ttyUSB2) serial port closed

Thus it seems like the information about the SIM failure is lost by NM, or shadowed by the first unimportant error?

Then nm-applet looses even more information by just saying connection error.
Comment 4 Marius Kotsbak 2013-02-05 00:22:00 UTC
Seems like MM sends a symptom error message instead of the returned error message. In src/mm-generic-gsm.c:enabled_set_charset_done(...):

       if (best_charsets[idx] == MM_MODEM_CHARSET_UNKNOWN) {
            GError *tmp_error;

            /* No more character sets we can use */
            tmp_error = g_error_new_literal (MM_MODEM_ERROR,
                                             MM_MODEM_ERROR_UNSUPPORTED_CHARSET,
                                             "Failed to find a usable modem character set");
            enable_failed (modem, tmp_error, info);
            g_error_free (tmp_error);

I do not understand why it doesn't stop at the response "+CME ERROR: 13" to "AT+CSCS=?". Anyway, I think MM should return all unexpected errors directly to NM.
Comment 5 Marius Kotsbak 2013-03-12 19:10:45 UTC
Now that bug #691778 is solved, is there any more to do in network manager or is it just updating of the GUI clients left?
Comment 6 Aleksander Morgado 2013-03-12 20:38:00 UTC
(In reply to comment #5)
> Now that bug #691778 is solved, is there any more to do in network manager or
> is it just updating of the GUI clients left?

Well, NM needs to avoid skipping modems in Failed state, which is something that we currently do when using MM >= 0.7. Have a branch for that already, just need to test it.
Comment 7 André Klapper 2020-11-12 14:26:37 UTC
bugzilla.gnome.org is being shut down in favor of a GitLab instance. 
We are closing all old bug reports and feature requests in GNOME Bugzilla which have not seen updates for a long time.

If you still use NetworkManager and if you still see this bug / want this feature in a recent and supported version of NetworkManager, then please feel free to report it at https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/

Thank you for creating this report and we are sorry it could not be implemented (workforce and time is unfortunately limited).