SIM driver question

Andreas Eversberg andreas at eversberg.eu
Fri Jun 15 07:08:43 UTC 2012


eisencah eisenach wrote:
>
> Hi.
> Is there any reason why in the sim_handler()  function,  in
>
>     case SIM_STATE_TX_DATA:
>         if (!txDoneFlag)
>             break; /* wait until data is transmitted */
>         /* Disable all interrupt driven functions */
>         writew(0xFF, REG_SIM_MASKIT);
>         /* Ignore waiting char for RUN GSM ALGORITHM */
>         /* TODO: implement proper handling of the "Procedure Bytes"
>            than this is no longer needed */
>         if(sim_data[1] == 0x88)
>             sim_ignore_waiting_char = 1;
>         sim_state = SIM_STATE_RX_STATUS;
>         calypso_sim_receive(response + length + 1, 2);
>         break;
>
> we do "calypso_sim_receive(response + length + 1, 2);" instead of   
> "calypso_sim_receive(response + 1, 2);".
> Seems an unnecessary overhead sending back some junk chars there. Or 
> I'm missing something?
> Cheers,
> Mihai.
>
hi mihai,

iirc, there is a reason for that. the response is allocated with length 
+ 1 + 2. at the end of the response string, there are the status bytes, 
so "length + 1" is added, so the status will appear at the end of the 
response message. the upper layer always reads the status from the last 
two bytes. if you would remove the length, the status would be at the 
wrong place.

regards,

andreas

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/baseband-devel/attachments/20120615/28d6f0b6/attachment.html>


More information about the baseband-devel mailing list