VirtualBox

Changeset 95090 in vbox for trunk


Ignore:
Timestamp:
May 25, 2022 9:26:48 AM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
151563
Message:

VBoxGuest-netbsd.c: Fix mouse range. bugref:8547

wsmux(4) doesn't properly handle the case when two mice with absolute
position events but different calibration data are being multiplexed.
Force VMM range into the ums(4) range and rely on the fact that no
actual calibration is done and both devices are used in the raw mode.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-netbsd.c

    r93115 r95090  
    203203
    204204
     205/*
     206 * XXX: wsmux(4) doesn't properly handle the case when two mice with
     207 * absolute position events but different calibration data are being
     208 * multiplexed.  Without GAs the absolute events will be reported
     209 * through the tablet ums(4) device with the range of 32k, but with
     210 * GAs the absolute events will be reported through the VMM device
     211 * (wsmouse at vboxguest) and VMM uses the range of 64k.  Which one
     212 * responds to the calibration ioctl depends on the order of
     213 * attachment.  On boot kernel attaches ums first and GAs later, so
     214 * it's VMM (this driver) that gets the ioctl.  After save/restore the
     215 * ums will be detached and re-attached and after that it's ums that
     216 * will get the ioctl, but the events (with a wider range) will still
     217 * come via the VMM, confusing X, wsmoused, etc.  Hack around that by
     218 * forcing the range here to match the tablet's range.
     219 *
     220 * We force VMM range into the ums range and rely on the fact that no
     221 * actual calibration is done and both devices are used in the raw
     222 * mode.  See tpcalib_trans call below.
     223 *
     224 * Cf. src/VBox/Devices/Input/UsbMouse.cpp
     225 */
     226#define USB_TABLET_RANGE_MIN 0
     227#define USB_TABLET_RANGE_MAX 0x7fff
     228
    205229static struct wsmouse_calibcoords vboxguest_wsm_default_calib = {
    206     .minx = VMMDEV_MOUSE_RANGE_MIN,
    207     .miny = VMMDEV_MOUSE_RANGE_MIN,
    208     .maxx = VMMDEV_MOUSE_RANGE_MAX,
    209     .maxy = VMMDEV_MOUSE_RANGE_MAX,
     230    .minx = USB_TABLET_RANGE_MIN, // VMMDEV_MOUSE_RANGE_MIN,
     231    .miny = USB_TABLET_RANGE_MIN, // VMMDEV_MOUSE_RANGE_MIN,
     232    .maxx = USB_TABLET_RANGE_MAX, // VMMDEV_MOUSE_RANGE_MAX,
     233    .maxy = USB_TABLET_RANGE_MAX, // VMMDEV_MOUSE_RANGE_MAX,
    210234    .samplelen = WSMOUSE_CALIBCOORDS_RESET,
    211235};
     
    538562            return;
    539563
    540         tpcalib_trans(&sc->sc_tpcalib,
    541                       sc->sc_vmmmousereq->pointerXPos,
    542                       sc->sc_vmmmousereq->pointerYPos,
    543                       &x, &y);
     564        /* XXX: see the comment for vboxguest_wsm_default_calib */
     565        int rawx = (unsigned)sc->sc_vmmmousereq->pointerXPos >> 1;
     566        int rawy = (unsigned)sc->sc_vmmmousereq->pointerYPos >> 1;
     567        tpcalib_trans(&sc->sc_tpcalib, rawx, rawy, &x, &y);
    544568
    545569        wsmouse_input(sc->sc_wsmousedev,
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette