summaryrefslogtreecommitdiff
path: root/src/sms_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sms_main.c')
-rw-r--r--src/sms_main.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/sms_main.c b/src/sms_main.c
index 5dda451..f319019 100644
--- a/src/sms_main.c
+++ b/src/sms_main.c
@@ -52,12 +52,10 @@ static int pb_list(int argc, char **argv)
int fd;
int ret;
- fd = tty_open(Global.core.device, Global.core.baud_rate);
+ fd = sms_device_open();
if (fd < 0) {
- fprintf(stderr, "failed to open tty device %s\n", Global.core.device);
return false;
}
- atcmd_init(fd, Global.core.read_timeout);
ret = print_phonebook_list(fd, Global.core.pb_store);
@@ -66,6 +64,22 @@ static int pb_list(int argc, char **argv)
return ret;
}
+static int sms_init(int argc, char **argv)
+{
+ int fd;
+
+ Global.core.sms_init = true;
+
+ fd = sms_device_open();
+ if (fd < 0) {
+ return false;
+ }
+
+ tty_close(fd);
+
+ return true;
+}
+
static struct sms_cmd top_cmds[] = {
{
.object = "send",
@@ -94,6 +108,10 @@ static struct sms_cmd top_cmds[] = {
.call = pb_list,
},
{
+ .object = "sms-init",
+ .call = sms_init,
+ },
+ {
.object = NULL,
.call = NULL,
},