~ubuntu-branches/ubuntu/gutsy/vnc4/gutsy

« back to all changes in this revision

Viewing changes to unix/xc/programs/Xserver/hw/xfree86/input/magellan/magellan.h

  • Committer: Bazaar Package Importer
  • Author(s): Ola Lundqvist
  • Date: 2006-05-15 20:35:17 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20060515203517-l4lre1ku942mn26k
Tags: 4.1.1+X4.3.0-10
* Correction of critical security issue. Thanks to Martin Kogler
  <e9925248@student.tuwien.ac.at> that informed me about the issue,
  and provided the patch.
  This flaw was originally found by Steve Wiseman of intelliadmin.com.
* Applied patch from Javier Kohen <jkohen@users.sourceforge.net> that
  inform the user that only 8 first characters of the password will
  actually be used when typing more than 8 characters, closes:
  #355619.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* 
 
2
 * Copyright (c) 1998  Metro Link Incorporated
 
3
 *
 
4
 * Permission is hereby granted, free of charge, to any person obtaining a
 
5
 * copy of this software and associated documentation files (the "Software"),
 
6
 * to deal in the Software without restriction, including without limitation
 
7
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 
8
 * and/or sell copies of the Software, and to permit persons to whom the
 
9
 * Software is furnished to do so, subject to the following conditions:
 
10
 *
 
11
 * The above copyright notice and this permission notice shall be included in
 
12
 * all copies or substantial portions of the Software.
 
13
 *
 
14
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
15
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
16
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 
17
 * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 
18
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
 
19
 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 
20
 * SOFTWARE.
 
21
 *
 
22
 * Except as contained in this notice, the name of the Metro Link shall not be
 
23
 * used in advertising or otherwise to promote the sale, use or other dealings
 
24
 * in this Software without prior written authorization from Metro Link.
 
25
 *
 
26
 */
 
27
/* $XFree86: xc/programs/Xserver/hw/xfree86/input/magellan/magellan.h,v 1.4 2002/06/07 21:03:27 alanh Exp $ */
 
28
 
 
29
#ifndef _MAGELLAN_H_
 
30
#define _MAGELLAN_H_
 
31
 
 
32
/******************************************************************************
 
33
 *              Definitions
 
34
 *                                                                      structs, typedefs, #defines, enums
 
35
 *****************************************************************************/
 
36
#define MAGELLAN_PACKET_SIZE            256
 
37
#define MAGELLAN_RES                    200
 
38
/*
 
39
These numbers are difficult to pick because the user can change a
 
40
multiplier using the buttons which changes the output range. However, many
 
41
programs use this range to perform operations of their own and the XInput
 
42
extension expects these to be constant for a given device. Hence, I've picked
 
43
values that are slightly higher than any reported by my test device in default
 
44
(no multiplier) mode. The documentation says the range is roughly +/- 400 but
 
45
I have seen numbers close to 1800 using the "sensitivity" setting as set below.
 
46
Some programs (GLUT) may get upset if the device reports a value greater than 
 
47
XInput reported it could.
 
48
*/
 
49
#define MAGELLAN_MIN            -1800
 
50
#define MAGELLAN_MAX            +1800
 
51
 
 
52
#define MagellanAttention "\r\r"                /* get device's attention */
 
53
#define MagellanInitString "z\r"                /* switch in 3D mode */
 
54
#define MagellanShortBeep "b9\r"                /* a short beep */
 
55
#define MagellanMode "m3\r"                     /* translation and rotation data ON */
 
56
#define MagellanPeriod "pAA\r"                  /* transmit every 60 ms data */
 
57
#define MagellanNullRadius "nH\r"               /* null radius to value 8 */
 
58
#define MagellanZero "z\r"                      /* detect zero position */
 
59
#define MagellanSensitivity "q00\r"             /* no extra sensitivity */
 
60
#define MagellanVersion "vQ\r"                  /* get version string */
 
61
#define MagellanModeOff "\r\rm0\r"
 
62
 
 
63
typedef enum
 
64
{
 
65
        magellan_normal
 
66
}
 
67
MAGELLANState;
 
68
 
 
69
#define MagellanNibble(Value)       (Value&0x0F)
 
70
 
 
71
#define milisleep(ms) xf86usleep (ms * 1000)
 
72
 
 
73
typedef struct _MagellanPrivateRec
 
74
{
 
75
        XISBuffer *buffer;
 
76
        unsigned char packet_type;
 
77
        char packet[MAGELLAN_PACKET_SIZE];      /* packet being/just read */
 
78
        int packeti;                            /* index into packet */
 
79
        int expected_len;
 
80
        MAGELLANState lex_mode;
 
81
        int old_buttons;
 
82
}
 
83
MAGELLANPrivateRec, *MAGELLANPrivatePtr;
 
84
 
 
85
/******************************************************************************
 
86
 *              Declarations
 
87
 *****************************************************************************/
 
88
#ifdef XFreeLOADER
 
89
static MODULESETUPPROTO( MAGELLANSetupProc );
 
90
static void TearDownProc (pointer p);
 
91
#endif
 
92
static Bool DeviceControl (DeviceIntPtr, int);
 
93
static Bool DeviceOn (DeviceIntPtr);
 
94
static Bool DeviceOff (DeviceIntPtr);
 
95
static Bool DeviceClose (DeviceIntPtr);
 
96
static Bool DeviceInit (DeviceIntPtr);
 
97
static void ReadInput (LocalDevicePtr);
 
98
static int ControlProc (LocalDevicePtr, xDeviceCtl *);
 
99
static void CloseProc (LocalDevicePtr);
 
100
static int SwitchMode (ClientPtr, DeviceIntPtr, int);
 
101
static Bool ConvertProc (LocalDevicePtr, int, int, int, int, int, int, int, int, int *, int *);
 
102
static Bool QueryHardware (MAGELLANPrivatePtr);
 
103
static void NewPacket (MAGELLANPrivatePtr priv);
 
104
static Bool MAGELLANGetPacket (MAGELLANPrivatePtr priv);
 
105
 
 
106
static InputInfoPtr
 
107
MagellanPreInit(InputDriverPtr drv, IDevPtr dev, int flags);
 
108
 
 
109
#ifdef BELL_FEEDBACK_SUPPORT
 
110
static void MagellanBellCtrl( DeviceIntPtr, BellCtrl *);
 
111
static void MagellanBellSound(int percent, DeviceIntPtr dev, pointer ctrl, int
 
112
unknown);
 
113
#endif
 
114
/* 
 
115
 *    DO NOT PUT ANYTHING AFTER THIS ENDIF
 
116
 */
 
117
#endif
 
118
 
 
119