Don't use printf for trace messages as we have the new tracing code.
Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
#include <string.h>
#include <linux/termios.h>
#include <unistd.h>
#include <string.h>
#include <linux/termios.h>
#include <unistd.h>
/*
* HACK: declare the ioctl function by hand...
/*
* HACK: declare the ioctl function by hand...
fd = open(device, O_RDWR | O_NOCTTY | O_NDELAY);
if (fd == -1) {
fd = open(device, O_RDWR | O_NOCTTY | O_NDELAY);
if (fd == -1) {
- fprintf(stderr, "error opening %s: %m\n", device);
+ pr_err("error opening %s: %m\n", device);
return fd;
}
if (ioctl(fd, TCGETS2, &tios)) {
return fd;
}
if (ioctl(fd, TCGETS2, &tios)) {
+ pr_err("TCGETS2: %m\n");
tios.c_ospeed = *baud;
if (ioctl(fd, TCSETS2, &tios)) {
tios.c_ospeed = *baud;
if (ioctl(fd, TCSETS2, &tios)) {
goto err;
}
if (ioctl(fd, TCGETS2, &tios)) {
goto err;
}
if (ioctl(fd, TCGETS2, &tios)) {
#include "options.h"
#include "baud.h"
#include "options.h"
#include "baud.h"
int main(int argc, char *argv[])
{
int main(int argc, char *argv[])
{
return 1;
if (baud != options.baud_rate) {
return 1;
if (baud != options.baud_rate) {
- printf("Failed to set baudrate to %d, only got %d\n",
+ pr_err("Failed to set baudrate to %d, only got %d\n",
options.baud_rate, baud);
close(fd);
return 1;
options.baud_rate, baud);
close(fd);
return 1;
ev.events = EPOLLIN;
ev.data.fd = fd;
if (epoll_ctl(epoll_fd, EPOLL_CTL_ADD, fd, &ev) == -1) {
ev.events = EPOLLIN;
ev.data.fd = fd;
if (epoll_ctl(epoll_fd, EPOLL_CTL_ADD, fd, &ev) == -1) {
+ pr_err("epoll_ctl: %m\n");
return 1;
}
ret = read(fd, buf, sizeof(buf));
if (read < 0) {
return 1;
}
ret = read(fd, buf, sizeof(buf));
if (read < 0) {
+ if (ret == 0) {
+ pr_err("Read EOF, stopping\n");
ret = write(1, buf, ret);
if (read < 0) {
ret = write(1, buf, ret);
if (read < 0) {