Skip to contentSkip to conversation

Fix rilmodem SMSC quoting

PATCH In review Tony Espy 2 participants 4 messages Dec 4, 2015

lore
Share & tools
lore

Tony Espy

author
#0 lore raw

cover Fix rilmodem SMSC quoting

This changeset fixes the string formatting of the RIL_REQUEST_SET_SMSC_ADDRESS request, which requires the string to bracketed by quotation marks.

Tony Espy (2):
rilmodem: restore SET_SMSC_ADDRESS number format
unit: update test-rilmodem-sms set_sca test case

 drivers/rilmodem/sms.c   | 4 +++-
 unit/test-rilmodem-sms.c | 8 ++++----
 2 files changed, 7 insertions(+), 5 deletions(-)
Signature · 1 line
2.1.4
author
#1 lore raw

PATCH 1/2 rilmodem: restore SET_SMSC_ADDRESS number format

Restore quoting of SMSC number string, as it's required by at least one rild implementation (mako).

---
 drivers/rilmodem/sms.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/rilmodem/sms.c +3 -1
index 3eedadd..ea57b84 100644
@@ -73,7 +73,9 @@ static void ril_csca_set(struct ofono_sms *sms,
 	struct sms_data *sd = ofono_sms_get_data(sms);
 	struct cb_data *cbd = cb_data_new(cb, user_data, sd);
 	struct parcel rilp;
-	const char *number = phone_number_to_string(sca);
+	char number[OFONO_MAX_PHONE_NUMBER_LENGTH + 4];
+
+	snprintf(number, sizeof(number), "\"%s\"", phone_number_to_string(sca));
 
 	parcel_init(&rilp);
 	parcel_w_string(&rilp, number);
Signature · 1 line
2.1.4
author
#2 lore raw

PATCH 2/2 unit: update test-rilmodem-sms set_sca test case

In reply to Tony Espy

Update test-rilmodem-sms set_sca test case to take into account additional quotes used for sending a SET_SMSC_ADDRESS request.

---
 unit/test-rilmodem-sms.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
unit/test-rilmodem-sms.c +4 -4
index ae3b1b3..1ed1b51 100644
@@ -237,10 +237,10 @@ static const struct sms_data testdata_sca_query_invalid_3 = {
  * {number="+34607003110"}
  */
 static const guchar req_set_smsc_address_parcel_1[] = {
-	0x00, 0x00, 0x00, 0x28, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x0c, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x33, 0x00, 0x34, 0x00, 0x36, 0x00,
-	0x30, 0x00, 0x37, 0x00, 0x30, 0x00, 0x30, 0x00, 0x33, 0x00, 0x31, 0x00,
-	0x31, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00
+	0x00, 0x00, 0x00, 0x2c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x0e, 0x00, 0x00, 0x00, 0x22, 0x00, 0x2b, 0x00, 0x33, 0x00, 0x34, 0x00,
+	0x36, 0x00, 0x30, 0x00, 0x37, 0x00, 0x30, 0x00, 0x30, 0x00, 0x33, 0x00,
+	0x31, 0x00, 0x31, 0x00, 0x30, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00
 };
 
 static const struct sms_data testdata_sca_set_valid_1 = {
Signature · 1 line
2.1.4
#3 lore raw
In reply to Tony Espy

Hi Tony,

Quoted 4 lines · Tony Espy

This changeset fixes the string formatting of the RIL_REQUEST_SET_SMSC_ADDRESS request, which requires the string to bracketed by quotation marks.

Quoted 8 lines

Tony Espy (2):
rilmodem: restore SET_SMSC_ADDRESS number format
unit: update test-rilmodem-sms set_sca test case

  drivers/rilmodem/sms.c   | 4 +++-
  unit/test-rilmodem-sms.c | 8 ++++----
  2 files changed, 7 insertions(+), 5 deletions(-)

Both applied, thanks.

Regards,
-Denis