#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
+#include <errno.h>
#include <string.h>
#include <termios.h>
tty = open(dev, O_RDWR | O_NOCTTY | O_NONBLOCK);
if (tty < 0) {
- ERROR("%s: device open failed\n", dev);
+ ERROR("%s: device open failed: %s\n", dev, strerror(errno));
return -1;
}