The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/sys/mouse.h

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * SPDX-License-Identifier: BSD-1-Clause
    3  *
    4  * Copyright (c) 1992, 1993 Erik Forsberg.
    5  * Copyright (c) 1996, 1997 Kazutaka YOKOTA
    6  * All rights reserved.
    7  *
    8  * Redistribution and use in source and binary forms, with or without
    9  * modification, are permitted provided that the following conditions
   10  * are met:
   11  * 1. Redistributions of source code must retain the above copyright
   12  *    notice, this list of conditions and the following disclaimer.
   13  *
   14  * THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY EXPRESS OR IMPLIED
   15  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   16  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
   17  * NO EVENT SHALL I BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
   18  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
   19  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
   20  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
   21  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
   22  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
   23  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   24  *
   25  * $FreeBSD: stable/12/sys/sys/mouse.h 344164 2019-02-15 20:45:12Z wulf $
   26  */
   27 
   28 #ifndef _SYS_MOUSE_H_
   29 #define _SYS_MOUSE_H_
   30 
   31 #include <sys/types.h>
   32 #include <sys/ioccom.h>
   33 
   34 /* ioctls */
   35 #define MOUSE_GETSTATUS         _IOR('M', 0, mousestatus_t)
   36 #define MOUSE_GETHWINFO         _IOR('M', 1, mousehw_t)
   37 #define MOUSE_GETMODE           _IOR('M', 2, mousemode_t)
   38 #define MOUSE_SETMODE           _IOW('M', 3, mousemode_t)
   39 #define MOUSE_GETLEVEL          _IOR('M', 4, int)
   40 #define MOUSE_SETLEVEL          _IOW('M', 5, int)
   41 #define MOUSE_READSTATE         _IOWR('M', 8, mousedata_t)
   42 #define MOUSE_READDATA          _IOWR('M', 9, mousedata_t)
   43 
   44 #ifdef notyet
   45 #define MOUSE_SETRESOLUTION     _IOW('M', 10, int)
   46 #define MOUSE_SETSCALING        _IOW('M', 11, int)
   47 #define MOUSE_SETRATE           _IOW('M', 12, int)
   48 #define MOUSE_GETHWID           _IOR('M', 13, int)
   49 #endif
   50 
   51 #define MOUSE_SYN_GETHWINFO     _IOR('M', 100, synapticshw_t)
   52 
   53 /* mouse status block */
   54 typedef struct mousestatus {
   55     int     flags;              /* state change flags */
   56     int     button;             /* button status */
   57     int     obutton;            /* previous button status */
   58     int     dx;                 /* x movement */
   59     int     dy;                 /* y movement */
   60     int     dz;                 /* z movement */
   61 } mousestatus_t;
   62 
   63 /* button */
   64 #define MOUSE_BUTTON1DOWN       0x0001  /* left */
   65 #define MOUSE_BUTTON2DOWN       0x0002  /* middle */
   66 #define MOUSE_BUTTON3DOWN       0x0004  /* right */
   67 #define MOUSE_BUTTON4DOWN       0x0008
   68 #define MOUSE_BUTTON5DOWN       0x0010
   69 #define MOUSE_BUTTON6DOWN       0x0020
   70 #define MOUSE_BUTTON7DOWN       0x0040
   71 #define MOUSE_BUTTON8DOWN       0x0080
   72 #define MOUSE_MAXBUTTON         31
   73 #define MOUSE_STDBUTTONS        0x0007          /* buttons 1-3 */
   74 #define MOUSE_EXTBUTTONS        0x7ffffff8      /* the others (28 of them!) */
   75 #define MOUSE_BUTTONS           (MOUSE_STDBUTTONS | MOUSE_EXTBUTTONS)
   76 
   77 /* flags */
   78 #define MOUSE_STDBUTTONSCHANGED MOUSE_STDBUTTONS
   79 #define MOUSE_EXTBUTTONSCHANGED MOUSE_EXTBUTTONS
   80 #define MOUSE_BUTTONSCHANGED    MOUSE_BUTTONS
   81 #define MOUSE_POSCHANGED        0x80000000
   82 
   83 typedef struct mousehw {
   84         int buttons;            /* -1 if unknown */
   85         int iftype;             /* MOUSE_IF_XXX */
   86         int type;               /* mouse/track ball/pad... */
   87         int model;              /* I/F dependent model ID: MOUSE_MODEL_XXX */
   88         int hwid;               /* I/F dependent hardware ID
   89                                  * for the PS/2 mouse, it will be PSM_XXX_ID
   90                                  */
   91 } mousehw_t;
   92 
   93 typedef struct synapticshw {
   94         int infoMajor;
   95         int infoMinor;
   96         int infoRot180;
   97         int infoPortrait;
   98         int infoSensor;
   99         int infoHardware;
  100         int infoNewAbs;
  101         int capPen;
  102         int infoSimplC;
  103         int infoGeometry;
  104         int capExtended;
  105         int capSleep;
  106         int capFourButtons;
  107         int capMultiFinger;
  108         int capPalmDetect;
  109         int capPassthrough;
  110         int capMiddle;
  111         int capLowPower;
  112         int capMultiFingerReport;
  113         int capBallistics;
  114         int nExtendedButtons;
  115         int nExtendedQueries;
  116         int capClickPad;
  117         int capDeluxeLEDs;
  118         int noAbsoluteFilter;
  119         int capReportsV;
  120         int capUniformClickPad;
  121         int capReportsMin;
  122         int capInterTouch;
  123         int capReportsMax;
  124         int capClearPad;
  125         int capAdvancedGestures;
  126         int multiFingerMode;
  127         int capCoveredPad;
  128         int verticalScroll;
  129         int horizontalScroll;
  130         int verticalWheel;
  131         int capEWmode;
  132         int minimumXCoord;
  133         int minimumYCoord;
  134         int maximumXCoord;
  135         int maximumYCoord;
  136         int infoXupmm;
  137         int infoYupmm;
  138         int forcePad;
  139         int topButtonPad;
  140 } synapticshw_t;
  141 
  142 /* iftype */
  143 #define MOUSE_IF_UNKNOWN        (-1)
  144 #define MOUSE_IF_SERIAL         0
  145 #define MOUSE_IF_BUS            1
  146 #define MOUSE_IF_INPORT         2
  147 #define MOUSE_IF_PS2            3
  148 #define MOUSE_IF_SYSMOUSE       4
  149 #define MOUSE_IF_USB            5
  150 
  151 /* type */
  152 #define MOUSE_UNKNOWN           (-1)    /* should be treated as a mouse */
  153 #define MOUSE_MOUSE             0
  154 #define MOUSE_TRACKBALL         1
  155 #define MOUSE_STICK             2
  156 #define MOUSE_PAD               3
  157 
  158 /* model */
  159 #define MOUSE_MODEL_UNKNOWN             (-1)
  160 #define MOUSE_MODEL_GENERIC             0
  161 #define MOUSE_MODEL_GLIDEPOINT          1
  162 #define MOUSE_MODEL_NETSCROLL           2
  163 #define MOUSE_MODEL_NET                 3
  164 #define MOUSE_MODEL_INTELLI             4
  165 #define MOUSE_MODEL_THINK               5
  166 #define MOUSE_MODEL_EASYSCROLL          6
  167 #define MOUSE_MODEL_MOUSEMANPLUS        7
  168 #define MOUSE_MODEL_KIDSPAD             8
  169 #define MOUSE_MODEL_VERSAPAD            9
  170 #define MOUSE_MODEL_EXPLORER            10
  171 #define MOUSE_MODEL_4D                  11
  172 #define MOUSE_MODEL_4DPLUS              12
  173 #define MOUSE_MODEL_SYNAPTICS           13
  174 #define MOUSE_MODEL_TRACKPOINT          14
  175 #define MOUSE_MODEL_ELANTECH            15
  176 
  177 typedef struct mousemode {
  178         int protocol;           /* MOUSE_PROTO_XXX */
  179         int rate;               /* report rate (per sec), -1 if unknown */
  180         int resolution;         /* MOUSE_RES_XXX, -1 if unknown */
  181         int accelfactor;        /* accelation factor (must be 1 or greater) */
  182         int level;              /* driver operation level */
  183         int packetsize;         /* the length of the data packet */
  184         unsigned char syncmask[2]; /* sync. data bits in the header byte */
  185 } mousemode_t;
  186 
  187 /* protocol */
  188 /*
  189  * Serial protocols:
  190  *   Microsoft, MouseSystems, Logitech, MM series, MouseMan, Hitachi Tablet,
  191  *   GlidePoint, IntelliMouse, Thinking Mouse, MouseRemote, Kidspad,
  192  *   VersaPad
  193  * Bus mouse protocols:
  194  *   bus, InPort
  195  * PS/2 mouse protocol:
  196  *   PS/2
  197  */
  198 #define MOUSE_PROTO_UNKNOWN     (-1)
  199 #define MOUSE_PROTO_MS          0       /* Microsoft Serial, 3 bytes */
  200 #define MOUSE_PROTO_MSC         1       /* Mouse Systems, 5 bytes */
  201 #define MOUSE_PROTO_LOGI        2       /* Logitech, 3 bytes */
  202 #define MOUSE_PROTO_MM          3       /* MM series, 3 bytes */
  203 #define MOUSE_PROTO_LOGIMOUSEMAN 4      /* Logitech MouseMan 3/4 bytes */
  204 #define MOUSE_PROTO_BUS         5       /* MS/Logitech bus mouse */
  205 #define MOUSE_PROTO_INPORT      6       /* MS/ATI InPort mouse */
  206 #define MOUSE_PROTO_PS2         7       /* PS/2 mouse, 3 bytes */
  207 #define MOUSE_PROTO_HITTAB      8       /* Hitachi Tablet 3 bytes */
  208 #define MOUSE_PROTO_GLIDEPOINT  9       /* ALPS GlidePoint, 3/4 bytes */
  209 #define MOUSE_PROTO_INTELLI     10      /* MS IntelliMouse, 4 bytes */
  210 #define MOUSE_PROTO_THINK       11      /* Kensington Thinking Mouse, 3/4 bytes */
  211 #define MOUSE_PROTO_SYSMOUSE    12      /* /dev/sysmouse */
  212 #define MOUSE_PROTO_X10MOUSEREM 13      /* X10 MouseRemote, 3 bytes */
  213 #define MOUSE_PROTO_KIDSPAD     14      /* Genius Kidspad */
  214 #define MOUSE_PROTO_VERSAPAD    15      /* Interlink VersaPad, 6 bytes */
  215 #define MOUSE_PROTO_JOGDIAL     16      /* Vaio's JogDial */
  216 #define MOUSE_PROTO_GTCO_DIGIPAD        17
  217 
  218 #define MOUSE_RES_UNKNOWN       (-1)
  219 #define MOUSE_RES_DEFAULT       0
  220 #define MOUSE_RES_LOW           (-2)
  221 #define MOUSE_RES_MEDIUMLOW     (-3)
  222 #define MOUSE_RES_MEDIUMHIGH    (-4)
  223 #define MOUSE_RES_HIGH          (-5)
  224 
  225 typedef struct mousedata {
  226         int len;                /* # of data in the buffer */
  227         int buf[16];            /* data buffer */
  228 } mousedata_t;
  229 
  230 /* Synaptics Touchpad */
  231 #define MOUSE_SYNAPTICS_PACKETSIZE      6       /* '3' works better */
  232 
  233 /* Elantech Touchpad */
  234 #define MOUSE_ELANTECH_PACKETSIZE       6
  235 
  236 /* Microsoft Serial mouse data packet */
  237 #define MOUSE_MSS_PACKETSIZE    3
  238 #define MOUSE_MSS_SYNCMASK      0x40
  239 #define MOUSE_MSS_SYNC          0x40
  240 #define MOUSE_MSS_BUTTONS       0x30
  241 #define MOUSE_MSS_BUTTON1DOWN   0x20    /* left */
  242 #define MOUSE_MSS_BUTTON2DOWN   0x00    /* no middle button */
  243 #define MOUSE_MSS_BUTTON3DOWN   0x10    /* right */
  244 
  245 /* Logitech MouseMan data packet (M+ protocol) */
  246 #define MOUSE_LMAN_BUTTON2DOWN  0x20    /* middle button, the 4th byte */
  247 
  248 /* ALPS GlidePoint extension (variant of M+ protocol) */
  249 #define MOUSE_ALPS_BUTTON2DOWN  0x20    /* middle button, the 4th byte */
  250 #define MOUSE_ALPS_TAP          0x10    /* `tapping' action, the 4th byte */
  251 
  252 /* Kinsington Thinking Mouse extension (variant of M+ protocol) */
  253 #define MOUSE_THINK_BUTTON2DOWN 0x20    /* lower-left button, the 4th byte */
  254 #define MOUSE_THINK_BUTTON4DOWN 0x10    /* lower-right button, the 4th byte */
  255 
  256 /* MS IntelliMouse (variant of MS Serial) */
  257 #define MOUSE_INTELLI_PACKETSIZE 4
  258 #define MOUSE_INTELLI_BUTTON2DOWN 0x10  /* middle button in the 4th byte */
  259 
  260 /* Mouse Systems Corp. mouse data packet */
  261 #define MOUSE_MSC_PACKETSIZE    5
  262 #define MOUSE_MSC_SYNCMASK      0xf8
  263 #define MOUSE_MSC_SYNC          0x80
  264 #define MOUSE_MSC_BUTTONS       0x07
  265 #define MOUSE_MSC_BUTTON1UP     0x04    /* left */
  266 #define MOUSE_MSC_BUTTON2UP     0x02    /* middle */
  267 #define MOUSE_MSC_BUTTON3UP     0x01    /* right */
  268 #define MOUSE_MSC_MAXBUTTON     3
  269 
  270 /* MM series mouse data packet */
  271 #define MOUSE_MM_PACKETSIZE     3
  272 #define MOUSE_MM_SYNCMASK       0xe0
  273 #define MOUSE_MM_SYNC           0x80
  274 #define MOUSE_MM_BUTTONS        0x07
  275 #define MOUSE_MM_BUTTON1DOWN    0x04    /* left */
  276 #define MOUSE_MM_BUTTON2DOWN    0x02    /* middle */
  277 #define MOUSE_MM_BUTTON3DOWN    0x01    /* right */
  278 #define MOUSE_MM_XPOSITIVE      0x10
  279 #define MOUSE_MM_YPOSITIVE      0x08
  280 
  281 /* PS/2 mouse data packet */
  282 #define MOUSE_PS2_PACKETSIZE    3
  283 #define MOUSE_PS2_SYNCMASK      0xc8
  284 #define MOUSE_PS2_SYNC          0x08
  285 #define MOUSE_PS2_BUTTONS       0x07    /* 0x03 for 2 button mouse */
  286 #define MOUSE_PS2_BUTTON1DOWN   0x01    /* left */
  287 #define MOUSE_PS2_BUTTON2DOWN   0x04    /* middle */
  288 #define MOUSE_PS2_BUTTON3DOWN   0x02    /* right */
  289 #define MOUSE_PS2_TAP           MOUSE_PS2_SYNC /* GlidePoint (PS/2) `tapping'
  290                                                 * Yes! this is the same bit
  291                                                 * as SYNC!
  292                                                 */
  293 
  294 #define MOUSE_PS2_XNEG          0x10
  295 #define MOUSE_PS2_YNEG          0x20
  296 #define MOUSE_PS2_XOVERFLOW     0x40
  297 #define MOUSE_PS2_YOVERFLOW     0x80
  298 
  299 /* Logitech MouseMan+ (PS/2) data packet (PS/2++ protocol) */
  300 #define MOUSE_PS2PLUS_SYNCMASK  0x48
  301 #define MOUSE_PS2PLUS_SYNC      0x48
  302 #define MOUSE_PS2PLUS_ZNEG      0x08    /* sign bit */
  303 #define MOUSE_PS2PLUS_BUTTON4DOWN 0x10  /* 4th button on MouseMan+ */
  304 #define MOUSE_PS2PLUS_BUTTON5DOWN 0x20
  305 
  306 /* IBM ScrollPoint (PS/2) also uses PS/2++ protocol */
  307 #define MOUSE_SPOINT_ZNEG       0x80    /* sign bits */
  308 #define MOUSE_SPOINT_WNEG       0x08
  309 
  310 /* MS IntelliMouse (PS/2) data packet */
  311 #define MOUSE_PS2INTELLI_PACKETSIZE 4
  312 /* some compatible mice have additional buttons */
  313 #define MOUSE_PS2INTELLI_BUTTON4DOWN 0x40
  314 #define MOUSE_PS2INTELLI_BUTTON5DOWN 0x80
  315 
  316 /* MS IntelliMouse Explorer (PS/2) data packet (variation of IntelliMouse) */
  317 #define MOUSE_EXPLORER_ZNEG     0x08    /* sign bit */
  318 /* IntelliMouse Explorer has additional button data in the fourth byte */
  319 #define MOUSE_EXPLORER_BUTTON4DOWN 0x10
  320 #define MOUSE_EXPLORER_BUTTON5DOWN 0x20
  321 
  322 /* Interlink VersaPad (serial I/F) data packet */
  323 #define MOUSE_VERSA_PACKETSIZE  6
  324 #define MOUSE_VERSA_IN_USE      0x04
  325 #define MOUSE_VERSA_SYNCMASK    0xc3
  326 #define MOUSE_VERSA_SYNC        0xc0
  327 #define MOUSE_VERSA_BUTTONS     0x30
  328 #define MOUSE_VERSA_BUTTON1DOWN 0x20    /* left */
  329 #define MOUSE_VERSA_BUTTON2DOWN 0x00    /* middle */
  330 #define MOUSE_VERSA_BUTTON3DOWN 0x10    /* right */
  331 #define MOUSE_VERSA_TAP         0x08
  332 
  333 /* Interlink VersaPad (PS/2 I/F) data packet */
  334 #define MOUSE_PS2VERSA_PACKETSIZE       6
  335 #define MOUSE_PS2VERSA_IN_USE           0x10
  336 #define MOUSE_PS2VERSA_SYNCMASK         0xe8
  337 #define MOUSE_PS2VERSA_SYNC             0xc8
  338 #define MOUSE_PS2VERSA_BUTTONS          0x05
  339 #define MOUSE_PS2VERSA_BUTTON1DOWN      0x04    /* left */
  340 #define MOUSE_PS2VERSA_BUTTON2DOWN      0x00    /* middle */
  341 #define MOUSE_PS2VERSA_BUTTON3DOWN      0x01    /* right */
  342 #define MOUSE_PS2VERSA_TAP              0x02
  343 
  344 /* A4 Tech 4D Mouse (PS/2) data packet */
  345 #define MOUSE_4D_PACKETSIZE             3
  346 #define MOUSE_4D_WHEELBITS              0xf0
  347 
  348 /* A4 Tech 4D+ Mouse (PS/2) data packet */
  349 #define MOUSE_4DPLUS_PACKETSIZE         3
  350 #define MOUSE_4DPLUS_ZNEG               0x04    /* sign bit */
  351 #define MOUSE_4DPLUS_BUTTON4DOWN        0x08
  352 
  353 /* sysmouse extended data packet */
  354 /*
  355  * /dev/sysmouse sends data in two formats, depending on the protocol
  356  * level.  At the level 0, format is exactly the same as MousSystems'
  357  * five byte packet.  At the level 1, the first five bytes are the same
  358  * as at the level 0.  There are additional three bytes which shows
  359  * `dz' and the states of additional buttons.  `dz' is expressed as the
  360  * sum of the byte 5 and 6 which contain signed seven bit values.
  361  * The states of the button 4 though 10 are in the bit 0 though 6 in
  362  * the byte 7 respectively: 1 indicates the button is up.
  363  */
  364 #define MOUSE_SYS_PACKETSIZE    8
  365 #define MOUSE_SYS_SYNCMASK      0xf8
  366 #define MOUSE_SYS_SYNC          0x80
  367 #define MOUSE_SYS_BUTTON1UP     0x04    /* left, 1st byte */
  368 #define MOUSE_SYS_BUTTON2UP     0x02    /* middle, 1st byte */
  369 #define MOUSE_SYS_BUTTON3UP     0x01    /* right, 1st byte */
  370 #define MOUSE_SYS_BUTTON4UP     0x0001  /* 7th byte */
  371 #define MOUSE_SYS_BUTTON5UP     0x0002
  372 #define MOUSE_SYS_BUTTON6UP     0x0004
  373 #define MOUSE_SYS_BUTTON7UP     0x0008
  374 #define MOUSE_SYS_BUTTON8UP     0x0010
  375 #define MOUSE_SYS_BUTTON9UP     0x0020
  376 #define MOUSE_SYS_BUTTON10UP    0x0040
  377 #define MOUSE_SYS_MAXBUTTON     10
  378 #define MOUSE_SYS_STDBUTTONS    0x07
  379 #define MOUSE_SYS_EXTBUTTONS    0x7f    /* the others */
  380 
  381 /* Mouse remote socket */
  382 #define _PATH_MOUSEREMOTE       "/var/run/MouseRemote"
  383 
  384 #endif /* _SYS_MOUSE_H_ */

Cache object: d92071821660abc8e5659a978ba57248


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.