1
/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/dgux/dgux_tty.c,v 1.2 1999/01/26 10:40:38 dawes Exp $ */
3
* INTEL DG/UX RELEASE 4.20 MU03
4
* Copyright 1997 Takis Psarogiannakopoulos Cambridge,UK
5
* <takis@dpmms.cam.ac.uk>
7
* Permission to use, copy, modify, distribute, and sell this software and its
8
* documentation for any purpose is hereby granted without fee, provided that
9
* the above copyright notice appear in all copies and that both that
10
* copyright notice and this permission notice appear in supporting
12
* XCONSORTIUM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE.
13
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
14
* FITNESS, IN NO EVENT SHALL XCONSORTIUM BE LIABLE FOR
15
* ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
16
* RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
17
* CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
18
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21
/* BSD (POSIX) Flavor tty for ix86 DG/ux R4.20MU03 */
27
#include "scrnintstr.h"
29
#include "xf86Procs.h"
30
#include "xf86_OSlib.h"
31
#include "xf86_Config.h"
33
static Bool not_a_tty = FALSE;
35
void xf86SetMouseSpeed(mouse, old, new, cflag)
47
if (tcgetattr(mouse->mseFd, &tty) < 0)
50
ErrorF("Warning: %s unable to get status of mouse fd (%s)\n",
51
mouse->mseDevice, strerror(errno));
55
/* this will query the initial baudrate only once */
56
if (mouse->oldBaudRate < 0) {
57
switch (cfgetispeed(&tty))
60
mouse->oldBaudRate = 9600;
63
mouse->oldBaudRate = 4800;
66
mouse->oldBaudRate = 2400;
70
mouse->oldBaudRate = 1200;
75
tty.c_iflag = IGNBRK | IGNPAR;
78
tty.c_cflag = (tcflag_t)cflag;
85
cfsetispeed(&tty, B9600);
86
cfsetospeed(&tty, B9600);
89
cfsetispeed(&tty, B4800);
90
cfsetospeed(&tty, B4800);
93
cfsetispeed(&tty, B2400);
94
cfsetospeed(&tty, B2400);
98
cfsetispeed(&tty, B1200);
99
cfsetospeed(&tty, B1200);
102
if (tcsetattr(mouse->mseFd, TCSADRAIN, &tty) < 0)
104
if (xf86Info.allowMouseOpenFail) {
105
ErrorF("Unable to set status of mouse fd (%s) - Continuing...\n",
109
xf86FatalError("Unable to set status of mouse fd (%s)\n",
117
cfsetispeed(&tty, B9600);
118
cfsetospeed(&tty, B9600);
122
cfsetispeed(&tty, B4800);
123
cfsetospeed(&tty, B4800);
127
cfsetispeed(&tty, B2400);
128
cfsetospeed(&tty, B2400);
133
cfsetispeed(&tty, B1200);
134
cfsetospeed(&tty, B1200);
137
if (mouse->mseType == P_LOGIMAN || mouse->mseType == P_LOGI)
139
if (write(mouse->mseFd, c, 2) != 2)
141
if (xf86AllowMouseOpenFail) {
142
ErrorF("Unable to write to mouse fd (%s) - Continuing...\n",
146
xf86FatalError("Unable to write to mouse fd (%s)\n",
152
if (tcsetattr(mouse->mseFd, TCSADRAIN, &tty) < 0)
154
if (xf86AllowMouseOpenFail) {
155
ErrorF("Unable to set status of mouse fd (%s) - Continuing...\n",
159
xf86FatalError("Unable to set status of mouse fd (%s)\n",
164
/* ADDED FOR X 3.3.2.3 */
169
return tcflush(fd, TCIFLUSH);