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
This commit is contained in:
jcs
2021-03-28 15:57:45 +00:00
parent 22be2a94c5
commit 2cc95a6942

View File

@@ -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);