diff options
author | Joshua Stein <jcs@cvs.openbsd.org> | 2021-03-28 15:57:46 +0000 |
---|---|---|
committer | Joshua Stein <jcs@cvs.openbsd.org> | 2021-03-28 15:57:46 +0000 |
commit | d2db9cdd11435f1eb87711506d4fef12ec1800cd (patch) | |
tree | 7f08cccbb3d4faabe8672c700cba75ae4988901f | |
parent | e0b3463f3313ece5ad72b7653ecff9acf70051cc (diff) |
Ignore WSMOUSEIO_GTYPE ioctl failure when checking /dev/wsmouse
When xf86-input-ws has attached separately to all existing mouse
devices already or there are no mice plugged in, xf86-input-ws fails
to attach to the wsmouse mux as a default fallback because there is
no wsmouse device left in the mux to handle the WSMOUSEIO_GTYPE
ioctl. If a USB mouse is later plugged in, there will not be any
xf86-input-ws driver loaded listening to /dev/wsmouse for input.
ok matthieu
-rw-r--r-- | driver/xf86-input-ws/src/ws.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/driver/xf86-input-ws/src/ws.c b/driver/xf86-input-ws/src/ws.c index 894704877..ac62b5e0d 100644 --- a/driver/xf86-input-ws/src/ws.c +++ b/driver/xf86-input-ws/src/ws.c @@ -13,7 +13,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $OpenBSD: ws.c,v 1.65 2020/09/13 10:26:31 matthieu Exp $ */ +/* $OpenBSD: ws.c,v 1.66 2021/03/28 15:57:45 jcs Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -67,6 +67,8 @@ static Atom prop_swap; int ws_debug_level = 0; #endif +#define WSMOUSE_MUX_DEVICE "/dev/wsmouse" + static XF86ModuleVersionInfo VersionRec = { "ws", MODULEVENDORSTRING, @@ -212,8 +214,17 @@ wsPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags) } if (wsOpen(pInfo) != Success) goto fail; - if (ioctl(pInfo->fd, WSMOUSEIO_GTYPE, &priv->type) != 0) - goto fail; + if (ioctl(pInfo->fd, WSMOUSEIO_GTYPE, &priv->type) != 0) { + if (strcmp(priv->devName, WSMOUSE_MUX_DEVICE) == 0) + /* + * No mice are currently connected to the mux, assume + * any traffic we see on it later will come from a USB + * mouse. + */ + priv->type = WSMOUSE_TYPE_USB; + else + goto fail; + } if (priv->type == WSMOUSE_TYPE_TPANEL) { pInfo->type_name = XI_TOUCHSCREEN; priv->raw = xf86SetBoolOption(pInfo->options, "Raw", 1); |