Android RIL module non-startup interface networking practice (2)

Source: Internet
Author: User

Address: http://yangyangzhao.blog.163.com/blog/static/17581636620101163758306/

 

In the non-startup interface networking practice of the android RIL module (I), we finally found that we only need to call the radiooptions program to achieve the goal of networking. Everything seems simple.

Actually how? Call radiooptions In the android shell to obtain its usage

Bash-4.1 # radiooptions
Usage: radiooptions [Option] [extra_socket_args]
0-radio_reset,
1-radio_off,
2-unsol_network_state_change,
3-qxdm_enable,
4-qxdm_disable,
5-radio_on,
6 APN-setup_pdp APN,
7-deactive_pdp,
8 number-dial_call number,
9-answer_call,
10-end_call
: Unknown error: 0

First, call radio on (in fact, I tried the experiment when the interface has been started, so I don't need to call it specifically). I found that the log is as follows:

Bash-4.1 # radiooptions 5
I/rilc (110): debug port: Radio on
D/rilc (110): c [locl]> radio_power
Bash-4.1 # D/rilc (110): c [locl] <radio_power
D/rilc (110): c [locl]> set_network_selection_automatic
D/rilj (1673): [unsl] <unsol_response_network_state_changed
D/rilj (1673): [0233]> Operator
D/rilc (110): c [locl] <set_network_selection_automatic

It seems that libril will try to find a network operator after receiving the radio on message, and then try to connect to setup data call. I am using a mobile card, so the APN name is cmnet, so we try to pass in the cmnet Parameter

Bash-4.1 # radiooptions 6 cmnet
I/rilc (110): debug port: setup data call, APN: cmnet
D/rilc (110): c [locl]> setup_data_call
Bash-4.1 # E/rilj (190): Hit EOS reading message length
I/rilj (190): disconnected from 'rild' socket
D/rilb (190): policying: Radio not available
D/rilb (190): policying: radio off or not available
D/GSM (190): poll servicestate done: oldss = [0 home (n/a) 46000 edge CSS not supported-1-1 roamind: -1 defroamind:-1] newss = [1 home null unknown CSS not supported-1-1 roamind:-1 defroamind: -1] oldgprs = 0 newgprs = 0 oldtype = edge newtype = edge

D/rilj (190): [0000]> get_current_cils
D/rilj (190): [0000] <get_current_callerror: COM. Android. Internal. telephony. commandexception: radio_not_available

D/GSM (190): gsmdataconntrack handlemessage {What = 12 when = 547391 OBJ = Android. OS. asyncresult @ 45ce59c8}

D/GSM (190): [gsmdataconnectiontracker] radio is off and clean up all connection

D/GSM (190): [gsmdataconnectiontracker] Clean Up Connection due to radioturnedoff

D/GSM (190): [gsmdataconnectiontracker] setstate: Disconnecting
D/GSM (190): [pdpconnection] dataconnection. clearsettings ()
D/GSM (190): [dataconnection] Stop poll netstat
D/GSM (190): [gsmdataconnectiontracker] setstate: idle
D/GSM (190): [icccard] broadcasting intent action_sim_state_changed not_ready reason null

D/rilj (190): [0001]> request_get_neighboring_cell_ids
D/rilj (190): [0001] <request_get_neighboring_cell_ids error: COM. Android. Internal. telephony. commandexception: radio_not_available

I/rilj (190): connected to 'rild' socket
I/rilc (468): libril: New Connection
I/rilc (468): RIL daemon version: HTC-RIL 1.6.1053g (Feb 2 2010,21: 48: 07)
D/rilj (190): [unsl] <unsol_response_radio_state_changed radio_unavailable

After the above log is output, the cell phone signal is gone ........... -_-| After the phone is restarted, the signal can finally be found.

It seems that using radiooptions to setup data call is not feasible. Let's see how to connect to GPRS on the interface. I opened the mobile network option and found that it is connected to the network in this way.

D/rilj (190): [0079]> setup_data_call 1 0 cmnet none 3
D/GSM (190): [gsmdataconnectiontracker] setstate: initing
D/rilj (190): [unsl] <unsol_data_call_list_changed [datacallstate: {CID: 1, active: 2, type: IP, APN: cmnet, address: 10.129.168.228}, datacallstate: {CID:-1, active: 0, type:, APN:, address:}, datacallstate: {CID:-1, active: 0, type:, APN:
, Address:}]
D/GSM (190): gsmdataconntrack handlemessage {What = 6 when = 466064 OBJ = Android. OS. asyncresult @ 45c701b8}

D/rilj (190): [0079] <setup_data_call {1, rmnet0, 10.129.168.228}

What is the difference between connecting to the network with radiooptions? There are many more parameters. setup_data_call 1 0 cmnet none 3. Here there are 6 parameters, while radiooptions only has one parameter, of course it won't work. Let's look at the libril and refrence-RIL code.

 
 
  1. static void requestSetupDataCall(void *data, size_t datalen, RIL_Token t) //refrence-ril
  2. {
  3. const char *apn;
  4. char *cmd;
  5. int err;
  6. ATResponse *p_response = NULL;
  7. char *response[2] = { "1", PPP_TTY_PATH };
  8.  
  9. apn = ((const char **)data)[2];
  10.  

 
 
  1. static void debugCallback (int fd, short flags, void *param) { //libril
  2. int acceptFD, option;
  3. struct sockaddr_un peeraddr;
  4. socklen_t socklen = sizeof (peeraddr);
  5. int data;
  6. unsigned int qxdm_data[6];
  7. const char *deactData[1] = {"1"};
  8. char *actData[1];
  9. RIL_Dial dialData;
  10. int hangupData[1] = {1};
  11. int number;
  12. char **args;
  13.  
  14. //blabla
  15. case 6:
  16. LOGI("Debug port: Setup Data Call, Apn :%s\n", args[1]);
  17. actData[0] = args[1];
  18. issueLocalRequest(RIL_REQUEST_SETUP_DATA_CALL, &actData,
  19. sizeof(actData));
  20. break;
  21.  

Note that only one parameter is passed in libril, And the APN parameter in reference-RIL is obtained from the second parameter. In this way, the reference-RIL will be crash if it is forcibly converted, it's no wonder that after I call it that way, there will be no signal on the phone...

After finding out the error, it will be much easier to change it. First, you need to change the parameter passed to reference-RIL in libril. Here I changed it directly.

 
 
  1. issueLocalRequest(RIL_REQUEST_SETUP_DATA_CALL, /*&actData,
  2.   sizeof(actData));*/
  3. &args[1], 6*sizeof(args[1]));
  4.  

Then, remove the setup data call Parameter Restriction in radiooptions.

Therefore, this problem is completely solved. I don't know if this is a bug in RIL?

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.