diff options
-rw-r--r-- | net.c | 47 | ||||
-rw-r--r-- | samsung-ril.c | 2 | ||||
-rw-r--r-- | samsung-ril.h | 2 |
3 files changed, 28 insertions, 23 deletions
@@ -102,12 +102,12 @@ unsigned char ipc2ril_modesel(unsigned char mode) { switch(mode) { case 0: - return 7; - case 1: - case 3: + return 7; // auto mode + case IPC_NET_MODE_GSM_UMTS: + return 0; + case IPC_NET_MODE_GSM_ONLY: return 1; - case 2: - case 4: + case IPC_NET_MODE_UMTS_ONLY: return 2; default: return 255; @@ -120,12 +120,13 @@ unsigned char ipc2ril_modesel(unsigned char mode) unsigned char ril2ipc_modesel(unsigned char mode) { switch(mode) { - case 1: - return 2; - case 2: - return 3; - default: - return 1; + case 1: // GSM only + return IPC_NET_MODE_GSM_ONLY; + case 2: // WCDMA only + return IPC_NET_MODE_UMTS_ONLY; + case 0: + default: // GSM/WCDMA + the rest + return IPC_NET_MODE_GSM_UMTS; } } @@ -719,23 +720,27 @@ void ril_request_query_network_selection_mode(RIL_Token t) RIL_onRequestComplete(t, RIL_E_SUCCESS, &mode, sizeof(mode)); } -void ril_request_get_preferred_network_type(RIL_Token t) +void ril_request_set_preferred_network_type(RIL_Token t, void *data, size_t datalen) { - ipc_fmt_send_get(IPC_NET_MODE_SEL, reqGetId(t)); + int ril_mode = *(int*)data; + struct ipc_net_mode_sel mode_sel; + + mode_sel->mode = ril2ipc_modesel(ril_mode); + + ipc_gen_phone_res_expect_to_complete(reqGetId(t), IPC_NET_MODE_SEL); + + ipc_fmt_send(IPC_NET_MODE_SEL, IPC_TYPE_SET, &mode_sel, sizeof(mode_sel), reqGetId(t)); } -void ril_request_set_preffered_network_type(RIL_Token t, void *data, size_t datalen) +void ril_request_get_preferred_network_type(RIL_Token t) { - int ril_mode = *(int*)data; - unsigned char ipc_mode = ril2ipc_modesel(ril_mode); - - ipc_fmt_send(IPC_NET_MODE_SEL, IPC_TYPE_SET, &ipc_mode, sizeof(ipc_mode), reqGetId(t)); + ipc_fmt_send_get(IPC_NET_MODE_SEL, reqGetId(t)); } void ipc_net_mode_sel(struct ipc_message_info *info) { - unsigned char ipc_mode = *(unsigned char *) info->data; - int ril_mode = ipc2ril_modesel(ipc_mode); + struct ipc_net_mode_sel *mode_sel = (struct ipc_net_mode_sel *) info->data; + int ril_mode = ipc2ril_modesel(mode_sel->mode); - RIL_onRequestComplete(reqGetToken(info->aseq), RIL_E_SUCCESS, &ril_mode, sizeof(int*)); + RIL_onRequestComplete(reqGetToken(info->aseq), RIL_E_SUCCESS, &ril_mode, sizeof(int)); } diff --git a/samsung-ril.c b/samsung-ril.c index fc88514..b6d76e3 100644 --- a/samsung-ril.c +++ b/samsung-ril.c @@ -399,7 +399,7 @@ void onRequest(int request, void *data, size_t datalen, RIL_Token t) ril_request_get_preferred_network_type(t); break; case RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE: - ril_request_set_preffered_network_type(t, data, datalen); + ril_request_set_preferred_network_type(t, data, datalen); break; /* SMS */ case RIL_REQUEST_SEND_SMS: diff --git a/samsung-ril.h b/samsung-ril.h index 2294cc4..a9221e1 100644 --- a/samsung-ril.h +++ b/samsung-ril.h @@ -263,7 +263,7 @@ void ril_request_query_available_networks(RIL_Token t); void ipc_net_plmn_list(struct ipc_message_info *info); void ril_request_query_network_selection_mode(RIL_Token t); void ril_request_get_preferred_network_type(RIL_Token t); -void ril_request_set_preffered_network_type(RIL_Token t, void *data, size_t datalen); +void ril_request_set_preferred_network_type(RIL_Token t, void *data, size_t datalen); void ipc_net_mode_sel(struct ipc_message_info *info); /* SMS */ |