From owner-svn-src-all@freebsd.org Mon Oct 30 20:58:59 2017 Return-Path: Delivered-To: svn-src-all@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 00689E655A1; Mon, 30 Oct 2017 20:58:59 +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 C393F71361; Mon, 30 Oct 2017 20:58:58 +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 v9UKwvH3067446; Mon, 30 Oct 2017 20:58:57 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9UKwvao067445; Mon, 30 Oct 2017 20:58:57 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201710302058.v9UKwvao067445@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Mon, 30 Oct 2017 20:58:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325165 - head/usr.sbin/bluetooth/bthidd X-SVN-Group: head X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: head/usr.sbin/bluetooth/bthidd X-SVN-Commit-Revision: 325165 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Oct 2017 20:58:59 -0000 Author: wulf Date: Mon Oct 30 20:58:57 2017 New Revision: 325165 URL: https://svnweb.freebsd.org/changeset/base/325165 Log: bthidd(8): Generate button release event after virtual T-axis button press Apply PR/213957 (r308165, Make sure the virtual T-axis buttons generate button release event(s) for continuous tilting) to bluetooth mouse support. Reviewed by: emax, gonzo Approved by: gonzo (mentor) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D12672 Modified: head/usr.sbin/bluetooth/bthidd/hid.c Modified: head/usr.sbin/bluetooth/bthidd/hid.c ============================================================================== --- head/usr.sbin/bluetooth/bthidd/hid.c Mon Oct 30 20:31:48 2017 (r325164) +++ head/usr.sbin/bluetooth/bthidd/hid.c Mon Oct 30 20:58:57 2017 (r325165) @@ -169,7 +169,7 @@ hid_interrupt(bthid_session_p s, uint8_t *data, int32_ hid_data_t d; hid_item_t h; int32_t report_id, usage, page, val, - mouse_x, mouse_y, mouse_z, mouse_butt, + mouse_x, mouse_y, mouse_z, mouse_t, mouse_butt, mevents, kevents, i; assert(s != NULL); @@ -196,7 +196,8 @@ hid_interrupt(bthid_session_p s, uint8_t *data, int32_ hid_device = get_hid_device(&s->bdaddr); assert(hid_device != NULL); - mouse_x = mouse_y = mouse_z = mouse_butt = mevents = kevents = 0; + mouse_x = mouse_y = mouse_z = mouse_t = mouse_butt = 0; + mevents = kevents = 0; for (d = hid_start_parse(hid_device->desc, 1 << hid_input, -1); hid_get_item(d, &h) > 0; ) { @@ -283,11 +284,7 @@ hid_interrupt(bthid_session_p s, uint8_t *data, int32_ switch (usage) { case HUC_AC_PAN: /* Horizontal scroll */ - if (val < 0) - mouse_butt |= (1 << 5); - else - mouse_butt |= (1 << 6); - + mouse_t = val; mevents ++; val = 0; break; @@ -529,7 +526,20 @@ check_middle_button: if (mevents > 0) { struct mouse_info mi; + memset(&mi, 0, sizeof(mi)); mi.operation = MOUSE_ACTION; + mi.u.data.buttons = mouse_butt; + + /* translate T-axis into button presses */ + if (mouse_t != 0) { + mi.u.data.buttons |= 1 << (mouse_t > 0 ? 6 : 5); + if (ioctl(s->srv->cons, CONS_MOUSECTL, &mi) < 0) + syslog(LOG_ERR, "Could not process mouse " \ + "events from %s. %s (%d)", + bt_ntoa(&s->bdaddr, NULL), + strerror(errno), errno); + } + mi.u.data.x = mouse_x; mi.u.data.y = mouse_y; mi.u.data.z = mouse_z;