2
* $RCSId: xc/programs/Xserver/hw/kdrive/linux/bus.c,v 1.2 2001/06/29 14:00:41 keithp Exp $
4
* Copyright � 2000 Keith Packard
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 name of Keith Packard not be used in
11
* advertising or publicity pertaining to distribution of the software without
12
* specific, written prior permission. Keith Packard makes no
13
* representations about the suitability of this software for any purpose. It
14
* is provided "as is" without express or implied warranty.
16
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
17
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
18
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
19
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
20
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
21
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
22
* PERFORMANCE OF THIS SOFTWARE.
26
#include <kdrive-config.h>
30
#include <X11/Xproto.h>
31
#include <X11/Xpoll.h>
33
#include "scrnintstr.h"
36
/* /dev/adbmouse is a busmouse */
39
BusRead (int adbPort, void *closure)
46
n = read (adbPort, buf, 3);
49
flags = KD_MOUSE_DELTA;
52
if ((buf[0] & 4) == 0)
54
if ((buf[0] & 2) == 0)
56
if ((buf[0] & 1) == 0)
58
KdEnqueueMouseEvent (kdMouseInfo, flags, dx, dy);
67
#define NUM_BUS_NAMES (sizeof (BusNames) / sizeof (BusNames[0]))
79
BusInputType = KdAllocInputType ();
81
for (i = 0; i < NUM_BUS_NAMES; i++)
83
busPort = open (BusNames[i], 0);
85
KdRegisterFd (BusInputType, busPort, BusRead, 0);
95
KdUnregisterFds (BusInputType, TRUE);
98
KdMouseFuncs BusMouseFuncs = {