-/* $OpenBSD: mouse_protocols.c,v 1.15 2014/05/14 18:23:22 shadchin Exp $ */
+/* $OpenBSD: mouse_protocols.c,v 1.16 2014/05/14 18:28:22 shadchin Exp $ */
/*
* Copyright (c) 2001 Jean-Baptiste Marchand, Julien Montagne and Jerome Verdon
}
void
-SetMouseSpeed(int old, int new, unsigned int cflag)
+SetMouseSpeed(int old, unsigned int cflag)
{
struct termios tty;
char *c;
if (tcsetattr(mouse.mfd, TCSADRAIN, &tty) < 0)
logerr(1, "unable to get mouse status. Exiting...\n");
- switch (new) {
- case 9600:
- c = "*q";
- cfsetispeed(&tty, B9600);
- cfsetospeed(&tty, B9600);
- break;
- case 4800:
- c = "*p";
- cfsetispeed(&tty, B4800);
- cfsetospeed(&tty, B4800);
- break;
- case 2400:
- c = "*o";
- cfsetispeed(&tty, B2400);
- cfsetospeed(&tty, B2400);
- break;
- case 1200:
- default:
- c = "*n";
- cfsetispeed(&tty, B1200);
- cfsetospeed(&tty, B1200);
- }
+ c = "*n";
+ cfsetispeed(&tty, B1200);
+ cfsetospeed(&tty, B1200);
if (mouse.proto == P_LOGIMAN || mouse.proto == P_LOGI) {
if (write(mouse.mfd, c, 2) != 2)
goto disconnect_idle;
/* port setup, 1st phase (2.1.3) */
- SetMouseSpeed(1200, 1200, (CS7 | CREAD | CLOCAL | HUPCL));
+ SetMouseSpeed(1200, (CS7 | CREAD | CLOCAL | HUPCL));
i = TIOCM_DTR | TIOCM_RTS; /* DTR = 0, RTS = 0 */
ioctl(mouse_fd, TIOCMBIC, &i);
usleep(200000);
/*
* This is a simplified procedure; it simply toggles RTS.
*/
- SetMouseSpeed(1200, 1200, (CS7 | CREAD | CLOCAL | HUPCL));
+ SetMouseSpeed(1200, (CS7 | CREAD | CLOCAL | HUPCL));
ioctl(mouse_fd, TIOCMGET, &i);
i |= TIOCM_DTR; /* DTR = 1 */
* The baud rate selection command must be sent at the current
* baud rate; try all likely settings
*/
- SetMouseSpeed(9600, 1200, mousecflags[mouse.proto]);
- SetMouseSpeed(4800, 1200, mousecflags[mouse.proto]);
- SetMouseSpeed(2400, 1200, mousecflags[mouse.proto]);
+ SetMouseSpeed(9600, mousecflags[mouse.proto]);
+ SetMouseSpeed(4800, mousecflags[mouse.proto]);
+ SetMouseSpeed(2400, mousecflags[mouse.proto]);
#if 0
- SetMouseSpeed(1200, 1200, mousecflags[mouse.proto]);
+ SetMouseSpeed(1200, mousecflags[mouse.proto]);
#endif
/* select MM series data format */
write(mouse.mfd, "S", 1);
- SetMouseSpeed(1200, 1200, mousecflags[P_MM]);
+ SetMouseSpeed(1200, mousecflags[P_MM]);
/* select report rate/frequency */
if (mouse.rate <= 0)
write(mouse.mfd, "O", 1);
case P_LOGIMAN:
/* The command must always be sent at 1200 baud */
- SetMouseSpeed(1200, 1200, mousecflags[mouse.proto]);
+ SetMouseSpeed(1200, mousecflags[mouse.proto]);
write(mouse.mfd, "*X", 2);
- SetMouseSpeed(1200, 1200, mousecflags[mouse.proto]);
+ SetMouseSpeed(1200, mousecflags[mouse.proto]);
break;
case P_MMHIT:
- SetMouseSpeed(1200, 1200, mousecflags[mouse.proto]);
+ SetMouseSpeed(1200, mousecflags[mouse.proto]);
/*
* Initialize Hitachi PUMA Plus - Model 1212E to desired settings.
break;
case P_THINKING:
- SetMouseSpeed(1200, 1200, mousecflags[mouse.proto]);
+ SetMouseSpeed(1200, mousecflags[mouse.proto]);
/* the PnP ID string may be sent again, discard it */
usleep(200000);
i = FREAD;
break;
case P_MSC:
- SetMouseSpeed(1200, 1200, mousecflags[mouse.proto]);
+ SetMouseSpeed(1200, mousecflags[mouse.proto]);
#if 0
if (mouse.flags & ClearDTR) {
i = TIOCM_DTR;
break;
default:
- SetMouseSpeed(1200, 1200, mousecflags[mouse.proto]);
+ SetMouseSpeed(1200, mousecflags[mouse.proto]);
break;
}
}