diff options
author | Jeff Hatch <jhatch@multitech.com> | 2020-06-23 10:58:03 -0500 |
---|---|---|
committer | Jeff Hatch <jhatch@multitech.com> | 2020-06-23 10:58:03 -0500 |
commit | 358bae8230e3c946f6bb2d8c7960bcab85cfdd24 (patch) | |
tree | e5e9d77d3c0f0d10a303a4f45399e555c3436ab8 | |
parent | 3d3c735f3bbd269f97bd59a246d5f18b010eda2b (diff) | |
parent | 4fc2e232b17be5ea12d152a6c3f72902594f1966 (diff) | |
download | sms-utils-358bae8230e3c946f6bb2d8c7960bcab85cfdd24.tar.gz sms-utils-358bae8230e3c946f6bb2d8c7960bcab85cfdd24.tar.bz2 sms-utils-358bae8230e3c946f6bb2d8c7960bcab85cfdd24.zip |
Merge branch 'ap/GP-655_LNA7_SMS' into 'mpower-5.2-lna7'
[MTX-3449] mPower June20: GP-655 LNA7: SMS -> 3GPP vs. 3GPP2
See merge request !10
-rw-r--r-- | src/atcmd.c | 29 | ||||
-rw-r--r-- | src/atcmd.h | 3 | ||||
-rw-r--r-- | src/sms_delete.c | 20 | ||||
-rw-r--r-- | src/sms_list.c | 20 | ||||
-rw-r--r-- | src/sms_utils.h | 3 |
5 files changed, 73 insertions, 2 deletions
diff --git a/src/atcmd.c b/src/atcmd.c index 97fd34b..f881808 100644 --- a/src/atcmd.c +++ b/src/atcmd.c @@ -830,6 +830,21 @@ int atcmd_plus_cmgd_write(int fd, int index) return 0; } +int atcmd_plus_qcfg_write(int fd, int sms_format) +{ + char buf[ATCMD_LINE_SIZE]; + int tmp; + + atcmd_writeline(fd, "AT+QCFG=\"ltesms/format\",%d", sms_format); + tmp = atcmd_expect_line(fd, buf, sizeof(buf), "OK"); + if (tmp <= 0) { + log_debug("expected OK but it was not received"); + return -1; + } + + return 0; +} + int atcmd_response_foreach_line(int fd, atcmd_response_callback_t call, void *prv) { char buf[ATCMD_LINE_SIZE]; @@ -1542,6 +1557,20 @@ int is_vzw_lte(void) !strncmp(Global.core.model, "LE910-SV1", MODEL_LEN)); } +/* Detect LNA7 radio with Verizon SIM */ +int is_vzw_lna7(void) +{ + if (!strncmp(Global.core.model, "EG95", MODEL_LEN)) { + log_debug("Found EG95"); + /* Verizon Wireless SIM */ + if (strncmp(Global.core.iccid,"891480",6) == 0) { + log_debug("Found VZW SIM"); + return 1; + } + } + return 0; +} + int isCdmaTypeModel() { /* Test for possible dual firmware model */ diff --git a/src/atcmd.h b/src/atcmd.h index dc3d5d9..1390dff 100644 --- a/src/atcmd.h +++ b/src/atcmd.h @@ -70,6 +70,8 @@ int atcmd_plus_cmgs_write_text(int fd, const char *addr, const char *msg, size_t int atcmd_plus_cmss_write(int fd, int index, const char *addr, int addr_type); int atcmd_plus_cmgd_write(int fd, int index); +int atcmd_plus_qcfg_write(int fd, int sms_format); + int isCdmaTypeModel(); #define STORE_NAME_LEN 2 @@ -120,6 +122,7 @@ int atcmd_init(int fd, int read_timeout); int sms_device_close(int fd); int sms_device_open(void); int is_vzw_lte(void); +int is_vzw_lna7(void); int is_telit_model(void); int is_quectel_model(void); diff --git a/src/sms_delete.c b/src/sms_delete.c index b45546e..48afc06 100644 --- a/src/sms_delete.c +++ b/src/sms_delete.c @@ -141,6 +141,8 @@ int sms_delete(int argc, char **argv) int option_index; int ret; int fd; + int ret_3gpp = false; + int ret_3gpp2 = false; while ((i = getopt_long(argc, argv, short_options, long_options, &option_index)) >= 0) { switch (i) { @@ -165,7 +167,23 @@ int sms_delete(int argc, char **argv) return false; } - ret = do_delete(fd, argc, argv); + // LNA7 with Verizon SIM SMS 3GPP, 3GPP2 WORKAROUND + if (is_vzw_lna7()) { + int tmp; + tmp = atcmd_plus_qcfg_write(fd, SMS_FORMAT_3GPP); + if (tmp == 0) { + ret_3gpp = do_delete(fd, argc, argv); + } + + tmp = atcmd_plus_qcfg_write(fd, SMS_FORMAT_3GPP2); + if (tmp == 0) { + ret_3gpp2 = do_delete(fd, argc, argv); + } + + ret = (ret_3gpp || ret_3gpp2); + } else { + ret = do_delete(fd, argc, argv); + } sms_device_close(fd); diff --git a/src/sms_list.c b/src/sms_list.c index 678c158..d5ad263 100644 --- a/src/sms_list.c +++ b/src/sms_list.c @@ -456,6 +456,8 @@ int sms_list(int argc, char **argv) int option_index; int ret; int fd; + int ret_3gpp = false; + int ret_3gpp2 = false; if (argc < 1) { log_debug("should have received at least one argument"); @@ -497,7 +499,23 @@ int sms_list(int argc, char **argv) return false; } - ret = do_list(fd, cmd_type, argc, argv); + // LNA7 with Verizon SIM SMS 3GPP, 3GPP2 WORKAROUND + if (is_vzw_lna7()) { + int tmp; + tmp = atcmd_plus_qcfg_write(fd, SMS_FORMAT_3GPP); + if (tmp == 0) { + ret_3gpp = do_list(fd, cmd_type, argc, argv); + } + + tmp = atcmd_plus_qcfg_write(fd, SMS_FORMAT_3GPP2); + if (tmp == 0) { + ret_3gpp2 = do_list(fd, cmd_type, argc, argv); + } + + ret = (ret_3gpp || ret_3gpp2); + } else { + ret = do_list(fd, cmd_type, argc, argv); + } sms_device_close(fd); diff --git a/src/sms_utils.h b/src/sms_utils.h index 01d0e1f..2c50eb7 100644 --- a/src/sms_utils.h +++ b/src/sms_utils.h @@ -16,6 +16,9 @@ #define SMS_PDU_MODE 0 #define SMS_TEXT_MODE 1 +#define SMS_FORMAT_3GPP 1 +#define SMS_FORMAT_3GPP2 0 + #define SMS_ADDR_UNSPEC 0x00 #define SMS_ADDR_LOCAL 0x81 #define SMS_ADDR_GLOBAL 0x91 |