/* $NetBSD: mouse.h,v 1.1 2001/10/29 23:23:42 augustss Exp $ */
/*-
* Copyright (c) 1992, 1993 Erik Forsberg.
* Copyright (c) 1996, 1997 Kazutaka YOKOTA
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
* NO EVENT SHALL I BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD: src/sys/sys/mouse.h,v 1.18 2001/07/05 08:52:40 dd Exp $
*/
/* mouse status block */
typedef struct mousestatus {
int flags; /* state change flags */
int button; /* button status */
int obutton; /* previous button status */
int dx; /* x movement */
int dy; /* y movement */
int dz; /* z movement */
} mousestatus_t;
typedef struct mousehw {
int buttons; /* -1 if unknown */
int iftype; /* MOUSE_IF_XXX */
int type; /* mouse/track ball/pad... */
int model; /* I/F dependent model ID: MOUSE_MODEL_XXX */
int hwid; /* I/F dependent hardware ID
* for the PS/2 mouse, it will be PSM_XXX_ID
*/
} mousehw_t;
typedef struct mousemode {
int protocol; /* MOUSE_PROTO_XXX */
int rate; /* report rate (per sec), -1 if unknown */
int resolution; /* MOUSE_RES_XXX, -1 if unknown */
int accelfactor; /* accelation factor (must be 1 or greater) */
int level; /* driver operation level */
int packetsize; /* the length of the data packet */
unsigned char syncmask[2]; /* sync. data bits in the header byte */
} mousemode_t;
/* Microsoft Serial mouse data packet */
#define MOUSE_MSS_PACKETSIZE 3
#define MOUSE_MSS_SYNCMASK 0x40
#define MOUSE_MSS_SYNC 0x40
#define MOUSE_MSS_BUTTONS 0x30
#define MOUSE_MSS_BUTTON1DOWN 0x20 /* left */
#define MOUSE_MSS_BUTTON2DOWN 0x00 /* no middle button */
#define MOUSE_MSS_BUTTON3DOWN 0x10 /* right */
/* Logitech MouseMan data packet (M+ protocol) */
#define MOUSE_LMAN_BUTTON2DOWN 0x20 /* middle button, the 4th byte */
/* ALPS GlidePoint extension (variant of M+ protocol) */
#define MOUSE_ALPS_BUTTON2DOWN 0x20 /* middle button, the 4th byte */
#define MOUSE_ALPS_TAP 0x10 /* `tapping' action, the 4th byte */
/* Kinsington Thinking Mouse extension (variant of M+ protocol) */
#define MOUSE_THINK_BUTTON2DOWN 0x20 /* lower-left button, the 4th byte */
#define MOUSE_THINK_BUTTON4DOWN 0x10 /* lower-right button, the 4th byte */
/* MS IntelliMouse (variant of MS Serial) */
#define MOUSE_INTELLI_PACKETSIZE 4
#define MOUSE_INTELLI_BUTTON2DOWN 0x10 /* middle button in the 4th byte */
/* IBM ScrollPoint (PS/2) also uses PS/2++ protocol */
#define MOUSE_SPOINT_ZNEG 0x80 /* sign bits */
#define MOUSE_SPOINT_WNEG 0x08
/* MS IntelliMouse (PS/2) data packet */
#define MOUSE_PS2INTELLI_PACKETSIZE 4
/* some compatible mice have additional buttons */
#define MOUSE_PS2INTELLI_BUTTON4DOWN 0x40
#define MOUSE_PS2INTELLI_BUTTON5DOWN 0x80
/* MS IntelliMouse Explorer (PS/2) data packet (variation of IntelliMouse) */
#define MOUSE_EXPLORER_ZNEG 0x08 /* sign bit */
/* IntelliMouse Explorer has additional button data in the fourth byte */
#define MOUSE_EXPLORER_BUTTON4DOWN 0x10
#define MOUSE_EXPLORER_BUTTON5DOWN 0x20
/* sysmouse extended data packet */
/*
* /dev/sysmouse sends data in two formats, depending on the protocol
* level. At the level 0, format is exactly the same as MousSystems'
* five byte packet. At the level 1, the first five bytes are the same
* as at the level 0. There are additional three bytes which shows
* `dz' and the states of additional buttons. `dz' is expressed as the
* sum of the byte 5 and 6 which contain signed seven bit values.
* The states of the button 4 though 10 are in the bit 0 though 6 in
* the byte 7 respectively: 1 indicates the button is up.
*/
#define MOUSE_SYS_PACKETSIZE 8
#define MOUSE_SYS_SYNCMASK 0xf8
#define MOUSE_SYS_SYNC 0x80
#define MOUSE_SYS_BUTTON1UP 0x04 /* left, 1st byte */
#define MOUSE_SYS_BUTTON2UP 0x02 /* middle, 1st byte */
#define MOUSE_SYS_BUTTON3UP 0x01 /* right, 1st byte */
#define MOUSE_SYS_BUTTON4UP 0x0001 /* 7th byte */
#define MOUSE_SYS_BUTTON5UP 0x0002
#define MOUSE_SYS_BUTTON6UP 0x0004
#define MOUSE_SYS_BUTTON7UP 0x0008
#define MOUSE_SYS_BUTTON8UP 0x0010
#define MOUSE_SYS_BUTTON9UP 0x0020
#define MOUSE_SYS_BUTTON10UP 0x0040
#define MOUSE_SYS_MAXBUTTON 10
#define MOUSE_SYS_STDBUTTONS 0x07
#define MOUSE_SYS_EXTBUTTONS 0x7f /* the others */