From 8665dd6d59e7454d097b31bbe917b28105dec7ef Mon Sep 17 00:00:00 2001 From: bru Date: Tue, 2 Mar 2021 22:35:19 +0000 Subject: [PATCH] Read general and touchpad-specific wsmouse settings separately. Correct the identification of the device type when reading the touchpad parameters fails. ok jcs@ --- sbin/wsconsctl/mousecfg.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sbin/wsconsctl/mousecfg.c b/sbin/wsconsctl/mousecfg.c index 6d52bcbfc9c..afa98cfb1ce 100644 --- a/sbin/wsconsctl/mousecfg.c +++ b/sbin/wsconsctl/mousecfg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mousecfg.c,v 1.7 2020/04/02 17:17:04 deraadt Exp $ */ +/* $OpenBSD: mousecfg.c,v 1.8 2021/03/02 22:35:19 bru Exp $ */ /* * Copyright (c) 2017 Ulf Brosziewski @@ -162,11 +162,17 @@ mousecfg_init(int dev_fd, const char **errstr) } parameters.params = cfg_buffer; - parameters.nparams = (cfg_touchpad ? BUFSIZE : BASESIZE); + parameters.nparams = BASESIZE; if ((err = ioctl(dev_fd, WSMOUSEIO_GETPARAMS, ¶meters))) { *errstr = "WSMOUSEIO_GETPARAMS"; return (err); } + if (cfg_touchpad) { + parameters.params = cfg_buffer + BASESIZE; + parameters.nparams = BUFSIZE - BASESIZE; + if (ioctl(dev_fd, WSMOUSEIO_GETPARAMS, ¶meters)) + cfg_touchpad = 0; + } return (0); } -- 2.20.1