Skip to contentSkip to conversation

How to tweak sim atom

DISCUSSION Guillaume Zajac 2 participants 3 messages Jan 11, 2012

lore
Share & tools
lore
#0 lore raw

Hi all,

As the thread concerning SIM tweaking was growing fast, I summarized it in a new one.

We want to use existing oFono sim atom with CSIM (CDMA SIM) to support PIN management and get the IMSI at first place.
So far we have to distinguish CSIM and (U)SIM in order into the atom to use PIN management and get the IMSI, as other operations won't be possible as explained below.

1) 1st solution is to precise at sim atom creation the modem type, however Denis denied this solution. Modem type is used by external application and not by oFono core.

2) 2nd solution is to get sim_type by deduction of modem type into Huawei plugin. Then we precise this sim_type during atom creation.

3) Another method would be to implement a new entry point into ofono_sim_driver, for instance ->GetSimType().
However this method will require to access to the file system:
- for GSM, that can be done using AT+CRSM (EFdir) or AT+CUAD.
- for CDMA, we don't have any AT commands to do it.

To complete this solution, we might need for CSIM file system access some specific Qualcomm commands.
But for the moment, we have no information/documentation from manufacturer regarding CSIM file system access. Therefore, we will not be able to populate following properties:
- MobileCountryCode
- MobileNetworkCode
- SubscriberNumbers
- PreferredLanguages
- ServiceNumbers
- CardIdentifier
- FixedDialing
- BarredDialing

4) Having 2 drivers can be a solution to make difference between CSIM and (U)SIM:
- "atmodem/sim.c" drivers
- "cdmamodem/sim.c" drivers
There can be a lib simutil for PIN management and IMSI retrieval whose APIs would be called by "atmodem" and "cdmamodem" drivers to avoid duplicated code.

Thus we don't implement all file system access entry points for "cdmamodem/sim.c", but we can keep suggested GetSimType() for both drivers and return CSIM type for CDMA without asking modem (as we can't). Later this will help us to precise right file id (which is different from (U)SIM) while reading CSIM file system, once we have the procedures from manufacturer to do it.

Kind regards,
Guillaume

#1 lore raw

Hi Guillaume,

Quoted 8 lines

4) Having 2 drivers can be a solution to make difference between CSIM and (U)SIM:
- "atmodem/sim.c" drivers
- "cdmamodem/sim.c" drivers
There can be a lib simutil for PIN management and IMSI retrieval whose APIs would be called by "atmodem" and "cdmamodem" drivers to avoid duplicated code.

Why don't you try adding a 'atmodem-noef' driver to drivers/atmodem/sim.c and see how far you get? You only need ~13 lines of code and a register / unregister driver call.

Regards,
-Denis

#2 lore raw

Hi Denis,

Quoted 11 lines
Quoted 8 lines

4) Having 2 drivers can be a solution to make difference between CSIM and (U)SIM:
- "atmodem/sim.c" drivers
- "cdmamodem/sim.c" drivers
There can be a lib simutil for PIN management and IMSI retrieval whose APIs would be called by "atmodem" and "cdmamodem" drivers to avoid duplicated code.

Why don't you try adding a 'atmodem-noef' driver to drivers/atmodem/sim.c and see how far you get? You only need ~13 lines of code and a register / unregister driver call

It seems working according to what I get from pre_sim() state:

ofonod[12224]: plugins/huawei.c:huawei_pre_sim() 0x81d86d0 ofonod[12224]: PCUI: > AT^CVOICE?\r
ofonod[12224]: src/sim.c:ofono_sim_add_state_watch() 0x81d0740 ofonod[12224]: src/sim.c:ofono_sim_add_state_watch() 0x81d0740 ofonod[12224]: src/sim.c:ofono_sim_add_state_watch() 0x81d0740 ofonod[12224]: PCUI: < \r\n^CVOICE:1\r\n\r\nOK\r\n ofonod[12224]: PCUI: > AT+GCAP\r
ofonod[12224]: PCUI: < \r\n+GCAP: +CIS707-A,CIS-856-A,+MS, +ES, +DS, +FCLASS\r\n\r\nOK\r\n
ofonod[12224]: PCUI: > AT+CPIN?\r
ofonod[12224]: PCUI: < \r\n+CPIN:READY\r\n\r\nOK\r\n ofonod[12224]: drivers/atmodem/sim.c:at_cpin_cb() crsm_pin_cb: READY ofonod[12224]: drivers/atmodem/sim.c:at_pin_retries_query() ofonod[12224]: PCUI: > AT+GMI\r
ofonod[12224]: PCUI: < \r\n+GMI: HUAWEI TECHNOLOGIES CO., LTD\r\n\r\nOK\r\n ofonod[12224]: PCUI: > AT^CPIN?\r
ofonod[12224]: PCUI: < \r\n^CPIN:READY,2,10,2,10,3\r\n\r\nOK\r\n ofonod[12224]: drivers/atmodem/sim.c:huawei_cpin_cb() retry counter id=9, val=10
ofonod[12224]: drivers/atmodem/sim.c:huawei_cpin_cb() retry counter id=1, val=2
ofonod[12224]: drivers/atmodem/sim.c:huawei_cpin_cb() retry counter id=11, val=10
ofonod[12224]: drivers/atmodem/sim.c:huawei_cpin_cb() retry counter id=4, val=3
ofonod[12224]: PCUI: > AT+CIMI\r
ofonod[12224]: PCUI: < \r\n510992151460620\r\n\r\r\n\r\nOK\r\n ofonod[12224]: drivers/atmodem/sim.c:at_cimi_cb() cimi_cb: 510992151460620 ofonod[12224]: src/modem.c:modem_change_state() old state: 1, new state: 2 ofonod[12224]: plugins/huawei.c:huawei_post_sim() 0x81d86d0 ofonod[12224]: PCUI: > AT+GMM\r
ofonod[12224]: PCUI: < \r\nEC1261\r\n\r\nOK\r\n
ofonod[12224]: PCUI: > AT+GMR\r
ofonod[12224]: PCUI: < \r\n+CGMR:11.102.11.00.45\r\n\r\nOK\r\n ofonod[12224]: PCUI: > AT+GSN\r
ofonod[12224]: PCUI: < \r\n+GSN:80363dac\r\n\r\nOK\r\n

./online-modem

ofonod[12224]: plugins/huawei.c:huawei_set_online() modem 0x81d86d0 online ofonod[12224]: PCUI: > AT+CFUN=1\r
ofonod[12224]: PCUI: < \r\nOK\r\n
ofonod[12224]: PCUI: > AT^SYSINFO\r
ofonod[12224]: PCUI: < \r\n^SYSINFO:0,255,0,0,1\r\n\r\nOK\r\n ofonod[12224]: plugins/huawei.c:sysinfo_online_cb() 1 -> 1 ofonod[12224]: src/modem.c:modem_change_state() old state: 2, new state: 3 ofonod[12224]: plugins/huawei.c:huawei_post_online() 0x81d86d0 ofonod[12224]: src/cdma-connman.c:ofono_cdma_connman_create() ofonod[12224]: drivers/cdmamodem/connman.c:cdma_connman_probe() ofonod[12224]: PCUI: > AT^SYSINFO\r
ofonod[12224]: Modem: > AT+CTA=0\r
ofonod[12224]: PCUI: < \r\n^SYSINFO:0,255,0,0,1\r\n\r\nOK\r\n ofonod[12224]: Modem: < \r\nOK\r\n
ofonod[12224]: Modem: > AT&C0\r
ofonod[12224]: Modem: < \r\nOK\r\n
ofonod[12224]: drivers/cdmamodem/connman.c:at_c0_cb() ok 1 ofonod[12224]: src/cdma-connman.c:ofono_cdma_connman_register()

Kind regards,
Guillaume