DerArtem, on 29 September 2012 - 02:14 PM, said:
I have added some minor, but important changes to make it work with Huawei E169 and K3715 modems:
https://github.com/D.../commits/master
There is still one problem: when a PIN code is enabled on the SIM card then ril will fail with stuff like below. With disbaled PIN everything works well.
I will do some more tests when I get the time...
D/RILJ ( 608): [0022]> ENTER_SIM_PIN
I/RIL ( 109): processRequest() ENTER_SIM_PIN
D/AT ( 109): AT(12)> AT+CPIN="XXXX"
I/AT ( 109): AT(12)< OK
D/RILJ ( 608): [0022]< ENTER_SIM_PIN {1}
D/RILJ ( 608): [0023]> GET_SIM_STATUS
I/RIL ( 109): processRequest() GET_SIM_STATUS
D/AT ( 109): AT(12)> AT+CPIN?
I/AT ( 109): AT(12)< +CPIN: READY
I/AT ( 109): AT(12)< OK
D/AT ( 109): AT(12)> AT^CARDLOCK?
I/AT ( 109): AT(12)< ^CARDLOCK: 2,10,0
I/AT ( 109): AT(12)< OK
D/RIL ( 109): Card Unlocked, times: 10
D/AT ( 109): AT(12)> AT^CARDMODE
I/AT ( 109): AT(12)< ^CARDMODE: 2
I/AT ( 109): AT(12)< OK
I/RIL ( 109): Detected card type :3
I/RIL ( 109): [Card type discovery]: USIM
D/RILJ ( 608): [0023]< GET_SIM_STATUS IccCardState {CARDSTATE_PRESENT,PINSTATE_UNKNOWN,num_apps=1,gsm_id=0{APPTYPE_USIM,APPSTATE_READY,pin1=PINSTATE_UNKNOWN,pin2=PINSTATE_UNKNOWN},cmda_id=8,ism_id=8}
E/GSM ( 608): [IccCard] Invalid Subscription Application index:8
E/GSM ( 608): [IccCard] Invalid Subscription Application index:8
D/GSM ( 608): [IccCard] USIM=READY CSIM=ABSENT
D/RILB ( 608): getLteOnCdmaMode=0 curVal=-1 product_type='' lteOnCdmaProductType=''
E/GSM ( 608): [IccCard] Invalid Subscription Application index:8
D/GSM ( 608): [IccCard] Broadcasting intent ACTION_SIM_STATE_CHANGED READY reason null
D/GSM ( 608): [SIMRecords] fetchSimRecords 0
D/RILJ ( 608): [0024]> getIMSI: GET_IMSI aid: null
D/RILJ ( 608): [0025]> iccIO: SIM_IO 0xc0 0x2fe2 path: 3F00,0,0,15 aid: null
I/RIL ( 109): processRequest() GET_IMSI
D/RILJ ( 608): [0024]< GET_IMSI error: com.android.internal.telephony.CommandException: GENERIC_FAILURE
D/RILJ ( 608): [0026]> iccIO: SIM_IO 0xc0 0x6f40 path: 3F007F10,0,0,15 aid: null
I/RIL ( 109): processRequest() SIM_IO
D/RILJ ( 608): [0025]< SIM_IO error: com.android.internal.telephony.CommandException: GENERIC_FAILURE
I/RIL ( 109): processRequest() SIM_IO
D/RILJ ( 608): [0026]< SIM_IO error: com.android.internal.telephony.CommandException: GENERIC_FAILURE
D/RILJ ( 608): [0027]> iccIO: SIM_IO 0xc0 0x6fc9 path: 3F007F20,0,0,15 aid: null
I/RIL ( 109): processRequest() SIM_IO
D/RILJ ( 608): [0027]< SIM_IO error: com.android.internal.telephony.CommandException: GENERIC_FAILURE
D/RILJ ( 608): [0028]> iccIO: SIM_IO 0xc0 0x6fad path: 3F007F20,0,0,15 aid: null
I/RIL ( 109): processRequest() SIM_IO
Excellent!

... Also, if you happen to have some spare time, check the audio voice capability.. Maybe i have missed something there, as i am getting corrupted audio sometimes and had to implement a filter to try to sort out the problem.. I don't have a E169 at hand...

-- But i think the RIL is pretty close to be completely functional ...
I think the problem is in the getCardStatus function. It calls the getSIMStatus(), and based on that status, it fills the RIL_CardStatus_v6 struct. Don't know why, but it is returning PINSTATE_UNKNOWN, when it should not.... I checked the app_status_array, and this entry is what is returned when SIM_READY is returned by the getSIMStatus() function returns SIM_READY...

... This getCardStatus() function was taken from the mbm-300 ril... Maybe there is also a bug on that ril .
Edit2: I think i know what is happening... The processRequest() function validates, by calling the function getRadioState() that the radio has become ready before allowing the getIMSI and all the other requests to succeed... After successful PIN input, we should set the radio state to available... Otherwise, no command will be processed from that point onwards...
Edit3: Added an small change (untested) that should fix this problem. Now, the RIL should start working as soon as you enter the sim PIN... The sim should be unlocked by the RIL. There should be no need to unlock the SIM before inserting it into the tablet / 3G modem... Please, report success / failure cases

Edited by ejtagle, 30 September 2012 - 02:31 AM.