fix uart_open's incorrect use of strtok_r, fixing uart device init

This commit is contained in:
Gered 2025-02-03 20:53:39 -05:00
parent e45a899c43
commit 51634ffd6b

View file

@ -293,7 +293,7 @@ short uart_open(p_channel chan, const unsigned char * spec, short mode) {
uart_setbps(cdev_to_uart(chan->dev), bps_code); uart_setbps(cdev_to_uart(chan->dev), bps_code);
// Get the next token // Get the next token
token = strtok_r(spec_copy, ",", &saveptr); token = strtok_r(NULL, ",", &saveptr);
if (token) { if (token) {
// Parse the data bit count // Parse the data bit count
i = atoi(token); i = atoi(token);
@ -320,7 +320,7 @@ short uart_open(p_channel chan, const unsigned char * spec, short mode) {
} }
// Get the next token // Get the next token
token = strtok_r(spec_copy, ",", &saveptr); token = strtok_r(NULL, ",", &saveptr);
if (token) { if (token) {
// Parse the stop bit count (1 or 2) // Parse the stop bit count (1 or 2)
i = atoi(token); i = atoi(token);
@ -334,7 +334,7 @@ short uart_open(p_channel chan, const unsigned char * spec, short mode) {
} }
// Get the next token // Get the next token
token = strtok_r(spec_copy, ",", &saveptr); token = strtok_r(NULL, ",", &saveptr);
if (token) { if (token) {
// NONE, ODD, EVEN, MARK, or SPACE // NONE, ODD, EVEN, MARK, or SPACE
if (strcmp(token, "NONE") == 0) { if (strcmp(token, "NONE") == 0) {