Modify serial drivers to use cfmakeraw where applicable. Affects CFontz*,
CwLnx, EyeboxOne, MtxOrb, hd44780-lis, and serialPOS.
This commit is contained in:
@@ -16,6 +16,7 @@ v.0.5dev (ongoing development)
|
|||||||
* Introduce shared/defines.h to collect commonly used macros
|
* Introduce shared/defines.h to collect commonly used macros
|
||||||
+ new driver: SureElec for devices made by SURE Electronics (Laurent Latil)
|
+ new driver: SureElec for devices made by SURE Electronics (Laurent Latil)
|
||||||
* hd44780-4bit: Fix bug not checking for keypad rows 7-10 correctly
|
* hd44780-4bit: Fix bug not checking for keypad rows 7-10 correctly
|
||||||
|
* Modify serial drivers to use cfmakeraw
|
||||||
|
|
||||||
v0.5.3
|
v0.5.3
|
||||||
+ lcdexec: notification when called program finishes
|
+ lcdexec: notification when called program finishes
|
||||||
|
|||||||
+3
-11
@@ -216,17 +216,6 @@ CFontz_init(Driver *drvthis)
|
|||||||
tcgetattr(p->fd, &portset);
|
tcgetattr(p->fd, &portset);
|
||||||
|
|
||||||
/* We use RAW mode */
|
/* We use RAW mode */
|
||||||
if (usb) {
|
|
||||||
/* The USB way */
|
|
||||||
portset.c_iflag &= ~( IGNBRK | BRKINT | PARMRK | ISTRIP
|
|
||||||
| INLCR | IGNCR | ICRNL | IXON );
|
|
||||||
portset.c_oflag &= ~OPOST;
|
|
||||||
portset.c_lflag &= ~( ECHO | ECHONL | ICANON | ISIG | IEXTEN );
|
|
||||||
portset.c_cflag &= ~( CSIZE | PARENB | CRTSCTS );
|
|
||||||
portset.c_cflag |= CS8 | CREAD | CLOCAL ;
|
|
||||||
portset.c_cc[VMIN] = 1;
|
|
||||||
portset.c_cc[VTIME] = 3;
|
|
||||||
} else {
|
|
||||||
#ifdef HAVE_CFMAKERAW
|
#ifdef HAVE_CFMAKERAW
|
||||||
/* The easy way */
|
/* The easy way */
|
||||||
cfmakeraw(&portset);
|
cfmakeraw(&portset);
|
||||||
@@ -239,6 +228,9 @@ CFontz_init(Driver *drvthis)
|
|||||||
portset.c_cflag &= ~( CSIZE | PARENB | CRTSCTS );
|
portset.c_cflag &= ~( CSIZE | PARENB | CRTSCTS );
|
||||||
portset.c_cflag |= CS8 | CREAD | CLOCAL ;
|
portset.c_cflag |= CS8 | CREAD | CLOCAL ;
|
||||||
#endif
|
#endif
|
||||||
|
if (usb) {
|
||||||
|
portset.c_cc[VMIN] = 1;
|
||||||
|
portset.c_cc[VTIME] = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set port speed */
|
/* Set port speed */
|
||||||
|
|||||||
@@ -247,17 +247,6 @@ CFontz633_init (Driver *drvthis)
|
|||||||
tcgetattr(p->fd, &portset);
|
tcgetattr(p->fd, &portset);
|
||||||
|
|
||||||
/* We use RAW mode */
|
/* We use RAW mode */
|
||||||
if (p->usb) {
|
|
||||||
// The USB way
|
|
||||||
portset.c_iflag &= ~( IGNBRK | BRKINT | PARMRK | ISTRIP
|
|
||||||
| INLCR | IGNCR | ICRNL | IXON );
|
|
||||||
portset.c_oflag &= ~OPOST;
|
|
||||||
portset.c_lflag &= ~( ECHO | ECHONL | ICANON | ISIG | IEXTEN );
|
|
||||||
portset.c_cflag &= ~( CSIZE | PARENB | CRTSCTS );
|
|
||||||
portset.c_cflag |= CS8 | CREAD | CLOCAL;
|
|
||||||
portset.c_cc[VMIN] = 0;
|
|
||||||
portset.c_cc[VTIME] = 0;
|
|
||||||
} else {
|
|
||||||
#ifdef HAVE_CFMAKERAW
|
#ifdef HAVE_CFMAKERAW
|
||||||
/* The easy way */
|
/* The easy way */
|
||||||
cfmakeraw(&portset);
|
cfmakeraw(&portset);
|
||||||
@@ -270,6 +259,9 @@ CFontz633_init (Driver *drvthis)
|
|||||||
portset.c_cflag &= ~( CSIZE | PARENB | CRTSCTS );
|
portset.c_cflag &= ~( CSIZE | PARENB | CRTSCTS );
|
||||||
portset.c_cflag |= CS8 | CREAD | CLOCAL;
|
portset.c_cflag |= CS8 | CREAD | CLOCAL;
|
||||||
#endif
|
#endif
|
||||||
|
if (p->usb) {
|
||||||
|
portset.c_cc[VMIN] = 0;
|
||||||
|
portset.c_cc[VTIME] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set port speed */
|
/* Set port speed */
|
||||||
|
|||||||
@@ -310,17 +310,6 @@ CFontzPacket_init (Driver *drvthis)
|
|||||||
tcgetattr (p->fd, &portset);
|
tcgetattr (p->fd, &portset);
|
||||||
|
|
||||||
/* We use RAW mode */
|
/* We use RAW mode */
|
||||||
if (p->usb) {
|
|
||||||
// The USB way
|
|
||||||
portset.c_iflag &= ~( IGNBRK | BRKINT | PARMRK | ISTRIP
|
|
||||||
| INLCR | IGNCR | ICRNL | IXON );
|
|
||||||
portset.c_oflag &= ~OPOST;
|
|
||||||
portset.c_lflag &= ~( ECHO | ECHONL | ICANON | ISIG | IEXTEN );
|
|
||||||
portset.c_cflag &= ~( CSIZE | PARENB | CRTSCTS );
|
|
||||||
portset.c_cflag |= CS8 | CREAD | CLOCAL;
|
|
||||||
portset.c_cc[VMIN] = 0;
|
|
||||||
portset.c_cc[VTIME] = 0;
|
|
||||||
} else {
|
|
||||||
#ifdef HAVE_CFMAKERAW
|
#ifdef HAVE_CFMAKERAW
|
||||||
/* The easy way */
|
/* The easy way */
|
||||||
cfmakeraw(&portset);
|
cfmakeraw(&portset);
|
||||||
@@ -333,6 +322,9 @@ CFontzPacket_init (Driver *drvthis)
|
|||||||
portset.c_cflag &= ~( CSIZE | PARENB | CRTSCTS );
|
portset.c_cflag &= ~( CSIZE | PARENB | CRTSCTS );
|
||||||
portset.c_cflag |= CS8 | CREAD | CLOCAL;
|
portset.c_cflag |= CS8 | CREAD | CLOCAL;
|
||||||
#endif
|
#endif
|
||||||
|
if (p->usb) {
|
||||||
|
portset.c_cc[VMIN] = 0;
|
||||||
|
portset.c_cc[VTIME] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set port speed */
|
/* Set port speed */
|
||||||
|
|||||||
+20
-7
@@ -326,15 +326,28 @@ static void Setup_Port(int fd, speed_t speed)
|
|||||||
struct termios portset;
|
struct termios portset;
|
||||||
|
|
||||||
tcgetattr(fd, &portset);
|
tcgetattr(fd, &portset);
|
||||||
cfsetospeed(&portset, speed);
|
|
||||||
cfsetispeed(&portset, speed);
|
/* We use RAW mode */
|
||||||
portset.c_iflag = IGNBRK;
|
#ifdef HAVE_CFMAKERAW
|
||||||
portset.c_lflag = 0;
|
/* The easy way */
|
||||||
portset.c_oflag = 0;
|
cfmakeraw(&portset);
|
||||||
portset.c_cflag |= CLOCAL | CREAD;
|
#else
|
||||||
portset.c_cflag &= ~CRTSCTS;
|
/* The hard way */
|
||||||
|
portset.c_iflag &= ~( IGNBRK | BRKINT | PARMRK | ISTRIP
|
||||||
|
| INLCR | IGNCR | ICRNL | IXON );
|
||||||
|
portset.c_oflag &= ~OPOST;
|
||||||
|
portset.c_lflag &= ~( ECHO | ECHONL | ICANON | ISIG | IEXTEN );
|
||||||
|
portset.c_cflag &= ~( CSIZE | PARENB | CRTSCTS );
|
||||||
|
portset.c_cflag |= CS8 | CREAD | CLOCAL;
|
||||||
|
#endif
|
||||||
|
/* Set timeouts */
|
||||||
portset.c_cc[VMIN] = 1;
|
portset.c_cc[VMIN] = 1;
|
||||||
portset.c_cc[VTIME] = 5;
|
portset.c_cc[VTIME] = 5;
|
||||||
|
|
||||||
|
/* Set speed */
|
||||||
|
cfsetospeed(&portset, speed);
|
||||||
|
cfsetispeed(&portset, speed);
|
||||||
|
|
||||||
tcsetattr(fd, TCSANOW, &portset);
|
tcsetattr(fd, TCSANOW, &portset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -274,9 +274,8 @@ EyeboxOne_init (Driver *drvthis)
|
|||||||
|
|
||||||
tcgetattr(p->fd, &portset);
|
tcgetattr(p->fd, &portset);
|
||||||
|
|
||||||
// THIS ALL COMMENTED OUT BECAUSE WE NEED TO SET TIMEOUTS
|
|
||||||
/* We use RAW mode */
|
/* We use RAW mode */
|
||||||
#ifdef HAVE_CFMAKERAW_NOT
|
#ifdef HAVE_CFMAKERAW
|
||||||
/* The easy way */
|
/* The easy way */
|
||||||
cfmakeraw(&portset);
|
cfmakeraw(&portset);
|
||||||
#else
|
#else
|
||||||
@@ -287,9 +286,10 @@ EyeboxOne_init (Driver *drvthis)
|
|||||||
portset.c_lflag &= ~( ECHO | ECHONL | ICANON | ISIG | IEXTEN );
|
portset.c_lflag &= ~( ECHO | ECHONL | ICANON | ISIG | IEXTEN );
|
||||||
portset.c_cflag &= ~( CSIZE | PARENB | CRTSCTS );
|
portset.c_cflag &= ~( CSIZE | PARENB | CRTSCTS );
|
||||||
portset.c_cflag |= CS8 | CREAD | CLOCAL;
|
portset.c_cflag |= CS8 | CREAD | CLOCAL;
|
||||||
|
#endif
|
||||||
|
/* Set timeouts */
|
||||||
portset.c_cc[VMIN] = 1;
|
portset.c_cc[VMIN] = 1;
|
||||||
portset.c_cc[VTIME] = 3;
|
portset.c_cc[VTIME] = 3;
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Set port speed */
|
/* Set port speed */
|
||||||
cfsetospeed(&portset, speed);
|
cfsetospeed(&portset, speed);
|
||||||
|
|||||||
@@ -408,9 +408,8 @@ MtxOrb_init (Driver *drvthis)
|
|||||||
|
|
||||||
tcgetattr(p->fd, &portset);
|
tcgetattr(p->fd, &portset);
|
||||||
|
|
||||||
// THIS ALL COMMENTED OUT BECAUSE WE NEED TO SET TIMEOUTS
|
|
||||||
/* We use RAW mode */
|
/* We use RAW mode */
|
||||||
#ifdef HAVE_CFMAKERAW_NOT
|
#ifdef HAVE_CFMAKERAW
|
||||||
/* The easy way */
|
/* The easy way */
|
||||||
cfmakeraw(&portset);
|
cfmakeraw(&portset);
|
||||||
#else
|
#else
|
||||||
@@ -421,16 +420,21 @@ MtxOrb_init (Driver *drvthis)
|
|||||||
portset.c_lflag &= ~( ECHO | ECHONL | ICANON | ISIG | IEXTEN );
|
portset.c_lflag &= ~( ECHO | ECHONL | ICANON | ISIG | IEXTEN );
|
||||||
portset.c_cflag &= ~( CSIZE | PARENB | CRTSCTS );
|
portset.c_cflag &= ~( CSIZE | PARENB | CRTSCTS );
|
||||||
portset.c_cflag |= CS8 | CREAD | CLOCAL;
|
portset.c_cflag |= CS8 | CREAD | CLOCAL;
|
||||||
|
#endif
|
||||||
|
/* Set timeouts */
|
||||||
portset.c_cc[VMIN] = 1;
|
portset.c_cc[VMIN] = 1;
|
||||||
portset.c_cc[VTIME] = 3;
|
portset.c_cc[VTIME] = 3;
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Set port speed */
|
/* Set port speed */
|
||||||
cfsetospeed(&portset, speed);
|
cfsetospeed(&portset, speed);
|
||||||
cfsetispeed(&portset, B0);
|
cfsetispeed(&portset, B0);
|
||||||
|
|
||||||
/* Do it... */
|
/* Do it... */
|
||||||
tcsetattr(p->fd, TCSANOW, &portset);
|
if (tcsetattr(p->fd, TCSANOW, &portset) == -1) {
|
||||||
|
report(RPT_ERR, "%s: failed to configure port (%s)", drvthis->name, strerror(errno));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Make sure the frame buffer is there... */
|
/* Make sure the frame buffer is there... */
|
||||||
p->framebuf = (unsigned char *) calloc(p->width * p->height, 1);
|
p->framebuf = (unsigned char *) calloc(p->width * p->height, 1);
|
||||||
|
|||||||
@@ -91,12 +91,18 @@ int hd_init_lis2(Driver *drvthis)
|
|||||||
/* Get serial device parameters */
|
/* Get serial device parameters */
|
||||||
tcgetattr(p->fd, &portset);
|
tcgetattr(p->fd, &portset);
|
||||||
|
|
||||||
|
#ifdef HAVE_CFMAKERAW
|
||||||
|
/* The easy way */
|
||||||
|
cfmakeraw(&portset);
|
||||||
|
#else
|
||||||
portset.c_iflag &= ~( IGNBRK | BRKINT | PARMRK | ISTRIP
|
portset.c_iflag &= ~( IGNBRK | BRKINT | PARMRK | ISTRIP
|
||||||
| INLCR | IGNCR | ICRNL | IXON );
|
| INLCR | IGNCR | ICRNL | IXON );
|
||||||
portset.c_oflag &= ~OPOST;
|
portset.c_oflag &= ~OPOST;
|
||||||
portset.c_lflag &= ~( ECHO | ECHONL | ICANON | ISIG | IEXTEN );
|
portset.c_lflag &= ~( ECHO | ECHONL | ICANON | ISIG | IEXTEN );
|
||||||
portset.c_cflag &= ~( CSIZE | PARENB | CRTSCTS );
|
portset.c_cflag &= ~( CSIZE | PARENB | CRTSCTS );
|
||||||
portset.c_cflag |= CS8 | CREAD | CLOCAL ;
|
portset.c_cflag |= CS8 | CREAD | CLOCAL ;
|
||||||
|
#endif
|
||||||
|
/* Set timeouts */
|
||||||
portset.c_cc[VMIN] = 1;
|
portset.c_cc[VMIN] = 1;
|
||||||
portset.c_cc[VTIME] = 3;
|
portset.c_cc[VTIME] = 3;
|
||||||
|
|
||||||
|
|||||||
@@ -322,9 +322,8 @@ serialPOS_init (Driver *drvthis)
|
|||||||
|
|
||||||
tcgetattr(p->fd, &portset);
|
tcgetattr(p->fd, &portset);
|
||||||
|
|
||||||
// THIS ALL COMMENTED OUT BECAUSE WE NEED TO SET TIMEOUTS
|
|
||||||
/* We use RAW mode */
|
/* We use RAW mode */
|
||||||
#ifdef HAVE_CFMAKERAW_NOT
|
#ifdef HAVE_CFMAKERAW
|
||||||
/* The easy way */
|
/* The easy way */
|
||||||
cfmakeraw(&portset);
|
cfmakeraw(&portset);
|
||||||
#else
|
#else
|
||||||
@@ -335,9 +334,10 @@ serialPOS_init (Driver *drvthis)
|
|||||||
portset.c_lflag &= ~( ECHO | ECHONL | ICANON | ISIG | IEXTEN );
|
portset.c_lflag &= ~( ECHO | ECHONL | ICANON | ISIG | IEXTEN );
|
||||||
portset.c_cflag &= ~( CSIZE | PARENB | CRTSCTS );
|
portset.c_cflag &= ~( CSIZE | PARENB | CRTSCTS );
|
||||||
portset.c_cflag |= CS8 | CREAD | CLOCAL;
|
portset.c_cflag |= CS8 | CREAD | CLOCAL;
|
||||||
|
#endif
|
||||||
|
/* Set timeouts */
|
||||||
portset.c_cc[VMIN] = 1;
|
portset.c_cc[VMIN] = 1;
|
||||||
portset.c_cc[VTIME] = 3;
|
portset.c_cc[VTIME] = 3;
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Set port speed */
|
/* Set port speed */
|
||||||
cfsetospeed(&portset, speed);
|
cfsetospeed(&portset, speed);
|
||||||
|
|||||||
Reference in New Issue
Block a user