Bug 188829 - [atp] atp fails on Macbook Pro 4.1 [regression]
Summary: [atp] atp fails on Macbook Pro 4.1 [regression]
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: usb (show other bugs)
Version: 10.0-STABLE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-usb (Nobody)
Depends on:
Reported: 2014-04-20 17:10 UTC by rdeiriar
Modified: 2018-12-22 13:34 UTC (History)
2 users (show)

See Also:

Unified diff (1.16 KB, patch)
2018-09-04 14:29 UTC, Jason W. Bacon
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description rdeiriar 2014-04-20 17:10:00 UTC
On my Macbook Pro 4.1, after upgrading from 10.0-RELEASE to 10.0-STABLE,
the atp touchpad driver becomes unresponsive after a few minutes under
high I/O load, until it stalls completely. The device never unstalls,
regardless of system load. 

Closing and opening /dev/atp0 (i.e. restarting moused) restores
responsiveness for a couple of minutes, then it fails in the same manner.

Reverting back /usr/src/sys/dev/usb/input/atp.c from rev. 263063 to rev.
233774 (as shipped with FreeBSD 10.0-RELEASE) solves the problem completely
on my machine.

Unfortunately, i am not versed in the workings of the atp driver in order
to debug the new driver any further.


Hack: Revert back to /usr/src/sys/dev/usb/input/atp.c as shipped with 10.0-RELEASE (r. 233774)
How-To-Repeat: Use the trackpad under high I/O load
Comment 1 hps 2014-04-20 17:35:27 UTC

Can you send output from:

usbconfig dump_device_desc

which is relevant for your device.

What happens if you add to /boot/loader.conf


And re-boot?

Comment 2 rdeiriar 2014-04-21 16:15:10 UTC
The relevant device is

ugen5.3: <Apple Internal Keyboard  Trackpad Apple Computer> at usbus5,
cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (40mA)

  bLength = 0x0012
  bDescriptorType = 0x0001
  bcdUSB = 0x0200
  bDeviceClass = 0x0000
  bDeviceSubClass = 0x0000
  bDeviceProtocol = 0x0000
  bMaxPacketSize0 = 0x0008
  idVendor = 0x05ac
  idProduct = 0x021a
  bcdDevice = 0x0018
  iManufacturer = 0x0001  <Apple Computer>
  iProduct = 0x0002  <Apple Internal Keyboard / Trackpad>
  iSerialNumber = 0x0000  <no string>
  bNumConfigurations = 0x0001

> What happens if you add to /boot/loader.conf
> wsp_load=YES
> And re-boot?
> --HPS
I tried the following configurations on /boot/loader.conf


Same effect as with atp_load only, device gets dected as atp0, fails as

wsp_load=YES only

Device gets detected as usm0, using the ums driver, it works but no
touchpad features are recognized)

Thanks a lot!
Comment 3 Jason W. Bacon freebsd_committer 2015-10-18 15:08:38 UTC
I'm seeing the same issue with my 2007 MacBook Pro in 10.2-RELEASE.

Roberto's hack is no longer viable, as atp.c has changed too much since 10.0.

I have src installed and would be willing to try any suggestions from an expert in the area.

A diff of the two atp.c files produced way too many changes for me to track down the bug on my own:

diff atp.c.10.0 atp.c | wc -l

My workaround for now is restarting sysmouse every minute via crontab.

Comment 4 Eitan Adler freebsd_committer freebsd_triage 2018-05-28 19:49:47 UTC
batch change:

For bugs that match the following
-  Status Is In progress 
- Untouched since 2018-01-01.
- Affects Base System OR Documentation


Reset to open status.

I did a quick pass but if you are getting this email it might be worthwhile to double check to see if this bug ought to be closed.
Comment 5 Jason W. Bacon freebsd_committer 2018-09-04 14:29:23 UTC
Created attachment 196858 [details]
Unified diff

The author of the atp driver pointed me to this patch some time ago and I was surprised to see that the problem still exists in 11.1-RELEASE.

It has to do with recalibrating the touchpad as temperature rises.

The patch still applies cleanly and solves the problem on my MacBook Pro.

From dmidecode:

System Information
        Manufacturer: Apple Computer, Inc.
        Product Name: MacBookPro2,2
        Version: 1.0

There's another small problem now, though.  "make install" places the module in /boot/modules, and kldload still grabs the old one from /boot/kernel.

Here's what I do in total to make this problem go away:

cd /usr/src/sys/dev/usb/input
fetch http://acadix.biz/atp.patch
if [ ! -e atp.c.save ]; then
    cp atp.c atp.c.save
if [ ! -e atp.c.orig ]; then
    patch < atp.patch
if [ ! -e /boot/kernel/atp.ko.save ]; then
    cp /boot/kernel/atp.ko /boot/kernel/atp.ko.save
cd /usr/src/sys/modules/usb/atp
kldunload atp
make install
cp /boot/modules/atp.ko /boot/kernel
# protect filesystem in case kld[un]load causes problems. Hasn't happened for
# me with atp, but it's a general habit based on a few bad experiences.
kldunload atp
kldload atp
Comment 6 Chris 2018-09-04 16:09:55 UTC
Product Name: MacBookPro2,2
FreeBSD: 11.2-RELEASE-p2

After following the instructions in Comment 5, I can now use the touchpad without it freezing. I did find I needed to stop devd otherwise the atp module would automatically reload when I unloaded it.

The touchpad is not the best, and does jump & skip sometimes, but I think that has more to do with the age of the machine.

Comment 7 Jason W. Bacon freebsd_committer 2018-09-04 17:59:15 UTC
I've also noticed that the touch pad is pretty low quality.  At first I thought it was the driver, but then I noticed that there is significant staircasing under OS X as well, but the Apple driver does a better job hiding it, at least when the cursor is moving fast.
Comment 8 Chris 2018-12-22 13:34:26 UTC
I can confirm this issue still exists in 12.0-RELEASE amd64, and the patch in Comment 5 resolves the issue. What needs to be done to get this patch in to FreeBSD? Thanks.