Date: Thu, 14 Feb 2013 10:32:47 +0000 (UTC) From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r246785 - stable/9/sys/dev/syscons Message-ID: <201302141032.r1EAWl5A068515@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: hselasky Date: Thu Feb 14 10:32:47 2013 New Revision: 246785 URL: http://svnweb.freebsd.org/changeset/base/246785 Log: MFC r246397: Make sure that all mouse buttons are released when clients using /dev/consolectl close. This fixes a problem where if a USB mouse is detached while a button is pressed, that button is never released. Modified: stable/9/sys/dev/syscons/syscons.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/syscons/syscons.c ============================================================================== --- stable/9/sys/dev/syscons/syscons.c Thu Feb 14 08:32:07 2013 (r246784) +++ stable/9/sys/dev/syscons/syscons.c Thu Feb 14 10:32:47 2013 (r246785) @@ -249,11 +249,13 @@ static struct ttydevsw sc_ttydevsw = { }; static d_ioctl_t consolectl_ioctl; +static d_close_t consolectl_close; static struct cdevsw consolectl_devsw = { .d_version = D_VERSION, - .d_flags = D_NEEDGIANT, + .d_flags = D_NEEDGIANT | D_TRACKCLOSE, .d_ioctl = consolectl_ioctl, + .d_close = consolectl_close, .d_name = "consolectl", }; @@ -1557,6 +1559,23 @@ consolectl_ioctl(struct cdev *dev, u_lon return sctty_ioctl(dev->si_drv1, cmd, data, td); } +static int +consolectl_close(struct cdev *dev, int flags, int mode, struct thread *td) +{ +#ifndef SC_NO_SYSMOUSE + mouse_info_t info; + memset(&info, 0, sizeof(info)); + info.operation = MOUSE_ACTION; + + /* + * Make sure all buttons are released when moused and other + * console daemons exit, so that no buttons are left pressed. + */ + (void) sctty_ioctl(dev->si_drv1, CONS_MOUSECTL, (caddr_t)&info, td); +#endif + return (0); +} + static void sc_cnprobe(struct consdev *cp) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201302141032.r1EAWl5A068515>