sr_spew("Sending '%s'.", cmd);
strncpy(buf, cmd, 28);
if (!strncmp(buf, "*IDN?", 5))
- strncat(buf, "\r\n", 32);
+ strcat(buf, "\r\n");
else
- strncat(buf, "\n\r\n", 32);
- if (serial_write(serial, buf, strlen(buf)) == -1) {
- sr_err("Failed to send: %s.", strerror(errno));
+ strcat(buf, "\n\r\n");
+ if (serial_write_blocking(serial, buf, strlen(buf), SERIAL_WRITE_TIMEOUT_MS) < (int)strlen(buf)) {
+ sr_err("Failed to send.");
return SR_ERR;
}