[PATCH] Parse +CUSD responses.
Denis Kenzior
denkenz at gmail.com
Fri Oct 16 11:06:07 PDT 2009
Hi Andrew,
> USSD.Initiate still returns a string, this may be wrong because
> when the network returns data coded in 8-bits we have no information
> on the character set used, everything is "user-specified" for the
> 8-bit coding in the 23.038 and technically we should return an array
Right now we should simply ignore 8bit data and return an error.
> I removed the "TODO: be able to send UCS2 string" because the string
> we send is first checked to be a valid USSD string so we already know
> it can be encoded with GSM 7-bits.
Actually valid_ussd_string will accept just about everything.
> + /* All 7-bit coding schemes - there's no need to distinguish
> + * between the different schemes because the modem is tasked
> + * with presenting us with only raw 7-bit characters.
> + */
> + if ((dcs & 0xf0) == 0x00 || dcs == 0x10 || (dcs & 0xf0) == 0x20 ||
> + (dcs & 0xf0) == 0x30 || (dcs & 0xcc) == 0x40 ||
> + (dcs & 0xfc) == 0x90 || (dcs & 0xf4) == 0xf0)
> + converted = convert_gsm_to_utf8(content, length,
> + NULL, NULL, 0);
> +
What about the evil set of DCSes which indicate a ISO639 2 character code
preceding the message?
> - sprintf(buf, "AT+CUSD=1,\"%*s\",%d", (int) written, converted, dcs);
> + len = sprintf(buf, "AT+CUSD=1,\"");
> + for (i = 0; i < written; i ++)
> + len += sprintf(buf + len, "%02hhx", converted[i]);
> + sprintf(buf + len, "\",%d", dcs);
>
So this part concerns me, see below.
> + dump_response("cssu_notify", TRUE, result);
cssd_notify :)
> +
> + g_at_chat_send(chat, "AT+CSCS=\"HEX\"", NULL, NULL, NULL, NULL);
This part of 27.007 is utterly and completely broken. We have to be extra
careful whenever we mess with CSCS. Does this have any unfortunate side
effects, in particular with +COPS, +CPUC, etc? Also note that since we change
the CSCS during phonebook import, any USSDs sent/received during this time
won't actually work properly :)
Regards,
-Denis
More information about the ofono
mailing list