Read general and touchpad-specific wsmouse settings separately.
authorbru <bru@openbsd.org>
Tue, 2 Mar 2021 22:35:19 +0000 (22:35 +0000)
committerbru <bru@openbsd.org>
Tue, 2 Mar 2021 22:35:19 +0000 (22:35 +0000)
Correct the identification of the device type when reading the
touchpad parameters fails.

ok jcs@

sbin/wsconsctl/mousecfg.c

index 6d52bcb..afa98cf 100644 (file)
@@ -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, &parameters))) {
                *errstr = "WSMOUSEIO_GETPARAMS";
                return (err);
        }
+       if (cfg_touchpad) {
+               parameters.params = cfg_buffer + BASESIZE;
+               parameters.nparams = BUFSIZE - BASESIZE;
+               if (ioctl(dev_fd, WSMOUSEIO_GETPARAMS, &parameters))
+                       cfg_touchpad = 0;
+       }
 
        return (0);
 }