tondaj-sl-814: Mark serial read/write calls as blocking.
These calls are executed from an event handler and were previously nonblocking, but they have no partial read/write handling. The code is already marked TODO for improvement.
This commit is contained in:
parent
47d98603e7
commit
539a85596f
|
@ -133,14 +133,14 @@ int tondaj_sl_814_receive_data(int fd, int revents, void *cb_data)
|
||||||
buf[2] = 0x0d;
|
buf[2] = 0x0d;
|
||||||
sr_spew("Sending init command: %02x %02x %02x.",
|
sr_spew("Sending init command: %02x %02x %02x.",
|
||||||
buf[0], buf[1], buf[2]);
|
buf[0], buf[1], buf[2]);
|
||||||
if ((ret = serial_write(serial, buf, 3)) < 0) {
|
if ((ret = serial_write_blocking(serial, buf, 3)) < 0) {
|
||||||
sr_err("Error sending init command: %d.", ret);
|
sr_err("Error sending init command: %d.", ret);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
devc->state = GET_INIT_REPLY;
|
devc->state = GET_INIT_REPLY;
|
||||||
} else if (devc->state == GET_INIT_REPLY) {
|
} else if (devc->state == GET_INIT_REPLY) {
|
||||||
/* If we just sent the "init" command, get its reply. */
|
/* If we just sent the "init" command, get its reply. */
|
||||||
if ((ret = serial_read(serial, buf, 2)) < 0) {
|
if ((ret = serial_read_blocking(serial, buf, 2)) < 0) {
|
||||||
sr_err("Error reading init reply: %d.", ret);
|
sr_err("Error reading init reply: %d.", ret);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -159,7 +159,7 @@ int tondaj_sl_814_receive_data(int fd, int revents, void *cb_data)
|
||||||
buf[2] = 0x0d;
|
buf[2] = 0x0d;
|
||||||
sr_spew("Sending data request command: %02x %02x %02x.",
|
sr_spew("Sending data request command: %02x %02x %02x.",
|
||||||
buf[0], buf[1], buf[2]);
|
buf[0], buf[1], buf[2]);
|
||||||
if ((ret = serial_write(serial, buf, 3)) < 0) {
|
if ((ret = serial_write_blocking(serial, buf, 3)) < 0) {
|
||||||
sr_err("Error sending request command: %d.", ret);
|
sr_err("Error sending request command: %d.", ret);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue