mouse.h revision 19753
12606Sdfr/*-
22606Sdfr * Copyright (c) 1992, 1993 Erik Forsberg.
32606Sdfr * All rights reserved.
42606Sdfr *
52606Sdfr * Redistribution and use in source and binary forms, with or without
62606Sdfr * modification, are permitted provided that the following conditions
72606Sdfr * are met:
82606Sdfr * 1. Redistributions of source code must retain the above copyright
92606Sdfr *    notice, this list of conditions and the following disclaimer.
102606Sdfr *
112606Sdfr * THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY EXPRESS OR IMPLIED
122606Sdfr * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
132606Sdfr * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
142606Sdfr * NO EVENT SHALL I BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
152606Sdfr * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
162606Sdfr * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
172606Sdfr * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
182606Sdfr * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
192606Sdfr * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
202606Sdfr * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
212606Sdfr *
2219753Ssos *	$Id: mouse.h,v 1.1 1994/09/09 11:27:31 dfr Exp $
232606Sdfr */
242606Sdfr
2519753Ssos#ifndef _MACHINE_MOUSE_H_
2619753Ssos#define _MACHINE_MOUSE_H_
2719753Ssos
2819753Ssos#include <sys/types.h>
2919753Ssos#include <sys/ioccom.h>
3019753Ssos
3119753Ssos/* NOTE: MOUSEIOC and MOUSEIOCREAD are now obsolete, but will stay
3219753Ssos   for compatibility reasons. But, remember, the MOUSEIOCREAD ioctl
3319753Ssos   command doesn't work and never worked before.  Some day we shall
3419753Ssos   get rid of these... */
3519753Ssos
3619753Ssos#define MOUSEIOC		('M'<<8)
3719753Ssos#define MOUSEIOCREAD		(MOUSEIOC|60)
3819753Ssos
3919753Ssos#define MOUSE_GETSTATE		_IOR('M',0,mouseinfo_t)
4019753Ssos#define MOUSE_GETINFO		_IOR('M',1,mousehw_t)
4119753Ssos#define MOUSE_GETMODE		_IOR('M',2,mousemode_t)
4219753Ssos#define MOUSE_SETMODE		_IOW('M',3,mousemode_t)
4319753Ssos
4419753Ssostypedef struct mouseinfo {
452606Sdfr	unsigned char status;
4619753Ssos	char xmotion;
4719753Ssos	char ymotion;
4819753Ssos} mouseinfo_t;
4919753Ssos/* status */
502606Sdfr#define BUTSTATMASK	0x07	/* Any mouse button down if any bit set */
512606Sdfr#define BUTCHNGMASK	0x38	/* Any mouse button changed if any bit set */
522606Sdfr#define BUT3STAT	0x01	/* Button 3 down if set */
532606Sdfr#define BUT2STAT	0x02	/* Button 2 down if set */
542606Sdfr#define BUT1STAT	0x04	/* Button 1 down if set */
552606Sdfr#define BUT3CHNG	0x08	/* Button 3 changed if set */
562606Sdfr#define BUT2CHNG	0x10	/* Button 2 changed if set */
572606Sdfr#define BUT1CHNG	0x20	/* Button 1 changed if set */
582606Sdfr#define MOVEMENT	0x40	/* Mouse movement detected */
592606Sdfr
6019753Ssostypedef struct mousehw {
6119753Ssos	int buttons;
6219753Ssos	int iftype;		/* MOUSE_IF_XXX */
6319753Ssos	int type;		/* mouse/track ball/pad... */
6419753Ssos	int hwid;		/* I/F dependent hardware ID
6519753Ssos				   for the PS/2 mouse, it will be PSM_XXX_ID */
6619753Ssos} mousehw_t;
6719753Ssos/* iftype */
6819753Ssos#define MOUSE_IF_SERIAL		0
6919753Ssos#define MOUSE_IF_BUS		1
7019753Ssos#define MOUSE_IF_INPORT		2
7119753Ssos#define MOUSE_IF_PS2		3
7219753Ssos/* type */
7319753Ssos#define MOUSE_UNKNOWN		(-1)	/* should be treated as a mouse */
7419753Ssos#define MOUSE_MOUSE		0
7519753Ssos#define MOUSE_TRACKBALL		1
7619753Ssos#define MOUSE_STICK		2
7719753Ssos#define MOUSE_PAD		3
782606Sdfr
7919753Ssostypedef struct mousemode {
8019753Ssos	int protocol;		/* MOUSE_PROTO_XXX */
8119753Ssos	int rate;		/* report rate (per sec), -1 if unknown */
8219753Ssos	int resolution;		/* ppi, -1 if unknown */
8319753Ssos	int accelfactor;	/* accelation factor (must be 1 or greater) */
8419753Ssos} mousemode_t;
8519753Ssos/* protocol */
8619753Ssos#define MOUSE_PROTO_MS		0	/* Microsoft Serial, 3 bytes */
8719753Ssos#define MOUSE_PROTO_MSC		1	/* Mouse Systems, 5 bytes */
8819753Ssos#define MOUSE_PROTO_LOGI	2	/* Logitech, 3 bytes */
8919753Ssos#define MOUSE_PROTO_MM		3	/* MM series, 3 bytes */
9019753Ssos#define MOUSE_PROTO_LOGIMOUSEMAN 4	/* Logitech MouseMan 3/4 bytes */
9119753Ssos#define MOUSE_PROTO_BUS		5	/* MS/Logitech bus mouse */
9219753Ssos#define MOUSE_PROTO_INPORT	6	/* MS/ATI inport mouse */
9319753Ssos#define MOUSE_PROTO_PS2		7	/* PS/2 mouse, 3 bytes */
9419753Ssos
9519753Ssos/* Microsoft Serial mouse data packet */
9619753Ssos#define MOUSE_MSS_PACKETSIZE	3
9719753Ssos#define MOUSE_MSS_SYNCMASK	0x40
9819753Ssos#define MOUSE_MSS_SYNC		0x40
9919753Ssos#define MOUSE_MSS_BUTTONS	0x30
10019753Ssos#define MOUSE_MSS_BUTTON1DOWN	0x20	/* left */
10119753Ssos#define MOUSE_MSS_BUTTON2DOWN	0x00	/* no middle button */
10219753Ssos#define MOUSE_MSS_BUTTON3DOWN	0x10	/* right */
10319753Ssos
10419753Ssos/* Mouse Systems Corp. mouse data packet */
10519753Ssos#define MOUSE_MSC_PACKETSIZE	5
10619753Ssos#define MOUSE_MSC_SYNCMASK	0xf8
10719753Ssos#define MOUSE_MSC_SYNC		0x80
10819753Ssos#define MOUSE_MSC_BUTTONS	0x07
10919753Ssos#define MOUSE_MSC_BUTTON1UP	0x04	/* left */
11019753Ssos#define MOUSE_MSC_BUTTON2UP	0x02	/* middle */
11119753Ssos#define MOUSE_MSC_BUTTON3UP	0x01	/* right */
11219753Ssos
11319753Ssos/* PS/2 mouse data packet */
11419753Ssos#define MOUSE_PS2_PACKETSIZE	3
11519753Ssos#define MOUSE_PS2_SYNCMASK	0x08	/* 0x0c for 2 button mouse */
11619753Ssos#define MOUSE_PS2_SYNC		0x08	/* 0x0c for 2 button mouse */
11719753Ssos#define MOUSE_PS2_BUTTONS	0x07	/* 0x03 for 2 button mouse */
11819753Ssos#define MOUSE_PS2_BUTTON1DOWN	0x01	/* left */
11919753Ssos#define MOUSE_PS2_BUTTON2DOWN	0x04	/* middle */
12019753Ssos#define MOUSE_PS2_BUTTON3DOWN	0x02	/* right */
12119753Ssos#define MOUSE_PS2_XNEG		0x10
12219753Ssos#define MOUSE_PS2_YNEG		0x20
12319753Ssos#define MOUSE_PS2_XOVERFLOW	0x40
12419753Ssos#define MOUSE_PS2_YOVERFLOW	0x80
12519753Ssos
12619753Ssos#endif /* _MACHINE_MOUSE_H_ */
127