[Q] Read and show a part of radio log

gtuxyco

Senior Member
Jan 13, 2012
77
10
0
Riohacha
Hi. I'm here because I need a little orientations about read and display a log of one process in the radio.
I have a 2 global phone, Motorola Droid 2 Global and Motorola Photon 4G both in GSM network, they can't display USSD code, every time i run a USSD code they show "MMI Complete" dialog.
Now i know Motofail dont make a real global phone...
But i find one interesting thing... when i use in terminal emulator "logcat -b radio" command, i recibe the result that would have to show the dialog in phone app.

I know programming in java but I know nothing about Android APIs.
I want to make an application that shows only part of the log that would be the response USSD code.
Here an example of the log and the red part is what I want to show

04-20 14:03:54.256 1409 1409 D GSM : dialing w/ mmi 'Handler{40804f70}'...
04-20 14:03:54.256 1409 1409 D RILJ : [0717]> SEND_USSD *10#
04-20 14:03:54.256 1197 1284 I RIL-MAIN: onReq: reqCode = 29, dataLen = 4
04-20 14:03:54.256 1197 1286 I RIL-MX : Ch0 > 0533AT+CUSD=1,*10#,0
04-20 14:03:54.256 1197 1286 I RIL-MX :
04-20 14:03:54.287 1197 1285 I RIL-MX : Read Ch0 << 0533+CUSD:eek:K
04-20 14:03:54.287 1409 1545 D RILJ : [0717]< SEND_USSD
04-20 14:03:54.342 1409 1409 D RILJ : [0718]> SET_MUTE false
04-20 14:03:54.342 1197 1284 I RIL-MAIN: onReq: reqCode = 53, dataLen = 4
04-20 14:03:54.342 1197 1286 I RIL-MX : Ch1 > 0534AT+CMUT=0
04-20 14:03:54.365 1197 1285 I RIL-MX : Read Ch1 << 0534+CMUT:eek:K
04-20 14:03:54.365 1409 1545 D RILJ : [0718]< SET_MUTE
04-20 14:03:54.592 1197 1285 I RIL-MX : Read Ch0 << 0294~+RSSI=0,15,99,99,0,0,0
04-20 14:03:54.599 1409 1409 D GSM : handleMessage what 12
04-20 14:03:55.334 1197 1285 I RIL-MX : Read Ch0 << 0295~+CREG=1,7,297D,00008D73,0,0,0,0,0,0
04-20 14:03:55.334 1409 1545 D RILJ : [UNSL]< UNSOL_RESPONSE_NETWORK_STATE_CHANGED
04-20 14:03:55.334 1409 1409 D GSM : handleMessage what 2
04-20 14:03:55.342 1409 1409 D RILJ : [0719]> OPERATOR
04-20 14:03:55.349 1197 1284 I RIL-MAIN: onReq: reqCode = 22, dataLen = 0
04-20 14:03:55.349 1197 1286 I RIL-MX : Ch0 > 0535AT+COPS?
04-20 14:03:55.365 1409 1409 D RILJ : [0720]> GPRS_REGISTRATION_STATE
04-20 14:03:55.373 1197 1285 I RIL-MX : Read Ch0 << 0535+COPS=0,COL MOV / TIGO,TIGO COL,732103
04-20 14:03:55.373 1409 1545 D RILJ : [0719]< OPERATOR {COL MOV / TIGO, TIGO COL, 732103}
04-20 14:03:55.381 1197 1284 I RIL-MAIN: onReq: reqCode = 21, dataLen = 0
04-20 14:03:55.381 1197 1286 I RIL-MX : Ch0 > 0536AT+CGREG?
04-20 14:03:55.381 1197 1286 I RIL-MX :
04-20 14:03:55.381 1409 1409 D RILJ : [0721]> REGISTRATION_STATE
04-20 14:03:55.388 1197 1284 I RIL-MAIN: onReq: reqCode = 20, dataLen = 0
04-20 14:03:55.388 1409 1409 D RILJ : [0722]> QUERY_NETWORK_SELECTION_MODE
04-20 14:03:55.388 1197 1284 I RIL-MAIN: onReq: reqCode = 45, dataLen = 0
04-20 14:03:55.388 1409 1409 D GSM : handleMessage what 6
04-20 14:03:55.412 1197 1285 I RIL-MX : Read Ch0 << 0536+CGREG=1,7,297D,00008D73,0
04-20 14:03:55.412 1197 1286 I RIL-MOD : onReqComp: Ch0 process reqCode = 20
04-20 14:03:55.412 1197 1286 I RIL-MX : Ch0 > 0537AT+CREG?
04-20 14:03:55.412 1409 1545 D RILJ : [0720]< GPRS_REGISTRATION_STATE {1, 297d, 8d73, 2, 0}
04-20 14:03:55.412 1409 1409 D GSM : handleMessage what 5
04-20 14:03:55.451 1197 1285 I RIL-MX : Read Ch0 << 0537+CREG=1,7,297D,00008D73,0,0,0,0,0,0
04-20 14:03:55.451 1197 1286 I RIL-MOD : onReqComp: Ch0 process reqCode = 45
04-20 14:03:55.451 1197 1286 I RIL-MX : Ch0 > 0538AT+COPSM?
04-20 14:03:55.451 1409 1545 D RILJ : [0721]< REGISTRATION_STATE {1, 297d, 8d73, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
04-20 14:03:55.451 1409 1409 D GSM : handleMessage what 4
04-20 14:03:55.490 1197 1285 I RIL-MX : Read Ch0 << 0538+COPSM=0
04-20 14:03:55.490 1409 1545 D RILJ : [0722]< QUERY_NETWORK_SELECTION_MODE {0}
04-20 14:03:55.490 1409 1409 D GSM : handleMessage what 14
04-20 14:03:55.490 1409 1409 D GSM : Network selection mode = false
04-20 14:03:55.490 1409 1409 D GSM : Poll ServiceState done: oldSS=[0 home domestic COL MOV / TIGO TIGO COL
732103 EDGE CSS not supported -1 -1RoamInd: -1DefRoamInd: -1EmergOnly: false] newSS=[0 home domestic COL MOV / TIGO TIGO COL
732103 EDGE CSS not supported -1 -1RoamInd: -1DefRoamInd: -1EmergOnly: false] oldGprs=0 newGprs=0 oldType=EDGE newType=EDGE
04-20 14:03:58.646 1197 1285 I RIL-MX : Read Ch0 << 0296~+CUSD=0,15,SALDO:$180.50;
BONO:$0.00,0+0minTigo,0+0+0minOtroOpdr,35smsTigo,0smsToDes,0minTigoNoche,0minOtroNoche,0minFavorito,0minDia,0minCUG

04-20 14:03:58.654 1409 1545 D RILJ : [UNSL]< UNSOL_ON_USSD 0
04-20 14:03:58.693 1197 1285 I RIL-MX : Read Ch0 << 0297~+CUSD=2,15,SALDO:$180.50;
BONO:$0.00,0+0minTigo,0+0+0minOtroOpdr,35smsTigo,0smsToDes,0minTigoNoche,0minOtroNoche,0minFavorito,0minDia,0minCUG

04-20 14:03:58.693 1409 1545 D RILJ : [UNSL]< UNSOL_ON_USSD 2
04-20 14:03:58.865 1409 1445 D PHONE : VM: PhoneSubInfo.getVoiceMailNUmber:
04-20 14:03:59.115 1197 1285 I RIL-MX : Read Ch0 << 0298~+RSSI=0,16,7,99,0,0,0
04-20 14:03:59.115 1197 1285 I RIL-MX : Read Ch0 << 0299~+CREG=1,7,297D,00008D73,0,0,0,0,0,0
04-20 14:03:59.115 1409 1545 D RILJ : [UNSL]< UNSOL_RESPONSE_NETWORK_STATE_CHANGED
04-20 14:03:59.115 1409 1409 D GSM : handleMessage what 12
04-20 14:03:59.131 1409 1409 D GSM : handleMessage what 2
 
Last edited:

gtuxyco

Senior Member
Jan 13, 2012
77
10
0
Riohacha
I use a command in terminal emulator
Code:
logcat -b radio
after that I open phone app and send normal USSD code (*10#) and I recibed the "MMI Complete" dialog.
the log shows me the whole process and also give the answer should give the dialog but the phone does not support
 

nikwen

Senior Member
Feb 1, 2013
3,142
1,597
0
I use a command in terminal emulator
Code:
logcat -b radio
after that I open phone app and send normal USSD code (*10#) and I recibed the "MMI Complete" dialog.
the log shows me the whole process and also give the answer should give the dialog but the phone does not support
Ah.

I think that you could do it easier.

You can call numbers from your app. Call the USSD code and read up on how to get the output (you need the proper permission for this). Or does your phone not support to get the number and you need to get it from the log for that reason? If you need it from the log, wait and I will post some code later if you want.

Did you google how to recieve the USSD code? Is there no API for that?
 

gtuxyco

Senior Member
Jan 13, 2012
77
10
0
Riohacha
Ah.

I think that you could do it easier.

You can call numbers from your app. Call the USSD code and read up on how to get the output (you need the proper permission for this). Or does your phone not support to get the number and you need to get it from the log for that reason? If you need it from the log, wait and I will post some code later if you want.

Did you google how to recieve the USSD code? Is there no API for that?
Yes the phone does not support USSD code, this the reason i get from log... I think if i do with USSD API i will receive the same response, that I recived in default phone app
 

nikwen

Senior Member
Feb 1, 2013
3,142
1,597
0
Yes the phone does not support USSD code, this the reason i get from log... I think if i do with USSD API i will receive the same response, that I recived in default phone app
Could you please point me to the exact part of the log where the USSD is shown? Is it the red part? If it is, which part is the USSD?
 

gtuxyco

Senior Member
Jan 13, 2012
77
10
0
Riohacha
Could you please point me to the exact part of the log where the USSD is shown? Is it the red part? If it is, which part is the USSD?
in the first lines i send the ussd code
Code:
04-20 14:03:54.256 1409 1409 D RILJ : [0717]> SEND_USSD *10#
the red part is a response i received
SALDO:$180.50;BONO:$0.00,0+0minTigo,0+0+0minOtroOpdr,35smsTigo,0 smsToDes,0minTigoNoche,0minOtroNoche,0minFavorito, 0minDia,0minCUG
 
Last edited:

nikwen

Senior Member
Feb 1, 2013
3,142
1,597
0
anyone know of a guide to handle logs in android?
Sorry, I forgot about your thread. :eek:

You can get logs that way:

Code:
Process proc = Runtime.getRuntime().exec("logcat -b radio");
BufferedReader br = new BufferedReader(new InputStreamReader(proc.getInputStream()));
You can read the log from the BufferedReader.

Note, that this needs root on Jelly Bean.
 

gtuxyco

Senior Member
Jan 13, 2012
77
10
0
Riohacha
Sorry, I forgot about your thread. :eek:

You can get logs that way:

Code:
Process proc = Runtime.getRuntime().exec("logcat -b radio");
BufferedReader br = new BufferedReader(new InputStreamReader(proc.getInputStream()));
You can read the log from the BufferedReader.

Note, that this needs root on Jelly Bean.
Thanks... :D i will try to use in a app to show ussd codes