diff --git a/drivers/rilmodem/gprs.c b/drivers/rilmodem/gprs.c index 4adb8987e..7ef2a8d94 100644 --- a/drivers/rilmodem/gprs.c +++ b/drivers/rilmodem/gprs.c @@ -214,7 +214,7 @@ void ril_gprs_set_attached(struct ofono_gprs *gprs, int attached, DBG("attached: %d", attached); - if (g_ril_get_version(gd->ril) < 10) { + if (g_ril_get_version(gd->ril) < 10 || attached == 0) { /* * Older RILs offer no actual control over the GPRS 'attached' * state, we save the desired state, and use it to override @@ -222,6 +222,11 @@ void ril_gprs_set_attached(struct ofono_gprs *gprs, int attached, * This is similar to the way the core ofono gprs code handles * data roaming ( see src/gprs.c gprs_netreg_update() ). * + * Additionally, we never explicitly detach because some broken + * rils are not able to re-attach again after that (fp2). Note + * however that we will still detach when switching the active + * data SIM in the multi-sim case (see code in this function). + * * The core gprs code calls driver->set_attached() when a netreg * notificaiton is received and any configured roaming * conditions are met. diff --git a/unit/test-rilmodem-gprs.c b/unit/test-rilmodem-gprs.c index f444123d6..e8a57b4b5 100644 --- a/unit/test-rilmodem-gprs.c +++ b/unit/test-rilmodem-gprs.c @@ -169,19 +169,13 @@ static void call_set_attached_2_7(gpointer data) rilmodem_test_engine_next_step(gprs->engined); } -/* REQUEST_ALLOW_DATA, seq 3, set to not attach */ -static const char parcel_req_allow_data_2_8[] = { - 0x00, 0x00, 0x00, 0x10, 0x7B, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -}; - /* Response, no error */ -static const char parcel_rsp_allow_data_2_9[] = { +static const char parcel_rsp_allow_data_2_8[] = { 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static void check_set_attached_2_10(const struct ofono_error *error, +static void check_set_attached_2_9(const struct ofono_error *error, struct ofono_gprs *gprs) { g_assert(error->type == OFONO_ERROR_TYPE_NO_ERROR); @@ -196,9 +190,8 @@ static void check_set_attached_2_10(const struct ofono_error *error, * Step 5: Driver calls ofono_gprs_register * Step 6: Driver calls ofono_gprs_set_cid_range * Step 7: Harness calls drv->set_attached(false) - * Step 8: Driver sends REQUEST_ALLOW_DATA - * Step 9: Harness answers with no error - * Step 10: Driver calls the callback specified in step 7 + * Step 8: Harness answers with no error + * Step 9: Driver calls the callback specified in step 7 */ static const struct rilmodem_test_step steps_test_2[] = { { @@ -235,20 +228,15 @@ static const struct rilmodem_test_step steps_test_2[] = { .type = TST_ACTION_CALL, .call_action = call_set_attached_2_7, }, - { - .type = TST_EVENT_RECEIVE, - .parcel_data = parcel_req_allow_data_2_8, - .parcel_size = sizeof(parcel_req_allow_data_2_8) - }, { .type = TST_ACTION_SEND, - .parcel_data = parcel_rsp_allow_data_2_9, - .parcel_size = sizeof(parcel_rsp_allow_data_2_9) + .parcel_data = parcel_rsp_allow_data_2_8, + .parcel_size = sizeof(parcel_rsp_allow_data_2_8) }, { .type = TST_EVENT_CALL, .call_func = (void (*)(void)) ofono_gprs_cb, - .check_func = (void (*)(void)) check_set_attached_2_10 + .check_func = (void (*)(void)) check_set_attached_2_9 }, };