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;
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);
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;