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:
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to