From owner-svn-src-head@freebsd.org Mon Mar 16 13:53:31 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8AA3226704A; Mon, 16 Mar 2020 13:53:31 +0000 (UTC) (envelope-from alfredo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48gySV1x4Rz42TT; Mon, 16 Mar 2020 13:53:30 +0000 (UTC) (envelope-from alfredo@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A91F121773; Mon, 16 Mar 2020 13:53:29 +0000 (UTC) (envelope-from alfredo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 02GDrT1w018237; Mon, 16 Mar 2020 13:53:29 GMT (envelope-from alfredo@FreeBSD.org) Received: (from alfredo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 02GDrTuJ018236; Mon, 16 Mar 2020 13:53:29 GMT (envelope-from alfredo@FreeBSD.org) Message-Id: <202003161353.02GDrTuJ018236@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alfredo set sender to alfredo@FreeBSD.org using -f From: "Alfredo Dal'Ava Junior" Date: Mon, 16 Mar 2020 13:53:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r359015 - head/sys/dev/usb/input X-SVN-Group: head X-SVN-Commit-Author: alfredo X-SVN-Commit-Paths: head/sys/dev/usb/input X-SVN-Commit-Revision: 359015 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Mar 2020 13:53:31 -0000 Author: alfredo Date: Mon Mar 16 13:53:29 2020 New Revision: 359015 URL: https://svnweb.freebsd.org/changeset/base/359015 Log: atp: fix mouse attachment on PowerBook5,6 (G4) Skip device mode switch step on Fountain-based devices as they don't support RAW_SENSOR_MODE command, so failing to attach. This was reproduced on PowerBook G4 (model PowerBook5,6) equipped with product ID 0x020e Reviewed by: hselasky Approved by: jhibbits (mentor) Differential Revision: https://reviews.freebsd.org/D24005 Modified: head/sys/dev/usb/input/atp.c Modified: head/sys/dev/usb/input/atp.c ============================================================================== --- head/sys/dev/usb/input/atp.c Mon Mar 16 12:33:57 2020 (r359014) +++ head/sys/dev/usb/input/atp.c Mon Mar 16 13:53:29 2020 (r359015) @@ -2219,6 +2219,9 @@ atp_attach(device_t dev) return (ENXIO); } + di = USB_GET_DRIVER_INFO(uaa); + sc->sc_family = DECODE_FAMILY_FROM_DRIVER_INFO(di); + /* * By default the touchpad behaves like an HID device, sending * packets with reportID = 2. Such reports contain only @@ -2227,17 +2230,18 @@ atp_attach(device_t dev) * sensors. The device input mode can be switched from HID * reports to raw sensor data using vendor-specific USB * control commands. + * FOUNTAIN devices will give an error when trying to switch + * input mode, so we skip this command */ - if ((err = atp_set_device_mode(sc, RAW_SENSOR_MODE)) != 0) { + if ((sc->sc_family == TRACKPAD_FAMILY_FOUNTAIN_GEYSER) && + (DECODE_PRODUCT_FROM_DRIVER_INFO(di) == FOUNTAIN)) + DPRINTF("device mode switch skipped: Fountain device\n"); + else if ((err = atp_set_device_mode(sc, RAW_SENSOR_MODE)) != 0) { DPRINTF("failed to set mode to 'RAW_SENSOR' (%d)\n", err); return (ENXIO); } mtx_init(&sc->sc_mutex, "atpmtx", NULL, MTX_DEF | MTX_RECURSE); - - di = USB_GET_DRIVER_INFO(uaa); - - sc->sc_family = DECODE_FAMILY_FROM_DRIVER_INFO(di); switch(sc->sc_family) { case TRACKPAD_FAMILY_FOUNTAIN_GEYSER: