uart: allow whitespace in config 54/261754/1 submit/tizen/20210805.103313
authorAdrian Szyndela <adrian.s@samsung.com>
Fri, 23 Jul 2021 11:39:20 +0000 (13:39 +0200)
committerAdrian Szyndela <adrian.s@samsung.com>
Fri, 23 Jul 2021 11:39:20 +0000 (13:39 +0200)
Add spaces to the format string on the sides of the '=' char, to allow
any amount of whitespace, including none.
For example, all below lines are valid now:
17=/dev/ttyS0
17 =/dev/ttyS0
17= /dev/ttyS0
17 = /dev/ttyS0
17       =     /dev/ttyS0

Change-Id: I3369880b89ba865c3b3638f9874788a7eaf60580

src/peripheral_uart.c

index ab1dcaabef0bfdcdc2969705bd37e77f169236eb..17644c5599182fad6e57f0d55af99ef86d8f8713 100644 (file)
@@ -79,7 +79,7 @@ static int peripheral_uart_find_devpath(int port, char *buffer, int len)
                return -1;
 
        while (fgets(line, sizeof(line), fp)) {
-               if (sscanf(line, "%d=%21s", &key, value) != 2)
+               if (sscanf(line, "%d = %21s", &key, value) != 2)
                        continue;
 
                if (key != port)