From owner-svn-src-stable@FreeBSD.ORG Thu Feb 14 11:25:08 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 93C84DB; Thu, 14 Feb 2013 11:25:08 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 85761A2F; Thu, 14 Feb 2013 11:25:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1EBP8LV083995; Thu, 14 Feb 2013 11:25:08 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1EBP8k0083994; Thu, 14 Feb 2013 11:25:08 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201302141125.r1EBP8k0083994@svn.freebsd.org> From: Hans Petter Selasky Date: Thu, 14 Feb 2013 11:25:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r246787 - stable/8/sys/dev/syscons X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Feb 2013 11:25:08 -0000 Author: hselasky Date: Thu Feb 14 11:25:07 2013 New Revision: 246787 URL: http://svnweb.freebsd.org/changeset/base/246787 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/8/sys/dev/syscons/syscons.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/syscons/ (props changed) Modified: stable/8/sys/dev/syscons/syscons.c ============================================================================== --- stable/8/sys/dev/syscons/syscons.c Thu Feb 14 10:48:08 2013 (r246786) +++ stable/8/sys/dev/syscons/syscons.c Thu Feb 14 11:25:07 2013 (r246787) @@ -234,11 +234,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", }; @@ -1512,6 +1514,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) {