diff options
Diffstat (limited to 'hw/xfree86/os-support/bsd/bsd_mouse.c')
-rw-r--r-- | hw/xfree86/os-support/bsd/bsd_mouse.c | 67 |
1 files changed, 63 insertions, 4 deletions
diff --git a/hw/xfree86/os-support/bsd/bsd_mouse.c b/hw/xfree86/os-support/bsd/bsd_mouse.c index 943bb9855..bb5936a1e 100644 --- a/hw/xfree86/os-support/bsd/bsd_mouse.c +++ b/hw/xfree86/os-support/bsd/bsd_mouse.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_mouse.c,v 1.26 2003/10/10 20:56:05 herrb Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_mouse.c,v 1.28 2004/02/06 17:15:36 tsi Exp $ */ /* * Copyright (c) 1999-2003 by The XFree86 Project, Inc. @@ -80,6 +80,16 @@ static const char *mouseDevs[] = { DEFAULT_PS2_DEV, NULL }; +#elif defined(__OpenBSD__) && defined(WSCONS_SUPPORT) +/* Only wsmouse mices are autoconfigured for now on OpenBSD */ +#define DEFAULT_WSMOUSE_DEV "/dev/wsmouse" +#define DEFAULT_WSMOUSE0_DEV "/dev/wsmouse0" + +static const char *mouseDevs[] = { + DEFAULT_WSMOUSE_DEV, + DEFAULT_WSMOUSE0_DEV, + NULL +}; #endif static int @@ -141,6 +151,8 @@ DefaultProtocol(void) { #if defined(__FreeBSD__) return "Auto"; +#elif defined(__OpenBSD__) && defined(WSCONS_SUPPORT) + return "WSMouse"; #else return NULL; #endif @@ -195,7 +207,7 @@ SetupAuto(InputInfoPtr pInfo, int *protoPara) protoPara[0] = mode.syncmask[0]; protoPara[1] = mode.syncmask[1]; } - xf86MsgVerb(X_INFO, 3, "%s: SetupAuto: protocol is %s\n", + xf86MsgVerb(X_INFO, 3, "%s: SetupAuto: protocol is %s\n", pInfo->name, devproto[i].name); return devproto[i].name; } @@ -325,7 +337,50 @@ FindDevice(InputInfoPtr pInfo, const char *protocol, int flags) } #endif -#if defined(WSCONS_SUPPORT) +#if defined(__OpenBSD__) && defined(WSCONS_SUPPORT) + +/* Only support wsmouse configuration for now */ +static const char * +SetupAuto(InputInfoPtr pInfo, int *protoPara) +{ + + xf86MsgVerb(X_INFO, 3, "%s: SetupAuto: protocol is %s\n", + pInfo->name, "wsmouse"); + return "wsmouse"; +} + +static void +SetMouseRes(InputInfoPtr pInfo, const char *protocol, int rate, int res) +{ + + xf86MsgVerb(X_INFO, 3, "%s: SetMouseRes: protocol %s rate %d res %d\n", + pInfo->name, protocol, rate, res); +} + +static const char * +FindDevice(InputInfoPtr pInfo, const char *protocol, int flags) +{ + int fd = -1; + const char **pdev; + + for (pdev = mouseDevs; *pdev; pdev++) { + SYSCALL(fd = open(*pdev, O_RDWR | O_NONBLOCK)); + if (fd != -1) { + /* Set the Device option. */ + pInfo->conf_idev->commonOptions = + xf86AddNewOption(pInfo->conf_idev->commonOptions, + "Device", *pdev); + xf86Msg(X_INFO, "%s: found Device \"%s\"\n", + pInfo->name, *pdev); + close(fd); + break; + } + } + return *pdev; +} +#endif /* __OpenBSD__ && WSCONS_SUPPORT */ + +#ifdef WSCONS_SUPPORT #define NUMEVENTS 64 static void @@ -718,7 +773,11 @@ xf86OSMouseInit(int flags) p->SetBMRes = SetSysMouseRes; p->SetMiscRes = SetSysMouseRes; #endif -#if defined(__FreeBSD__) +#if defined(__OpenBSD__) && defined(WSCONS_SUPPORT) + p->SetupAuto = SetupAuto; + p->SetMiscRes = SetMouseRes; +#endif +#if defined(__FreeBSD__) || defined(__OpenBSD__) p->FindDevice = FindDevice; #endif p->PreInit = bsdMousePreInit; |