Skip to content

Commit d214738

Browse files
authored
fix(driver/mbim): better support for single slot devices (#416)
Modems that only have one sim slot may respond with NO_DEVICE_SUPPORT when we try to request the sim slot mapping in preparation for sim selection. This is (arguably) correct behavior when we're trying to select a sim slot that isn't there, but when we want to access slot 0, we shouldn't complain about it. So catch the situation where we receive the NO_DEVICE_SUPPORT error and consider the switch action successful if we're trying to access the first and only sim slot. While we're here, slightly improve two error lines to better indicate what's going wrong. Tested with EM7590 and EM9291 configured for only a single sim slot (`AT!CUSTOM="UIM2ENABLE",0`). Signed-off-by: Frans Klaver <frans.klaver@vislink.com>
1 parent e5a3099 commit d214738

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

driver/apdu/mbim.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,11 @@ static int select_sim_slot(struct mbim_data *mbim_priv) {
5454
g_autoptr(MbimMessage) current_slot_response =
5555
mbim_device_command_sync(mbim_priv->device, mbim_priv->context, current_slot_request, &error);
5656
if (!current_slot_response) {
57-
fprintf(stderr, "error: device didn't respond: %s\n", error->message);
57+
if (error->code == MBIM_STATUS_ERROR_NO_DEVICE_SUPPORT && mbim_priv->uim_slot == 0) {
58+
return 0;
59+
}
60+
61+
fprintf(stderr, "error: unable to query slot mapping: %s\n", error->message);
5862
return -1;
5963
}
6064

@@ -85,7 +89,7 @@ static int select_sim_slot(struct mbim_data *mbim_priv) {
8589
g_autoptr(MbimMessage) update_slot_response =
8690
mbim_device_command_sync(mbim_priv->device, mbim_priv->context, update_slot_request, &error);
8791
if (!update_slot_response) {
88-
fprintf(stderr, "error: device didn't respond: %s\n", error->message);
92+
fprintf(stderr, "error: unable to select sim slot: %s\n", error->message);
8993
return -1;
9094
}
9195

0 commit comments

Comments
 (0)