Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion drivers/rilmodem/gprs.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,14 +214,19 @@ 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
* the actual modem's state in the 'attached_status' function.
* 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.
Expand Down
26 changes: 7 additions & 19 deletions unit/test-rilmodem-gprs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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[] = {
{
Expand Down Expand Up @@ -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
},
};

Expand Down