From owner-svn-src-stable-11@freebsd.org Mon Dec 4 21:12:06 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CBD0AE6AEB1; Mon, 4 Dec 2017 21:12:06 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8DC0479A57; Mon, 4 Dec 2017 21:12:06 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vB4LC5ck005252; Mon, 4 Dec 2017 21:12:05 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vB4LC5d2005247; Mon, 4 Dec 2017 21:12:05 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201712042112.vB4LC5d2005247@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Mon, 4 Dec 2017 21:12:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r326543 - in stable/11/sys/dev: evdev syscons vt X-SVN-Group: stable-11 X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: in stable/11/sys/dev: evdev syscons vt X-SVN-Commit-Revision: 326543 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Dec 2017 21:12:06 -0000 Author: wulf Date: Mon Dec 4 21:12:05 2017 New Revision: 326543 URL: https://svnweb.freebsd.org/changeset/base/326543 Log: MFC r325295: evdev: Lock Giant around keyboard ioctls This fixes turning ukbd(4) LEDs on/off with evdev interface as well MFC r325296: evdev: Take driver's lock in cdev write handler if necessary MFC r325297: sysmouse(4): Fix ums(4)-style T-axis reporting via evdev protocol - Do not report T-axis wheel events as button presses - Reverse T-axis to match Linux - Remove wrong comment. T-axis buttons state should be checked by level not by edge to allow continuous wheel tilt reporting MFC r325298: evdev: Disable value normalization and state filtering for SND events. Some events can take sound pitch as a value so can not be represented as binary on/off events. Tracking for on/off state is left in place as it is a part of the evdev API. MFC r325299: evdev: Do not start/stop softrepeat callout if no clients attached Approved by: gonzo (mentor) Modified: stable/11/sys/dev/evdev/evdev.c stable/11/sys/dev/evdev/evdev.h stable/11/sys/dev/evdev/evdev_utils.c stable/11/sys/dev/syscons/sysmouse.c stable/11/sys/dev/vt/vt_sysmouse.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/evdev/evdev.c ============================================================================== --- stable/11/sys/dev/evdev/evdev.c Mon Dec 4 20:45:15 2017 (r326542) +++ stable/11/sys/dev/evdev/evdev.c Mon Dec 4 21:12:05 2017 (r326543) @@ -582,7 +582,8 @@ evdev_modify_event(struct evdev_dev *evdev, uint16_t t *value = KEY_EVENT_REPEAT; } else { /* Start/stop callout for evdev repeats */ - if (bit_test(evdev->ev_key_states, code) == !*value) { + if (bit_test(evdev->ev_key_states, code) == !*value && + !LIST_EMPTY(&evdev->ev_clients)) { if (*value == KEY_EVENT_DOWN) evdev_start_repeat(evdev, code); else @@ -637,8 +638,6 @@ evdev_sparse_event(struct evdev_dev *evdev, uint16_t t break; case EV_SND: - if (bit_test(evdev->ev_snd_states, code) == value) - return (EV_SKIP_EVENT); bit_change(evdev->ev_snd_states, code, value); break; @@ -816,7 +815,11 @@ evdev_inject_event(struct evdev_dev *evdev, uint16_t t case EV_ABS: case EV_SW: push: + if (evdev->ev_lock_type != EV_LOCK_INTERNAL) + EVDEV_LOCK(evdev); ret = evdev_push_event(evdev, type, code, value); + if (evdev->ev_lock_type != EV_LOCK_INTERNAL) + EVDEV_UNLOCK(evdev); break; default: Modified: stable/11/sys/dev/evdev/evdev.h ============================================================================== --- stable/11/sys/dev/evdev/evdev.h Mon Dec 4 20:45:15 2017 (r326542) +++ stable/11/sys/dev/evdev/evdev.h Mon Dec 4 21:12:05 2017 (r326543) @@ -197,7 +197,7 @@ static __inline int evdev_push_snd(struct evdev_dev *evdev, uint16_t code, int32_t value) { - return (evdev_push_event(evdev, EV_SND, code, value != 0)); + return (evdev_push_event(evdev, EV_SND, code, value)); } static __inline int Modified: stable/11/sys/dev/evdev/evdev_utils.c ============================================================================== --- stable/11/sys/dev/evdev/evdev_utils.c Mon Dec 4 20:45:15 2017 (r326542) +++ stable/11/sys/dev/evdev/evdev_utils.c Mon Dec 4 21:12:05 2017 (r326543) @@ -32,7 +32,9 @@ #include #include #include +#include #include +#include #include #include @@ -314,19 +316,26 @@ evdev_ev_kbd_event(struct evdev_dev *evdev, void *soft leds |= 1 << i; else leds &= ~(1 << i); - if (leds != oleds) + if (leds != oleds) { + mtx_lock(&Giant); kbdd_ioctl(kbd, KDSETLED, (caddr_t)&leds); + mtx_unlock(&Giant); + } break; } } } else if (type == EV_REP && code == REP_DELAY) { delay[0] = value; delay[1] = kbd->kb_delay2; + mtx_lock(&Giant); kbdd_ioctl(kbd, KDSETREPEAT, (caddr_t)delay); + mtx_unlock(&Giant); } else if (type == EV_REP && code == REP_PERIOD) { delay[0] = kbd->kb_delay1; delay[1] = value; + mtx_lock(&Giant); kbdd_ioctl(kbd, KDSETREPEAT, (caddr_t)delay); + mtx_unlock(&Giant); } } Modified: stable/11/sys/dev/syscons/sysmouse.c ============================================================================== --- stable/11/sys/dev/syscons/sysmouse.c Mon Dec 4 20:45:15 2017 (r326542) +++ stable/11/sys/dev/syscons/sysmouse.c Mon Dec 4 21:12:05 2017 (r326543) @@ -107,11 +107,11 @@ smdev_evdev_write(int x, int y, int z, int buttons) } break; case EVDEV_SYSMOUSE_T_AXIS_UMS: - /* XXX: Edge triggering should be used here */ - if (buttons & (1 << 5)) + if (buttons & (1 << 6)) evdev_push_rel(sysmouse_evdev, REL_HWHEEL, 1); - else if (buttons & (1 << 6)) + else if (buttons & (1 << 5)) evdev_push_rel(sysmouse_evdev, REL_HWHEEL, -1); + buttons &= ~((1 << 5)|(1 << 6)); /* PASSTHROUGH */ case EVDEV_SYSMOUSE_T_AXIS_NONE: default: Modified: stable/11/sys/dev/vt/vt_sysmouse.c ============================================================================== --- stable/11/sys/dev/vt/vt_sysmouse.c Mon Dec 4 20:45:15 2017 (r326542) +++ stable/11/sys/dev/vt/vt_sysmouse.c Mon Dec 4 21:12:05 2017 (r326543) @@ -139,11 +139,11 @@ sysmouse_evdev_store(int x, int y, int z, int buttons) } break; case EVDEV_SYSMOUSE_T_AXIS_UMS: - /* XXX: Edge triggering should be used here */ - if (buttons & (1 << 5)) + if (buttons & (1 << 6)) evdev_push_rel(sysmouse_evdev, REL_HWHEEL, 1); - else if (buttons & (1 << 6)) + else if (buttons & (1 << 5)) evdev_push_rel(sysmouse_evdev, REL_HWHEEL, -1); + buttons &= ~((1 << 5)|(1 << 6)); /* PASSTHROUGH */ case EVDEV_SYSMOUSE_T_AXIS_NONE: default: