From 776f8c30fbffa601f41c1b6f8618b3ca09e2d9dd Mon Sep 17 00:00:00 2001 From: Bjorn Andersson Date: Fri, 22 Jan 2021 18:04:58 -0600 Subject: [PATCH] console: Add send_break support Add support for send_break to the generic console implementation. Signed-off-by: Bjorn Andersson --- console.c | 5 +++++ console.h | 1 + device_parser.c | 1 + 3 files changed, 7 insertions(+) diff --git a/console.c b/console.c index 0ee2cee..2cab31a 100644 --- a/console.c +++ b/console.c @@ -68,3 +68,8 @@ int console_write(struct device *device, const void *buf, size_t len) { return write(device->console_fd, buf, len);; } + +void console_send_break(struct device *device) +{ + tcsendbreak(device->console_fd, 0); +} diff --git a/console.h b/console.h index e403645..62258a2 100644 --- a/console.h +++ b/console.h @@ -5,5 +5,6 @@ void console_open(struct device *device); int console_write(struct device *device, const void *buf, size_t len); +void console_send_break(struct device *device); #endif diff --git a/device_parser.c b/device_parser.c index 3e71a95..9fe0202 100644 --- a/device_parser.c +++ b/device_parser.c @@ -122,6 +122,7 @@ static void parse_board(struct device_parser *dp) } else if (!strcmp(key, "console")) { dev->console_dev = strdup(value); dev->write = console_write; + dev->send_break = console_send_break; } else if (!strcmp(key, "voltage")) { dev->voltage = strtoul(value, NULL, 10); } else if (!strcmp(key, "fastboot")) {