X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=sball;a=blobdiff_plain;f=src%2Fsball.c;fp=src%2Fsball.c;h=951ff45026b9e393f1c60afd491da21aad1c7aab;hp=9dce2ae1c58636c0adf7388b1f52931eb4174657;hb=b749ae14b503c3a01d8fcefc22daf561454a3de0;hpb=9f32047b6512fb261f5b57f62571b658ba6e3330 diff --git a/src/sball.c b/src/sball.c index 9dce2ae..951ff45 100644 --- a/src/sball.c +++ b/src/sball.c @@ -169,7 +169,13 @@ int sball_num_buttons(struct sball *sb) return sb->nbuttons; } -/* Labtec spaceball: 9600 8n1 XON/XOFF */ +/* Labtec spaceball: 9600 8n1 XON/XOFF + * Can't use canonical mode to assemble input into lines for the spaceball, + * because binary data received for motion events can include newlines which + * would be eaten up by the line discipline. Therefore we'll rely on VTIME=1 to + * hopefully get more than 1 byte at a time. Alternatively we could request + * printable reports, but I don't feel like implementing that. + */ static int stty_sball(struct sball *sb) { int mstat; @@ -177,17 +183,12 @@ static int stty_sball(struct sball *sb) term = sb->saved_term; term.c_oflag = 0; - term.c_lflag = ICANON; + term.c_lflag = 0; term.c_cc[VMIN] = 0; - term.c_cc[VTIME] = 0; - term.c_cc[VEOF] = 0; - term.c_cc[VEOL] = '\r'; - term.c_cc[VEOL2] = 0; - term.c_cc[VERASE] = 0; - term.c_cc[VKILL] = 0; + term.c_cc[VTIME] = 1; term.c_cflag = CLOCAL | CREAD | CS8 | HUPCL; - term.c_iflag = IGNBRK | IGNPAR; + term.c_iflag = IGNBRK | IGNPAR | IXON | IXOFF; cfsetispeed(&term, B9600); cfsetospeed(&term, B9600); @@ -203,7 +204,10 @@ static int stty_sball(struct sball *sb) return 0; } -/* Logicad magellan spacemouse: 9600 8n2 CTS/RTS */ +/* Logicad magellan spacemouse: 9600 8n2 CTS/RTS + * Since the magellan devices don't seem to send any newlines, we can rely on + * canonical mode to feed us nice whole lines at a time. + */ static int stty_mag(struct sball *sb) { int mstat;