3 * Copyright (c) 1999-2003 by The XFree86 Project, Inc.
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
19 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21 * OTHER DEALINGS IN THE SOFTWARE.
23 * Except as contained in this notice, the name of the copyright holder(s)
24 * and author(s) shall not be used in advertising or otherwise to promote
25 * the sale, use or other dealings in this Software without prior written
26 * authorization from the copyright holder(s) and author(s).
29 #ifdef HAVE_XORG_CONFIG_H
30 #include <xorg-config.h>
36 #include "xf86_OSlib.h"
37 #include "xf86Xinput.h"
38 #include "xf86OSmouse.h"
40 #include "mipointer.h"
42 #include <dev/wscons/wsconsio.h>
44 #ifdef USBMOUSE_SUPPORT
45 #ifdef HAS_LIB_USB_HID
51 #include <dev/usb/usb.h>
52 #ifdef USB_GET_REPORT_ID
56 #define HUP_GENERIC_DESKTOP 0x0001
57 #define HUP_BUTTON 0x0009
62 #define HUG_WHEEL 0x0038
64 #define HID_USAGE2(p,u) (((p) << 16) | u)
66 /* The UMS mices have middle button as number 3 */
67 #define UMS_BUT(i) ((i) == 0 ? 2 : (i) == 1 ? 0 : (i) == 2 ? 1 : (i))
68 #endif /* USBMOUSE_SUPPORT */
70 #ifdef USBMOUSE_SUPPORT
71 static void usbSigioReadInput (int fd
, void *closure
);
74 #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
75 /* These are for FreeBSD and DragonFly */
76 #define DEFAULT_MOUSE_DEV "/dev/mouse"
77 #define DEFAULT_SYSMOUSE_DEV "/dev/sysmouse"
78 #define DEFAULT_PS2_DEV "/dev/psm0"
80 static const char *mouseDevs
[] = {
86 #elif defined(__OpenBSD__) && defined(WSCONS_SUPPORT)
87 /* Only wsmouse mices are autoconfigured for now on OpenBSD */
88 #define DEFAULT_WSMOUSE_DEV "/dev/wsmouse"
89 #define DEFAULT_WSMOUSE0_DEV "/dev/wsmouse0"
91 static const char *mouseDevs
[] = {
99 SupportedInterfaces(void)
101 #if defined(__NetBSD__)
102 return MSE_SERIAL
| MSE_BUS
| MSE_PS2
| MSE_AUTO
;
103 #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
104 return MSE_SERIAL
| MSE_BUS
| MSE_PS2
| MSE_AUTO
| MSE_MISC
;
106 return MSE_SERIAL
| MSE_BUS
| MSE_PS2
| MSE_XPS2
| MSE_AUTO
;
110 /* Names of protocols that are handled internally here. */
111 static const char *internalNames
[] = {
112 #if defined(WSCONS_SUPPORT)
115 #if defined(USBMOUSE_SUPPORT)
122 * Names of MSC_MISC protocols that the OS supports. These are decoded by
123 * main "mouse" driver.
125 static const char *miscNames
[] = {
126 #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
135 return internalNames
;
139 CheckProtocol(const char *protocol
)
143 for (i
= 0; internalNames
[i
]; i
++)
144 if (xf86NameCmp(protocol
, internalNames
[i
]) == 0)
146 for (i
= 0; miscNames
[i
]; i
++)
147 if (xf86NameCmp(protocol
, miscNames
[i
]) == 0)
153 DefaultProtocol(void)
155 #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
157 #elif defined(__OpenBSD__) && defined(WSCONS_SUPPORT)
164 #if (defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)) && defined(MOUSE_PROTO_SYSMOUSE)
169 { MOUSE_PROTO_MS
, "Microsoft" },
170 { MOUSE_PROTO_MSC
, "MouseSystems" },
171 { MOUSE_PROTO_LOGI
, "Logitech" },
172 { MOUSE_PROTO_MM
, "MMSeries" },
173 { MOUSE_PROTO_LOGIMOUSEMAN
, "MouseMan" },
174 { MOUSE_PROTO_BUS
, "BusMouse" },
175 { MOUSE_PROTO_INPORT
, "BusMouse" },
176 { MOUSE_PROTO_PS2
, "PS/2" },
177 { MOUSE_PROTO_HITTAB
, "MMHitTab" },
178 { MOUSE_PROTO_GLIDEPOINT
, "GlidePoint" },
179 { MOUSE_PROTO_INTELLI
, "Intellimouse" },
180 { MOUSE_PROTO_THINK
, "ThinkingMouse" },
181 { MOUSE_PROTO_SYSMOUSE
, "SysMouse" }
185 SetupAuto(InputInfoPtr pInfo
, int *protoPara
)
194 /* set the driver operation level, if applicable */
196 ioctl(pInfo
->fd
, MOUSE_SETLEVEL
, &i
);
198 /* interrogate the driver and get some intelligence on the device. */
199 hw
.iftype
= MOUSE_IF_UNKNOWN
;
200 hw
.model
= MOUSE_MODEL_GENERIC
;
201 ioctl(pInfo
->fd
, MOUSE_GETHWINFO
, &hw
);
202 xf86MsgVerb(X_INFO
, 3, "%s: SetupAuto: hw.iftype is %d, hw.model is %d\n",
203 pInfo
->name
, hw
.iftype
, hw
.model
);
204 if (ioctl(pInfo
->fd
, MOUSE_GETMODE
, &mode
) == 0) {
205 for (i
= 0; i
< sizeof(devproto
)/sizeof(devproto
[0]); ++i
) {
206 if (mode
.protocol
== devproto
[i
].dproto
) {
207 /* override some parameters */
209 protoPara
[4] = mode
.packetsize
;
210 protoPara
[0] = mode
.syncmask
[0];
211 protoPara
[1] = mode
.syncmask
[1];
213 xf86MsgVerb(X_INFO
, 3, "%s: SetupAuto: protocol is %s\n",
214 pInfo
->name
, devproto
[i
].name
);
215 return devproto
[i
].name
;
223 SetSysMouseRes(InputInfoPtr pInfo
, const char *protocol
, int rate
, int res
)
228 pMse
= pInfo
->private;
230 mode
.rate
= rate
> 0 ? rate
: -1;
231 mode
.resolution
= res
> 0 ? res
: -1;
232 mode
.accelfactor
= -1;
233 #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
234 if (pMse
->autoProbe
||
235 (protocol
&& xf86NameCmp(protocol
, "SysMouse") == 0)) {
237 * As the FreeBSD sysmouse driver defaults to protocol level 0
238 * everytime it is opened we enforce protocol level 1 again at
247 ioctl(pInfo
->fd
, MOUSE_SETMODE
, &mode
);
251 #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
253 #define MOUSED_PID_FILE "/var/run/moused.pid"
256 * Try to check if moused is running. DEFAULT_SYSMOUSE_DEV is useless without
257 * it. There doesn't seem to be a better way of checking.
265 if ((f
= fopen(MOUSED_PID_FILE
, "r")) != NULL
) {
266 if (fscanf(f
, "%u", &pid
) == 1 && pid
> 0) {
267 if (kill(pid
, 0) == 0) {
278 FindDevice(InputInfoPtr pInfo
, const char *protocol
, int flags
)
281 const char **pdev
, *dev
= NULL
;
282 Bool devMouse
= FALSE
;
283 struct stat devMouseStat
;
286 for (pdev
= mouseDevs
; *pdev
; pdev
++) {
287 SYSCALL (fd
= open(*pdev
, O_RDWR
| O_NONBLOCK
));
290 ErrorF("Cannot open %s (%s)\n", *pdev
, strerror(errno
));
294 * /dev/mouse is held until checks for matches with other devices
295 * are done. This is so that when it points to /dev/sysmouse,
296 * the test for whether /dev/sysmouse is usable can be made.
298 if (!strcmp(*pdev
, DEFAULT_MOUSE_DEV
)) {
299 if (fstat(fd
, &devMouseStat
) == 0)
303 } else if (!strcmp(*pdev
, DEFAULT_SYSMOUSE_DEV
)) {
304 /* Check if /dev/mouse is the same as /dev/sysmouse. */
305 if (devMouse
&& fstat(fd
, &sb
) == 0 &&
306 devMouseStat
.st_dev
== sb
.st_dev
&&
307 devMouseStat
.st_ino
== sb
.st_ino
) {
308 /* If the same, use /dev/sysmouse. */
316 ErrorF("moused isn't running\n");
329 dev
= DEFAULT_MOUSE_DEV
;
332 /* Set the Device option. */
333 pInfo
->conf_idev
->commonOptions
=
334 xf86AddNewOption(pInfo
->conf_idev
->commonOptions
, "Device", dev
);
335 xf86Msg(X_INFO
, "%s: Setting Device option to \"%s\"\n",
343 #if defined(__OpenBSD__) && defined(WSCONS_SUPPORT)
345 /* Only support wsmouse configuration for now */
347 SetupAuto(InputInfoPtr pInfo
, int *protoPara
)
350 xf86MsgVerb(X_INFO
, 3, "%s: SetupAuto: protocol is %s\n",
351 pInfo
->name
, "wsmouse");
356 SetMouseRes(InputInfoPtr pInfo
, const char *protocol
, int rate
, int res
)
359 xf86MsgVerb(X_INFO
, 3, "%s: SetMouseRes: protocol %s rate %d res %d\n",
360 pInfo
->name
, protocol
, rate
, res
);
364 FindDevice(InputInfoPtr pInfo
, const char *protocol
, int flags
)
369 for (pdev
= mouseDevs
; *pdev
; pdev
++) {
370 SYSCALL(fd
= open(*pdev
, O_RDWR
| O_NONBLOCK
));
372 /* Set the Device option. */
373 pInfo
->conf_idev
->commonOptions
=
374 xf86AddNewOption(pInfo
->conf_idev
->commonOptions
,
376 xf86Msg(X_INFO
, "%s: found Device \"%s\"\n",
384 #endif /* __OpenBSD__ && WSCONS_SUPPORT */
386 #ifdef WSCONS_SUPPORT
390 wsconsReadInput(InputInfoPtr pInfo
)
393 static struct wscons_event eventList
[NUMEVENTS
];
395 struct wscons_event
*event
= eventList
;
398 pMse
= pInfo
->private;
400 XisbBlockDuration(pMse
->buffer
, -1);
401 pBuf
= (unsigned char *)eventList
;
403 while (n
< sizeof(eventList
) && (c
= XisbRead(pMse
->buffer
)) >= 0) {
404 pBuf
[n
++] = (unsigned char)c
;
410 n
/= sizeof(struct wscons_event
);
412 int buttons
= pMse
->lastButtons
;
413 int dx
= 0, dy
= 0, dz
= 0, dw
= 0;
414 switch (event
->type
) {
415 case WSCONS_EVENT_MOUSE_UP
:
416 #define BUTBIT (1 << (event->value <= 2 ? 2 - event->value : event->value))
419 case WSCONS_EVENT_MOUSE_DOWN
:
422 case WSCONS_EVENT_MOUSE_DELTA_X
:
425 case WSCONS_EVENT_MOUSE_DELTA_Y
:
428 #ifdef WSCONS_EVENT_MOUSE_DELTA_Z
429 case WSCONS_EVENT_MOUSE_DELTA_Z
:
434 xf86Msg(X_WARNING
, "%s: bad wsmouse event type=%d\n", pInfo
->name
,
440 pMse
->PostEvent(pInfo
, buttons
, dx
, dy
, dz
, dw
);
447 /* This function is called when the protocol is "wsmouse". */
449 wsconsPreInit(InputInfoPtr pInfo
, const char *protocol
, int flags
)
451 MouseDevPtr pMse
= pInfo
->private;
453 pMse
->protocol
= protocol
;
454 xf86Msg(X_CONFIG
, "%s: Protocol: %s\n", pInfo
->name
, protocol
);
456 /* Collect the options, and process the common options. */
457 xf86CollectInputOptions(pInfo
, NULL
, NULL
);
458 xf86ProcessCommonOptions(pInfo
, pInfo
->options
);
460 /* Check if the device can be opened. */
461 pInfo
->fd
= xf86OpenSerial(pInfo
->options
);
462 if (pInfo
->fd
== -1) {
463 if (xf86GetAllowMouseOpenFail())
464 xf86Msg(X_WARNING
, "%s: cannot open input device\n", pInfo
->name
);
466 xf86Msg(X_ERROR
, "%s: cannot open input device\n", pInfo
->name
);
471 xf86CloseSerial(pInfo
->fd
);
474 /* Process common mouse options (like Emulate3Buttons, etc). */
475 pMse
->CommonOptions(pInfo
);
477 /* Setup the local input proc. */
478 pInfo
->read_input
= wsconsReadInput
;
479 pMse
->xisbscale
= sizeof(struct wscons_event
);
481 pInfo
->flags
|= XI86_CONFIGURED
;
486 #if defined(USBMOUSE_SUPPORT)
488 typedef struct _UsbMseRec
{
491 hid_item_t loc_x
; /* x locator item */
492 hid_item_t loc_y
; /* y locator item */
493 hid_item_t loc_z
; /* z (wheel) locator item */
494 hid_item_t loc_btn
[MSE_MAXBUTTONS
]; /* buttons locator items */
495 unsigned char *buffer
;
496 } UsbMseRec
, *UsbMsePtr
;
499 usbMouseProc(DeviceIntPtr pPointer
, int what
)
504 unsigned char map
[MSE_MAXBUTTONS
+ 1];
507 pInfo
= pPointer
->public.devicePrivate
;
508 pMse
= pInfo
->private;
509 pMse
->device
= pPointer
;
510 pUsbMse
= pMse
->mousePriv
;
514 pPointer
->public.on
= FALSE
;
516 for (nbuttons
= 0; nbuttons
< MSE_MAXBUTTONS
; ++nbuttons
)
517 map
[nbuttons
+ 1] = nbuttons
+ 1;
519 InitPointerDeviceStruct((DevicePtr
)pPointer
,
521 min(pMse
->buttons
, MSE_MAXBUTTONS
),
522 miPointerGetMotionEvents
,
524 miPointerGetMotionBufferSize());
527 xf86InitValuatorAxisStruct(pPointer
, 0, 0, -1, 1, 0, 1);
528 xf86InitValuatorDefaults(pPointer
, 0);
530 xf86InitValuatorAxisStruct(pPointer
, 1, 0, -1, 1, 0, 1);
531 xf86InitValuatorDefaults(pPointer
, 1);
532 xf86MotionHistoryAllocate(pInfo
);
536 pInfo
->fd
= xf86OpenSerial(pInfo
->options
);
538 xf86Msg(X_WARNING
, "%s: cannot open input device\n", pInfo
->name
);
540 pMse
->buffer
= XisbNew(pInfo
->fd
, pUsbMse
->packetSize
);
543 xf86CloseSerial(pInfo
->fd
);
546 xf86FlushInput(pInfo
->fd
);
547 if (!xf86InstallSIGIOHandler (pInfo
->fd
, usbSigioReadInput
,
549 AddEnabledDevice(pInfo
->fd
);
552 pMse
->lastButtons
= 0;
553 pMse
->lastMappedButtons
= 0;
554 pMse
->emulateState
= 0;
555 pPointer
->public.on
= TRUE
;
560 if (pInfo
->fd
!= -1) {
561 RemoveEnabledDevice(pInfo
->fd
);
562 if (pUsbMse
->packetSize
> 8 && pUsbMse
->buffer
) {
563 xfree(pUsbMse
->buffer
);
566 XisbFree(pMse
->buffer
);
569 xf86CloseSerial(pInfo
->fd
);
572 pPointer
->public.on
= FALSE
;
580 usbReadInput(InputInfoPtr pInfo
)
584 int buttons
= pMse
->lastButtons
;
585 int dx
= 0, dy
= 0, dz
= 0, dw
= 0;
589 pMse
= pInfo
->private;
590 pUsbMse
= pMse
->mousePriv
;
592 XisbBlockDuration(pMse
->buffer
, -1);
593 pBuf
= pUsbMse
->buffer
;
595 while ((c
= XisbRead(pMse
->buffer
)) >= 0 && n
< pUsbMse
->packetSize
) {
596 pBuf
[n
++] = (unsigned char)c
;
600 if (n
!= pUsbMse
->packetSize
) {
601 xf86Msg(X_WARNING
, "%s: incomplete packet, size %d\n", pInfo
->name
,
604 /* discard packets with an id that don't match the mouse */
605 /* XXX this is probably not the right thing */
606 if (pUsbMse
->iid
!= 0) {
607 if (*pBuf
++ != pUsbMse
->iid
)
610 dx
= hid_get_data(pBuf
, &pUsbMse
->loc_x
);
611 dy
= hid_get_data(pBuf
, &pUsbMse
->loc_y
);
612 dz
= hid_get_data(pBuf
, &pUsbMse
->loc_z
);
615 for (n
= 0; n
< pMse
->buttons
; n
++) {
616 if (hid_get_data(pBuf
, &pUsbMse
->loc_btn
[n
]))
617 buttons
|= (1 << UMS_BUT(n
));
619 pMse
->PostEvent(pInfo
, buttons
, dx
, dy
, dz
, dw
);
624 usbSigioReadInput (int fd
, void *closure
)
626 usbReadInput ((InputInfoPtr
) closure
);
629 /* This function is called when the protocol is "usb". */
631 usbPreInit(InputInfoPtr pInfo
, const char *protocol
, int flags
)
633 MouseDevPtr pMse
= pInfo
->private;
635 report_desc_t reportDesc
;
638 pUsbMse
= xalloc(sizeof(UsbMseRec
));
639 if (pUsbMse
== NULL
) {
640 xf86Msg(X_ERROR
, "%s: cannot allocate UsbMouseRec\n", pInfo
->name
);
645 pMse
->protocol
= protocol
;
646 xf86Msg(X_CONFIG
, "%s: Protocol: %s\n", pInfo
->name
, protocol
);
648 /* Collect the options, and process the common options. */
649 xf86CollectInputOptions(pInfo
, NULL
, NULL
);
650 xf86ProcessCommonOptions(pInfo
, pInfo
->options
);
652 /* Check if the device can be opened. */
653 pInfo
->fd
= xf86OpenSerial(pInfo
->options
);
654 if (pInfo
->fd
== -1) {
655 if (xf86GetAllowMouseOpenFail())
656 xf86Msg(X_WARNING
, "%s: cannot open input device\n", pInfo
->name
);
658 xf86Msg(X_ERROR
, "%s: cannot open input device\n", pInfo
->name
);
664 /* Get USB informations */
665 reportDesc
= hid_get_report_desc(pInfo
->fd
);
666 /* Get packet size & iid */
668 if (ioctl(pInfo
->fd
, USB_GET_REPORT_ID
, &pUsbMse
->iid
) == -1) {
669 xf86Msg(X_ERROR
, "Error ioctl USB_GET_REPORT_ID on %s : %s\n",
670 pInfo
->name
, strerror(errno
));
673 pUsbMse
->packetSize
= hid_report_size(reportDesc
, hid_input
,
676 pUsbMse
->packetSize
= hid_report_size(reportDesc
, hid_input
,
679 /* Allocate buffer */
680 if (pUsbMse
->packetSize
<= 8) {
681 pUsbMse
->buffer
= pMse
->protoBuf
;
683 pUsbMse
->buffer
= xalloc(pUsbMse
->packetSize
);
685 if (pUsbMse
->buffer
== NULL
) {
686 xf86Msg(X_ERROR
, "%s: cannot allocate buffer\n", pInfo
->name
);
689 xf86CloseSerial(pInfo
->fd
);
693 if (hid_locate(reportDesc
, HID_USAGE2(HUP_GENERIC_DESKTOP
, HUG_X
),
694 hid_input
, &pUsbMse
->loc_x
, pUsbMse
->iid
) < 0) {
695 xf86Msg(X_WARNING
, "%s: no x locator\n", pInfo
->name
);
697 if (hid_locate(reportDesc
, HID_USAGE2(HUP_GENERIC_DESKTOP
, HUG_Y
),
698 hid_input
, &pUsbMse
->loc_y
, pUsbMse
->iid
) < 0) {
699 xf86Msg(X_WARNING
, "%s: no y locator\n", pInfo
->name
);
701 if (hid_locate(reportDesc
, HID_USAGE2(HUP_GENERIC_DESKTOP
, HUG_WHEEL
),
702 hid_input
, &pUsbMse
->loc_z
, pUsbMse
->iid
) < 0) {
705 if (hid_locate(reportDesc
, HID_USAGE2(HUP_GENERIC_DESKTOP
, HUG_X
),
706 hid_input
, &pUsbMse
->loc_x
) < 0) {
707 xf86Msg(X_WARNING
, "%s: no x locator\n", pInfo
->name
);
709 if (hid_locate(reportDesc
, HID_USAGE2(HUP_GENERIC_DESKTOP
, HUG_Y
),
710 hid_input
, &pUsbMse
->loc_y
) < 0) {
711 xf86Msg(X_WARNING
, "%s: no y locator\n", pInfo
->name
);
713 if (hid_locate(reportDesc
, HID_USAGE2(HUP_GENERIC_DESKTOP
, HUG_WHEEL
),
714 hid_input
, &pUsbMse
->loc_z
) < 0) {
717 /* Probe for number of buttons */
718 for (i
= 1; i
<= MSE_MAXBUTTONS
; i
++) {
719 if (!hid_locate(reportDesc
, HID_USAGE2(HUP_BUTTON
, i
),
720 hid_input
, &pUsbMse
->loc_btn
[i
-1]
729 xf86CloseSerial(pInfo
->fd
);
732 /* Private structure */
733 pMse
->mousePriv
= pUsbMse
;
735 /* Process common mouse options (like Emulate3Buttons, etc). */
736 pMse
->CommonOptions(pInfo
);
738 /* Setup the local procs. */
739 pInfo
->device_control
= usbMouseProc
;
740 pInfo
->read_input
= usbReadInput
;
742 pInfo
->flags
|= XI86_CONFIGURED
;
745 #endif /* USBMOUSE */
748 bsdMousePreInit(InputInfoPtr pInfo
, const char *protocol
, int flags
)
750 /* The protocol is guaranteed to be one of the internalNames[] */
751 #ifdef WSCONS_SUPPORT
752 if (xf86NameCmp(protocol
, "WSMouse") == 0) {
753 return wsconsPreInit(pInfo
, protocol
, flags
);
756 #ifdef USBMOUSE_SUPPORT
757 if (xf86NameCmp(protocol
, "usb") == 0) {
758 return usbPreInit(pInfo
, protocol
, flags
);
764 _X_EXPORT OSMouseInfoPtr
765 xf86OSMouseInit(int flags
)
769 p
= xcalloc(sizeof(OSMouseInfoRec
), 1);
772 p
->SupportedInterfaces
= SupportedInterfaces
;
773 p
->BuiltinNames
= BuiltinNames
;
774 p
->DefaultProtocol
= DefaultProtocol
;
775 p
->CheckProtocol
= CheckProtocol
;
776 #if (defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)) && defined(MOUSE_PROTO_SYSMOUSE)
777 p
->SetupAuto
= SetupAuto
;
778 p
->SetPS2Res
= SetSysMouseRes
;
779 p
->SetBMRes
= SetSysMouseRes
;
780 p
->SetMiscRes
= SetSysMouseRes
;
782 #if defined(__OpenBSD__) && defined(WSCONS_SUPPORT)
783 p
->SetupAuto
= SetupAuto
;
784 p
->SetMiscRes
= SetMouseRes
;
786 #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) || defined(__DragonFly__)
787 p
->FindDevice
= FindDevice
;
789 p
->PreInit
= bsdMousePreInit
;