~ubuntu-branches/ubuntu/intrepid/xserver-xgl/intrepid

« back to all changes in this revision

Viewing changes to hw/xfree86/os-support/shared/sysv_kbd.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthew Garrett
  • Date: 2006-02-13 14:21:43 UTC
  • Revision ID: james.westby@ubuntu.com-20060213142143-mad6z9xzem7hzxz9
Tags: upstream-7.0.0
ImportĀ upstreamĀ versionĀ 7.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/sysv_kbd.c,v 3.3 1998/07/25 16:57:02 dawes Exp $ */
 
2
/*
 
3
 * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany
 
4
 * Copyright 1993 by David Dawes <dawes@XFree86.org>
 
5
 *
 
6
 * Permission to use, copy, modify, distribute, and sell this software and its
 
7
 * documentation for any purpose is hereby granted without fee, provided that
 
8
 * the above copyright notice appear in all copies and that both that
 
9
 * copyright notice and this permission notice appear in supporting
 
10
 * documentation, and that the names of Thomas Roell and David Dawes 
 
11
 * not be used in advertising or publicity pertaining to distribution of 
 
12
 * the software without specific, written prior permission.  Thomas Roell and
 
13
 * David Dawes makes no representations about the suitability of this 
 
14
 * software for any purpose.  It is provided "as is" without express or 
 
15
 * implied warranty.
 
16
 *
 
17
 * THOMAS ROELL AND DAVID DAWES DISCLAIMS ALL WARRANTIES WITH REGARD TO 
 
18
 * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND 
 
19
 * FITNESS, IN NO EVENT SHALL THOMAS ROELL OR DAVID DAWES BE LIABLE FOR 
 
20
 * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER 
 
21
 * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF 
 
22
 * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 
 
23
 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
24
 *
 
25
 */
 
26
/* $XConsortium: sysv_kbd.c /main/3 1996/02/21 17:53:59 kaleb $ */
 
27
 
 
28
#ifdef HAVE_XORG_CONFIG_H
 
29
#include <xorg-config.h>
 
30
#endif
 
31
 
 
32
#include <X11/X.h>
 
33
 
 
34
#include "compiler.h"
 
35
 
 
36
#include "xf86.h"
 
37
#include "xf86Priv.h"
 
38
#include "xf86_OSlib.h"
 
39
 
 
40
int
 
41
xf86GetKbdLeds()
 
42
{
 
43
        int leds;
 
44
 
 
45
        ioctl(xf86Info.consoleFd, KDGETLED, &leds);
 
46
        return(leds);
 
47
}
 
48
 
 
49
void
 
50
xf86SetKbdRepeat(char rad)
 
51
{
 
52
#ifdef KDSETRAD
 
53
        ioctl(xf86Info.consoleFd, KDSETRAD, rad);
 
54
#endif
 
55
}
 
56
 
 
57
static int kbdtrans;
 
58
static struct termio kbdtty;
 
59
static char *kbdemap = NULL;
 
60
 
 
61
void
 
62
xf86KbdInit()
 
63
{
 
64
#ifdef KDGKBMODE
 
65
        ioctl (xf86Info.consoleFd, KDGKBMODE, &kbdtrans);
 
66
#endif
 
67
        ioctl (xf86Info.consoleFd, TCGETA, &kbdtty);
 
68
#if defined(E_TABSZ)
 
69
        kbdemap = xalloc(E_TABSZ);
 
70
        if (ioctl(xf86Info.consoleFd, LDGMAP, kbdemap) < 0)
 
71
        {
 
72
                xfree(kbdemap);
 
73
                kbdemap = NULL;
 
74
        }
 
75
#endif
 
76
}
 
77
 
 
78
int
 
79
xf86KbdOn()
 
80
{
 
81
        struct termio nTty;
 
82
 
 
83
        ioctl(xf86Info.consoleFd, KDSKBMODE, K_RAW);
 
84
        ioctl(xf86Info.consoleFd, LDNMAP, 0); /* disable mapping completely */
 
85
        nTty = kbdtty;
 
86
        nTty.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP);
 
87
        nTty.c_oflag = 0;
 
88
        nTty.c_cflag = CREAD | CS8 | B9600;
 
89
        nTty.c_lflag = 0;
 
90
        nTty.c_cc[VTIME]=0;
 
91
        nTty.c_cc[VMIN]=1;
 
92
        ioctl(xf86Info.consoleFd, TCSETA, &nTty);
 
93
        return(xf86Info.consoleFd);
 
94
}
 
95
 
 
96
int
 
97
xf86KbdOff()
 
98
{
 
99
        if (kbdemap)
 
100
        {
 
101
                ioctl(xf86Info.consoleFd, LDSMAP, kbdemap);
 
102
        }
 
103
        ioctl(xf86Info.consoleFd, KDSKBMODE, kbdtrans);
 
104
        ioctl(xf86Info.consoleFd, TCSETA, &kbdtty);
 
105
        return(xf86Info.consoleFd);
 
106
}