native uart - read into unsigned char. The character buffer used to be a plain char (typically signed). The uart struct stores the read char as a signed int. When a character with a value > 127 was read, it was interpretted as a negative number. Storing this in a signed int caused the actual byte value to be lost. E.g., when 0xff was read, this ultimately got stored as a -1, indicating a read failure.
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/06ff4cd9 Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/06ff4cd9 Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/06ff4cd9 Branch: refs/heads/develop Commit: 06ff4cd941afbdf5e53af9c918a89fd9600087e1 Parents: 853eea7 Author: Christopher Collins <[email protected]> Authored: Thu Dec 29 16:59:50 2016 -0800 Committer: Christopher Collins <[email protected]> Committed: Thu Dec 29 16:59:50 2016 -0800 ---------------------------------------------------------------------- hw/mcu/native/src/hal_uart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/06ff4cd9/hw/mcu/native/src/hal_uart.c ---------------------------------------------------------------------- diff --git a/hw/mcu/native/src/hal_uart.c b/hw/mcu/native/src/hal_uart.c index 1ac5b97..4c2c076 100644 --- a/hw/mcu/native/src/hal_uart.c +++ b/hw/mcu/native/src/hal_uart.c @@ -168,7 +168,7 @@ uart_poller(void *arg) int rc; int bytes; int sr; - char ch; + unsigned char ch; struct uart *uart; while (1) {
