mmtty: allow enabling LF with --send-lf

This commit is contained in:
Aleksander Morgado
2021-03-31 11:02:25 +02:00
parent 9d6ff2485a
commit 65e860439a

View File

@@ -42,6 +42,7 @@ static gchar *device_str;
static gboolean no_flash_flag; static gboolean no_flash_flag;
static gboolean no_echo_removal_flag; static gboolean no_echo_removal_flag;
static gint64 send_delay = -1; static gint64 send_delay = -1;
static gboolean send_lf_flag;
static gboolean verbose_flag; static gboolean verbose_flag;
static gboolean version_flag; static gboolean version_flag;
@@ -62,6 +63,10 @@ static GOptionEntry main_entries[] = {
"Send delay for each byte in microseconds (default=1000)", "Send delay for each byte in microseconds (default=1000)",
"[DELAY]" "[DELAY]"
}, },
{ "send-lf", 0, 0, G_OPTION_ARG_NONE, &send_lf_flag,
"Send <CR><LF> (default <CR> only)",
NULL
},
{ "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose_flag, { "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose_flag,
"Run action with verbose logs", "Run action with verbose logs",
NULL NULL
@@ -212,6 +217,12 @@ start_cb (void)
g_object_set (port, MM_PORT_SERIAL_AT_REMOVE_ECHO, FALSE, NULL); g_object_set (port, MM_PORT_SERIAL_AT_REMOVE_ECHO, FALSE, NULL);
} }
/* Setup LF */
if (send_lf_flag) {
g_print ("enabling LF...\n");
g_object_set (port, MM_PORT_SERIAL_AT_SEND_LF, TRUE, NULL);
}
/* Set common response parser */ /* Set common response parser */
mm_port_serial_at_set_response_parser (MM_PORT_SERIAL_AT (port), mm_port_serial_at_set_response_parser (MM_PORT_SERIAL_AT (port),
mm_serial_parser_v1_parse, mm_serial_parser_v1_parse,