Skip to contentSkip to conversation

SIM PIN unlock

DISCUSSION Ryan Raasch 3 participants 8 messages Oct 26, 2009 – Oct 28, 2009

lore
Share & tools
lore
#0 lore raw

Hello,

I have noticed a difference of ofono on startup. If the PIN number is not required, the daemon never gets past CRSM query, and the remaining interfaces are not added.

But if the PIN number has not been entered, things work as they should.

Scenario 1:

The SIM card needs the PIN number to work.

ofonod[8203]: attr_cb got result: 1 ofonod[8203]: Final response: OK ofonod[8203]: Response line: SIEMENS ofonod[8203]: at_cpin_cb got result: 1 ofonod[8203]: Final response: OK ofonod[8203]: Response line: +CPIN: SIM PIN ofonod[8203]: crsm_pin_cb: SIM PIN ofonod[8203]: at_crsm_info_cb got result: 0 ofonod[8203]: Final response: ERROR ofonod[8203]: attr_cb got result: 1 ofonod[8203]: Final response: OK ofonod[8203]: Response line: MC75 ofonod[8203]: at_crsm_info_cb got result: 0 ofonod[8203]: Final response: ERROR ofonod[8203]: attr_cb got result: 1 ofonod[8203]: Final response: OK ofonod[8203]: Response line: REVISION 03.010 ofonod[8203]: at_crsm_info_cb got result: 0 ofonod[8203]: Final response: ERROR ofonod[8203]: src/voicecall.c:ecc_read_cb() 0 ofonod[8203]: attr_cb got result: 1 ofonod[8203]: Final response: OK ofonod[8203]: Response line: 35**** ofonod[8203]: at_lock_unlock_cb got result: 1 ofonod[8203]: Final response: OK ofonod[8203]: at_cpin_cb got result: 1 ofonod[8203]: Final response: OK ofonod[8203]: Response line: +CPIN: READY ofonod[8203]: crsm_pin_cb: READY

Scenario 2:

The daemon has been restarted (following correct SIM PIN number insertion).

ofonod[16456]: attr_cb got result: 1 ofonod[16456]: Final response: OK ofonod[16456]: Response line: SIEMENS ofonod[16456]: at_cpin_cb got result: 1 ofonod[16456]: Final response: OK ofonod[16456]: Response line: +CPIN: READY ofonod[16456]: crsm_pin_cb: READY

Thanks,
Ryan

#1 lore raw

Hi Ryan,

Quoted 5 lines

Hello,

I have noticed a difference of ofono on startup. If the PIN number is not required, the daemon never gets past CRSM query, and the remaining interfaces are not added.

This works fine for other devices. I would enable at command debugging (export OFONO_AT_DEBUG=1) and watch for any signs of breakage. The MC75 is known to have a very bad AT command implementation that might be confusing the AT parser.

Regards,
-Denis

#2 lore raw
Quoted 4 lines · Denis Kenzior

Hi Ryan,

Quoted 2 lines

Hello,

Quoted 9 lines
Quoted 3 lines

I have noticed a difference of ofono on startup. If the PIN number is not required, the daemon never gets past CRSM query, and the remaining interfaces are not added.

This works fine for other devices. I would enable at command debugging (export OFONO_AT_DEBUG=1) and watch for any signs of breakage. The MC75 is known to have a very bad AT command implementation that might be confusing the AT parser.

It seems that if the sim card is unlocked, then the remaining "cascading" functions are not called.

query_manufacturer(info);

Got SIM READY

NOT CALLED...

   	query_model(info);
	query_revision(info);
	query_serial(info);

ofonod[3965]: src/sim.c:ofono_sim_add_ready_watch() 0x8eb15b0 ofonod[3965]: src/sim.c:ofono_sim_add_ready_watch() 0x8eb15b0 ofonod[3965]: > AT+CGMI\r
ofonod[3965]: < AT+CGM
ofonod[3965]: < I\r
ofonod[3965]: < \r\nSIEME
ofonod[3965]: < NS
ofonod[3965]: < \r\n\r\nOK\r\n
ofonod[3965]: attr_cb got result: 1
ofonod[3965]: Final response: OK
ofonod[3965]: Response line: SIEMENS
ofonod[3965]: > AT+CPIN?\r
ofonod[3965]: < AT+CPI
ofonod[3965]: < N?\r
ofonod[3965]: < \r\n+CPIN: READY\r\n\r\nO ofonod[3965]: < K\r
ofonod[3965]: < \n
ofonod[3965]: at_cpin_cb got result: 1 ofonod[3965]: Final response: OK
ofonod[3965]: Response line: +CPIN: READY ofonod[3965]: crsm_pin_cb: READY
ofonod[3965]: > AT+CRSM=192,28421\r
ofonod[3965]: < AT+CRSM=192
ofonod[3965]: < ,28
ofonod[3965]: < 421\r
ofonod[3965]: < \r\n+CRSM: 144,0,850D00046F05040001FFAA03020 ofonod[3965]: < 000\r\n\r\n
ofonod[3965]: < \r\nOK\r\n

Cheers,
Ryan

Quoted 6 lines

Regards,
-Denis
_______________________________________________
ofono mailing list
ofono(a)ofono.org
http://lists.ofono.org/listinfo/ofono

#3 lore raw

Hi Ryan,

2009/10/26 Ryan Raasch <[email protected]>:

Quoted 33 lines

It seems that if the sim card is unlocked, then the remaining "cascading" functions are not called.

query_manufacturer(info);

Got SIM READY

NOT CALLED...
       query_model(info);
       query_revision(info);
       query_serial(info);

ofonod[3965]: src/sim.c:ofono_sim_add_ready_watch() 0x8eb15b0 ofonod[3965]: src/sim.c:ofono_sim_add_ready_watch() 0x8eb15b0 ofonod[3965]: > AT+CGMI\r
ofonod[3965]: < AT+CGM
ofonod[3965]: < I\r
ofonod[3965]: < \r\nSIEME
ofonod[3965]: < NS
ofonod[3965]: < \r\n\r\nOK\r\n
ofonod[3965]: attr_cb got result: 1
ofonod[3965]: Final response: OK
ofonod[3965]: Response line: SIEMENS
ofonod[3965]: > AT+CPIN?\r
ofonod[3965]: < AT+CPI
ofonod[3965]: < N?\r
ofonod[3965]: < \r\n+CPIN: READY\r\n\r\nO ofonod[3965]: < K\r
ofonod[3965]: < \n
ofonod[3965]: at_cpin_cb got result: 1 ofonod[3965]: Final response: OK
ofonod[3965]: Response line: +CPIN: READY

Quoted 8 lines

ofonod[3965]: crsm_pin_cb: READY
ofonod[3965]: > AT+CRSM=192,28421\r
ofonod[3965]: < AT+CRSM=192
ofonod[3965]: < ,28
ofonod[3965]: < 421\r
ofonod[3965]: < \r\n+CRSM: 144,0,850D00046F05040001FFAA03020 ofonod[3965]: < 000\r\n\r\n
ofonod[3965]: < \r\nOK\r\n

There seems to be an additional \r\n before the last OK (?). I'm not sure how this can result from the PIN request but maybe using the permissive mode of the parser, like plugin/phonesim.c does, helps (or not). You also have echo enabled, shouldn't be a problem but maybe worth trying without it.

Regards

#4 lore raw

Ok. I have narrowed it down a little.

It seems to be the CRSM command reading the
SIM_EFLI_FILEID when it succeeds.

ofonod[6326]: > AT+CRSM=192,28421\r ofonod[6326]: < \r\n+CRSM: 144,
ofonod[6326]: < 0,850D00046F05040001FFAA03020000\r\n\r\n ofonod[6326]: < \r\nOK\r\n

goes no further....

HACK:

If I remove

	ofono_sim_read(sim, SIM_EFLI_FILEID,
         	                OFONO_SIM_FILE_STRUCTURE_TRANSPARENT,
                 	        sim_efli_read_cb, sim);

from src/sim.c, the code works, for me.

After i tried the above and it worked, i tried to re-enable the function
call above, and put a breakpoint in sim_efli_read_cb(), and the code
execution never hit there.

NOTE:

After entering the pin code for the sim card, only SIM_EFMSISDN_FILEID is read from the sim card, but maybe that is intentional, since it succeeds.

Regards,
Ryan

Quoted 56 lines · Andrzej Zaborowski

Hi Ryan,

2009/10/26 Ryan Raasch <[email protected]>:

Quoted 33 lines

It seems that if the sim card is unlocked, then the remaining "cascading" functions are not called.

query_manufacturer(info);

Got SIM READY

NOT CALLED...

       query_model(info);
       query_revision(info);
       query_serial(info);

ofonod[3965]: src/sim.c:ofono_sim_add_ready_watch() 0x8eb15b0 ofonod[3965]: src/sim.c:ofono_sim_add_ready_watch() 0x8eb15b0 ofonod[3965]: > AT+CGMI\r
ofonod[3965]: < AT+CGM
ofonod[3965]: < I\r
ofonod[3965]: < \r\nSIEME
ofonod[3965]: < NS
ofonod[3965]: < \r\n\r\nOK\r\n
ofonod[3965]: attr_cb got result: 1
ofonod[3965]: Final response: OK
ofonod[3965]: Response line: SIEMENS
ofonod[3965]: > AT+CPIN?\r
ofonod[3965]: < AT+CPI
ofonod[3965]: < N?\r
ofonod[3965]: < \r\n+CPIN: READY\r\n\r\nO ofonod[3965]: < K\r
ofonod[3965]: < \n
ofonod[3965]: at_cpin_cb got result: 1 ofonod[3965]: Final response: OK
ofonod[3965]: Response line: +CPIN: READY

Quoted 8 lines

ofonod[3965]: crsm_pin_cb: READY
ofonod[3965]: > AT+CRSM=192,28421\r
ofonod[3965]: < AT+CRSM=192
ofonod[3965]: < ,28
ofonod[3965]: < 421\r
ofonod[3965]: < \r\n+CRSM: 144,0,850D00046F05040001FFAA03020 ofonod[3965]: < 000\r\n\r\n
ofonod[3965]: < \r\nOK\r\n

There seems to be an additional \r\n before the last OK (?). I'm not sure how this can result from the PIN request but maybe using the permissive mode of the parser, like plugin/phonesim.c does, helps (or not). You also have echo enabled, shouldn't be a problem but maybe worth trying without it.

Regards
_______________________________________________
ofono mailing list
ofono(a)ofono.org
http://lists.ofono.org/listinfo/ofono

#5 lore raw

Hi Ryan,

Quoted 11 lines

Ok. I have narrowed it down a little.

It seems to be the CRSM command reading the
SIM_EFLI_FILEID when it succeeds.

ofonod[6326]: > AT+CRSM=192,28421\r ofonod[6326]: < \r\n+CRSM: 144,
ofonod[6326]: < 0,850D00046F05040001FFAA03020000\r\n\r\n ofonod[6326]: < \r\nOK\r\n

goes no further....

The parser is stuck because your modem is spewing garbage. atgen plugin uses the _really_ strict gsmv1 syntax. I suggest you make a custom driver for your device that uses the gsm_permissive syntax.

Quoted 3 lines
	ofono_sim_read(sim, SIM_EFLI_FILEID,
         	                OFONO_SIM_FILE_STRUCTURE_TRANSPARENT,
                 	        sim_efli_read_cb, sim);

This is wrong and won't get you very far as there are about 20 other SIM files that we read.

Regards,
-Denis

#6 lore raw
Quoted 12 lines · Denis Kenzior

Hi Ryan,

Quoted 10 lines

Ok. I have narrowed it down a little.

It seems to be the CRSM command reading the
SIM_EFLI_FILEID when it succeeds.

ofonod[6326]: > AT+CRSM=192,28421\r ofonod[6326]: < \r\n+CRSM: 144,
ofonod[6326]: < 0,850D00046F05040001FFAA03020000\r\n\r\n ofonod[6326]: < \r\nOK\r\n

Quoted 6 lines
Quoted 1 line

goes no further....

The parser is stuck because your modem is spewing garbage. atgen plugin uses the _really_ strict gsmv1 syntax. I suggest you make a custom driver for your device that uses the gsm_permissive syntax.

This worked! Thank you. Could this be another option in modem.conf (Syntax=[Permissive,GSM1])?

Quoted 6 lines
Quoted 3 lines
	ofono_sim_read(sim, SIM_EFLI_FILEID,
         	                OFONO_SIM_FILE_STRUCTURE_TRANSPARENT,
                 	        sim_efli_read_cb, sim);

This is wrong and won't get you very far as there are about 20 other SIM files that we read.

I knew it was wrong, it was not a fix, just a localized point where my device was failing.

Regards,
Ryan

Quoted 4 lines

Regards,
-Denis

#7 lore raw

Hi Ryan,

Quoted 2 lines

This worked! Thank you. Could this be another option in modem.conf (Syntax=[Permissive,GSM1])?

Glad to hear that.

Feel free to send a patch :)

Regards,
-Denis