mirror of git://git.sysmocom.de/ofono
simutil: Fix EF_PNN access
EF_PNN was not being read properly (see TS 24.008, section 10.5.3.5a, for network names format), which affected the displayed PLMN name for some MVNOs. Some modems already read the file and return the right string: these do not show the problem.
This commit is contained in:
parent
6a96eea978
commit
46de4df677
|
@ -767,12 +767,14 @@ static char *sim_network_name_parse(const unsigned char *buffer, int length,
|
||||||
gboolean *add_ci)
|
gboolean *add_ci)
|
||||||
{
|
{
|
||||||
char *ret = NULL;
|
char *ret = NULL;
|
||||||
unsigned char *endp;
|
|
||||||
unsigned char dcs;
|
unsigned char dcs;
|
||||||
int i;
|
int i;
|
||||||
gboolean ci = FALSE;
|
gboolean ci = FALSE;
|
||||||
|
unsigned char *unpacked_buf;
|
||||||
|
long num_char, written;
|
||||||
|
int spare_bits;
|
||||||
|
|
||||||
if (length < 1)
|
if (length < 2)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
dcs = *buffer++;
|
dcs = *buffer++;
|
||||||
|
@ -787,11 +789,18 @@ static char *sim_network_name_parse(const unsigned char *buffer, int length,
|
||||||
|
|
||||||
switch (dcs & (7 << 4)) {
|
switch (dcs & (7 << 4)) {
|
||||||
case 0x00:
|
case 0x00:
|
||||||
endp = memchr(buffer, 0xff, length);
|
spare_bits = dcs & 0x07;
|
||||||
if (endp)
|
num_char = (length * 8 - spare_bits) / 7;
|
||||||
length = endp - buffer;
|
|
||||||
ret = convert_gsm_to_utf8(buffer, length,
|
unpacked_buf = unpack_7bit(buffer, length, 0, FALSE,
|
||||||
NULL, NULL, 0xff);
|
num_char, &written, 0);
|
||||||
|
if (unpacked_buf == NULL)
|
||||||
|
break;
|
||||||
|
|
||||||
|
ret = convert_gsm_to_utf8(unpacked_buf, written, NULL, NULL, 0);
|
||||||
|
|
||||||
|
g_free(unpacked_buf);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 0x10:
|
case 0x10:
|
||||||
if ((length % 2) == 1) {
|
if ((length % 2) == 1) {
|
||||||
|
|
Loading…
Reference in New Issue