util: Make sure to handle special empty strings

Some SIMs contain an EFspn with the contents all set to 'filler'
characters, e.g. 0xFF.  We mistakenly do not handle these strings
correctly.

Aug  8 11:40:00 mx31tt01 daemon.info ofonod[622]: Aux: >
AT+CRSM=176,28486,0,0,17\r
Aug  8 11:40:00 mx31tt01 daemon.info ofonod[622]: Aux: < \r\n+CRSM:
144,0,FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF\r\n\r\nOK\r\n
Aug  8 11:40:00 mx31tt01 daemon.debug ofonod[622]:
drivers/atmodem/sim.c:at_crsm_read_cb() crsm_read_cb: 90, 00, 17
Aug  8 11:40:00 mx31tt01 daemon.debug ofonod[622]:
src/simfs.c:sim_fs_op_read_block_cb() bufoff: 0, dataoff: 0, tocopy: 17
Aug  8 11:40:00 mx31tt01 daemon.err ofonod[622]: EFspn read
successfully, but couldn't parse
This commit is contained in:
Denis Kenzior 2012-08-16 00:47:59 -05:00
parent df05259e90
commit 54de04a828
1 changed files with 6 additions and 0 deletions

View File

@ -1276,6 +1276,12 @@ char *sim_string_to_utf8(const unsigned char *buffer, int length)
offset = 4;
break;
case 0xff: /* Special case of empty string */
num_chars = 0;
ucs2_offset = 0;
offset = 0;
break;
default:
return NULL;
}