From 02d34f9196aa86cef2bc17ebd0ed62da95cb25c5 Mon Sep 17 00:00:00 2001 From: Serhii Kostiuk Date: Thu, 12 Dec 2019 10:55:56 +0200 Subject: [MTX-3072][GP-359] mPower Edge: LVW3 support on Conduit devices Updated sms-utils to fix the issue with SMS messages on LVW3. --- src/atcmd.c | 3 ++- src/pdu_decode.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/atcmd.c b/src/atcmd.c index a216ab6..4192558 100644 --- a/src/atcmd.c +++ b/src/atcmd.c @@ -1538,7 +1538,8 @@ is_vzw_lte(void) } } - return (!strcmp(Global.core.model, "LE910-SVG")); + return (!strcmp(Global.core.model, "LE910-SVG") || + !strcmp(Global.core.model, "LE910-SV1")); } int isCdmaTypeModel() diff --git a/src/pdu_decode.c b/src/pdu_decode.c index 62b60ba..d67d5c3 100644 --- a/src/pdu_decode.c +++ b/src/pdu_decode.c @@ -239,7 +239,7 @@ int pdu_decode_user_data(const char *pdu_str, struct pdu_info *pdu, int *nr_octe } else if (pdu->data_coding.general.alphabet == PDU_ALPHABET_CDMA_DEFAULT) { if (is_vzw_lte()) { // LE910-SVG stores data length as # of septets - log_debug("counting PDU length byte as number of septets (LE910-SVG/LE910-NA1/VZW)"); + log_debug("counting PDU length byte as number of septets (LE910-SVG/LE910-SV1/LE910-NA1/VZW)"); *nr_octets = octets_from_septets(pdu->user_data_len); } else { -- cgit v1.2.3 From 5d0e55f465b750d1379eea934055b8738db8fc8a Mon Sep 17 00:00:00 2001 From: Serhii Kostiuk Date: Fri, 13 Dec 2019 17:40:34 +0200 Subject: [MTX-3102] mPower Feb20: IN:3899 MTCDT-LVW3 fails SMS with GUI Fixed the logic for parsing single-part and multi-part messages for LVW3 and LNA3. Now single-part messages should be parsed as correctly as multi-part messages. This logic improves the logic that were previously implemented in with multi-part messages support for LVW2: bbf6ae9b1790c7129bf249641350b302def3ee27. What changed: - CDMA-specific SMS Teleservice ID is now saved as part of the PDU structure - SMS Teleservice ID is now used to determine if the message CDMA Wireless Enhanced Messaging Teleservice (WEMT) with an actual UDH header - UDH headers are used for multi-part messages in LVW3/LNA3 Why changed: - UDH header may NOT be present in the SMS PDU - first byte of user data may be a letter instead of the UDH header size - when letter is parsed as side we get a lot of issues with segmentation faults, parsing issues, garbage in payload and so on - so this commit adds SMS type detection before actual UDH header parsing attempt is performed Sources for implementation: - Telit LE910 V2 SERIES AT COMMANDS REFERENCE GUIDE 80446ST10707A Rev.3, section 5.1.5.5.7 Read Message (3GPP2) - +CMGR contains definition of Teleservice ID field and four of the types: 4097 page, 4098 SMS (0x1002), 4099 voice mail, 262144 voice mail notification - 3GPP2 X.S0004-550-E, section 2.256 SMS_TeleserviceIdentifier contains definition for additional SMS types including 4101 (0x1005) CDMA Wireless Enhanced Messaging Teleservice (WEMT). - Teleservice ID 0x1002 is actually used for short messages in Verizon: ```+CMGL: 12,1,"",23 098010310REDACTED4F3 191213 050558 1002 0009 0C D4F29C0E32CBDF6D503508``` - Teleservice ID 0x1005 is actually used for multi-part messages in Verizon: ```+CMGL: 13,1,"",152 098010310REDACTED4F3 191213 050741 1005 0009 A0 05 00 03 4A 02 01 CC 66B3D96C369BCD66B3D96C369BCDE6E3F97C3E9FCFE7F3F97C3E9FCFE7F3F97C3E9FCFE7F3F97C3E9FCFE7F3F97C3E9FCFE7F3F97C3E9FCFE7F3F97C3E9FCFE7F3F97C3E9FCFE7F3F97C3E9FCFE7F3F97C3E9FCFE7F3F97C3E9FCFE7F3F97C3E9FCFE7F3F97C3E9FCFE7F3F97C3E9FCFE7F3F97C3E9FCFE7F3F97C3E9FCFE7F3F97C3E9FCF +CMGL: 14,1,"",143 098010310REDACTED4F3 191213 050743 1005 0009 95 05 00 03 4A 02 02 CE E7F3F97C3E9FCFE7F3F97C3E9FCFE7B3D96C369BCD66B3D96C369BCD66B3D96C369BCDE670381C0E87C3E170381C0E87C3E170381C0E87C3E170381C0E87C3E170381C0E87C3E170381C0E87C3E170381C0E87C3E170381C0E87C3E170381C0E87C3E170381C0E87C3E17038168BC562B1582C168BC562B1582C1603``` --- src/pdu.h | 16 ++++++++++++++++ src/pdu_decode.c | 14 ++++++++++++-- src/sms_list.c | 4 ++++ 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/src/pdu.h b/src/pdu.h index 5b4eb15..dea429a 100644 --- a/src/pdu.h +++ b/src/pdu.h @@ -60,6 +60,21 @@ enum { PDU_ALPHABET_DEFAULT_MULTI = 9,//no GSM, LVW2 7-bit, multi-part }; +// CDMA Teleservice Identifiers (what type of message is received in CDMA network) +// All such identifiers are described in 3GPP2 X.S0004-550-E, section 2.256 SMS_TeleserviceIdentifier +enum { + PDU_TELE_ID_UNUSED = 0, // Not used. + // 1 - Reserved for maintenance. + // 2 through 4095 - Reserved for assignment by MAP. + // ... + PDU_TELE_ID_CDMA_PAGE = 4097, // CDMA Cellular Paging Teleservice. + PDU_TELE_ID_CDMA_MSG = 4098, // CDMA Cellular Messaging Teleservices. + PDU_TELE_ID_CDMA_VOICE_MSG_NOTIF = 4099, // CDMA Voice Mail Notification + // ... + PDU_TELE_ID_CDMA_WEMT = 4101 // CDMA Wireless Enhanced Messaging Teleservice (WEMT). + // ... +}; + struct pdu_info { int msg_len; struct pdu_addr smsc_addr; @@ -77,6 +92,7 @@ struct pdu_info { } type; uint8_t msg_reference; uint8_t protocol_id; + uint16_t teleservice_id; // CDMA-specific, see 3GPP2 X.S0004-550-E for details union { uint8_t data_coding; struct { diff --git a/src/pdu_decode.c b/src/pdu_decode.c index d67d5c3..9c0ced5 100644 --- a/src/pdu_decode.c +++ b/src/pdu_decode.c @@ -290,11 +290,15 @@ int pdu_decode_user_data(const char *pdu_str, struct pdu_info *pdu, int *nr_octe (pdu->data_coding.general.alphabet == PDU_ALPHABET_DEFAULT2) || (pdu->data_coding.general.alphabet == PDU_ALPHABET_DEFAULT_MULTI)|| (pdu->data_coding.general.alphabet == PDU_ALPHABET_TE)) { - // Keep UDH for concatenated SMS. + // Keep UDH for concatenated SMS ONLY. // Otherwise it is impossible to process correctly concatenated SMS. i = 0; if (pdu->type.user_data_header || - (pdu->data_coding.general.alphabet == PDU_ALPHABET_DEFAULT_MULTI)) { + // For LVW3, LNA3 and LVW2 - Save header ONLY when it's actually a multi-part message. + // Multi-part messages should use Teleservice ID 4101 (0x1005) in LVW2 7-BIT MULTI-PART format. + // See 3GPP2 X.S0004-550-E for details on Teleservice ID. + (pdu->data_coding.general.alphabet == PDU_ALPHABET_DEFAULT_MULTI + && pdu->teleservice_id == PDU_TELE_ID_CDMA_WEMT)) { for (i = 0; i <= octets[0]; ++i) { pdu->user_data[i] = octets[i]; } @@ -536,11 +540,17 @@ int pdu_decode_cdma(const char *pdu_str, struct pdu_info *pdu) pdu_str += HEX_BYTE_LEN; log_debug("tele-id-1: 0x%02X", tmp); + pdu->teleservice_id = 0; + pdu->teleservice_id |= (tmp << 8); // save upper byte of the Teleservice ID + tmp = hex_byte_decode(pdu_str); DECODE_FAIL(tmp < 0, "tele-id-2", -1); pdu_str += HEX_BYTE_LEN; log_debug("tele-id-2: 0x%02X", tmp); + pdu->teleservice_id |= (tmp); // save lower byte of the Teleservice ID + log_debug("tele-id: 0x%04X", pdu->teleservice_id); + //Priority tmp = hex_byte_decode(pdu_str); DECODE_FAIL(tmp < 0, "priority", -1); diff --git a/src/sms_list.c b/src/sms_list.c index dcad3fe..678c158 100644 --- a/src/sms_list.c +++ b/src/sms_list.c @@ -177,6 +177,10 @@ static int print_list_yaml(struct msg_list_info *list_info) indentf(indent, "message-reference: 0x%02X\n", msg->pdu.msg_reference); indentf(indent, "protocol-id: 0x%02X\n", msg->pdu.protocol_id); + if (Global.core.verbose) { + indentf(indent, "tele-id: 0x%04X\n", msg->pdu.teleservice_id); + } + if (Global.core.verbose) { indentf(indent, "addr-length: 0x%02X\n", msg->pdu.addr.len); } -- cgit v1.2.3 From 1fe79e42c3403ee873ff5cc2db170b3dfb4acafe Mon Sep 17 00:00:00 2001 From: Serhii Kostiuk Date: Mon, 16 Dec 2019 09:48:38 +0200 Subject: [MTX-3102] mPower Feb20: IN:3899 MTCDT-LVW3 fails SMS with GUI Fixes after a code review: - Replaced strcmp with strncmp - fixed the return type for "is_vzw_lte" function --- src/atcmd.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/atcmd.c b/src/atcmd.c index 4192558..97fd34b 100644 --- a/src/atcmd.c +++ b/src/atcmd.c @@ -1527,7 +1527,7 @@ int sms_device_open(void) return fd; } -is_vzw_lte(void) +int is_vzw_lte(void) { if (!strcmp(Global.core.model, "LE910-NA1")) { log_debug("Found LE910-NA1"); @@ -1538,8 +1538,8 @@ is_vzw_lte(void) } } - return (!strcmp(Global.core.model, "LE910-SVG") || - !strcmp(Global.core.model, "LE910-SV1")); + return (!strncmp(Global.core.model, "LE910-SVG", MODEL_LEN) || + !strncmp(Global.core.model, "LE910-SV1", MODEL_LEN)); } int isCdmaTypeModel() @@ -1548,8 +1548,8 @@ int isCdmaTypeModel() if (is_vzw_lte()) return 1; - return (!strcmp(Global.core.model, "DE910-DUAL") || - !strcmp(Global.core.model, "CE910-DUAL")); + return (!strncmp(Global.core.model, "DE910-DUAL", MODEL_LEN) || + !strncmp(Global.core.model, "CE910-DUAL", MODEL_LEN)); } int is_telit_model() -- cgit v1.2.3