Solved FreeBSD15.0, MacBook trackpad works but not very well

Hello,

I've been researching this for a couple of weeks now, trying various things especially from this post Thread apple-r-trackpads-on-freebsd.83405, in an effort to get the trackpad on my early 2013 13" Retina MacBook Pro to work properly in FreeBSD 15.0-RELEASE with a GENERIC kernel. The post is very similar to my situation, but it's old enough now that things seem to have changed in the meantime. I can get the trackpad to work in a rudimentary way with the ums driver, allowing pointer movement and clicking, but nothing else: I can't tap or use two fingers for scrolling.

ums, wsp and atp are all loaded automatically, whether or not I mention them in /boot/loader.conf. By playing with kldunload and kldload I can break it so that it doesn't work at all. If put
Code:
atp_load="YES"
into /boot/loader.conf then both /dev/ums1 and /dev/atp0 are created, and the trackpad doesn't work.

I tried various ways of trying to suppress ums — module_blacklist, renaming the .ko file, disabling ums1 — in the hopes that it might allow wsp or atp to do their job, but either I didn't do it properly or it was just a bad idea.

The output from libinput debug-events is as you'd expect: when the trackpad is working, it registers movement and presses, but not taps; and when it isn't working it registers nothing from the trackpad. However, I have this line in /boot/loader.conf:
Code:
hw.usb.usbhid.enable=0
If I comment it out then the trackpad doesn't work, but I also get a new error from libinput printed in red at the top:
Code:
event5  - Apple Inc. Apple Internal Keyboard / Trackpad Touchpad: libinput bug: kernel fuzz of 40 but LIBINPUT_FUZZ_35 is missing
event5  - Apple Inc. Apple Internal Keyboard / Trackpad Touchpad: libinput bug: kernel fuzz of 27 but LIBINPUT_FUZZ_36 is missing
...that seems to be linked to udev, which is way beyond my small comfort zone, but it did make me think maybe it would work if I could solve the FUZZ issue.

I even wondered if maybe things had changed so that now ums will handle it, and I just need to configure it properly by enabling taps somewhere, which seems to be a thing with wsp and maybe atp too? But I can't find any information about that, and libinput list-devices shows all the tap settings as "n/a", I assume because the ums driver doesn't know how to deal with them.

It seems as though my trackpad is supported:
devinfo -f | grep ums
Code:
                  ums1 <Apple Inc. Apple Internal Keyboard / Trackpad, class 0/0, rev 2.00/2.24, addr 8> pnpinfo vendor=0x05ac product=0x025a devclass=0x00 devsubclass=0x00 devproto=0x00 sernum="" release=0x0224 mode=host intclass=0x03 intsubclass=0x01 intprotocol=0x02 at bus=2 hubaddr=3 port=2 devaddr=8 interface=2 ugen=ugen2.8
...and 0x025a appears in usbdevs at line 1218.

Anyway, that's my main stumbling block at the moment. I've got xfce running nicely and I've even created custom keyboard layouts for vt and X11 along with my own ~/.XCompose file to get around the fact that my CTRL key is broken (or just very, very dirty). If anyone can help me fix this last thing then suddenly it becomes a machine I could consider making a daily driver, and I will be eternally grateful.

Thanks,
Ben
 
The last message in the post was about sysctls, have you tried:
So now I solved the issue. CDE works and atp works.
I basically needed to have "kern.evdev.rcpt_mask=3"
I checked it by typing "sysctl kern.evdev.rcpt_mask=3" on a booted system and atp trackpad started to work. The trackpad's quite buggy by the way. Moving weirdly and scrolling is weird, but it's still better than not working! I modified /etc/sysctl.conf and added the line to make it permanent.

In order to make the cursor move better I needed to disable the touch to click. I thus also added "hw.usb.atp.tap_minimum=2" that made it better.

Hope this post helps others like me.
Cheers.
 
The last message in the post was about sysctls, have you tried:
Thanks for replying!

I have tried that, and also setting it to 12 which I saw elsewhere. It doesn't seem to have done any good though. But there are so many different pieces of advice floating around, it's quite possible that even though I've tried all the right things individually I just haven't tried the right combination.

I'm pretty sure I don't need to rebuild my kernel, as you did, I have all the modules you mentioned available; although hms isn't loaded by default — do you think I should stick in loader.conf?
 
Before you stick it in loader.conf, you can just do kldload hms (or any module for that matter). Putting it in loader.conf just forces it to be loaded at boot time. Try loading it to see if that helps.
 
Hello,

I've been researching this for a couple of weeks now, trying various things especially from this post Thread apple-r-trackpads-on-freebsd.83405, in an effort to get the trackpad on my early 2013 13" Retina MacBook Pro to work properly in FreeBSD 15.0-RELEASE with a GENERIC kernel. The post is very similar to my situation, but it's old enough now that things seem to have changed in the meantime. I can get the trackpad to work in a rudimentary way with the ums driver, allowing pointer movement and clicking, but nothing else: I can't tap or use two fingers for scrolling.

ums, wsp and atp are all loaded automatically, whether or not I mention them in /boot/loader.conf. By playing with kldunload and kldload I can break it so that it doesn't work at all. If put
Code:
atp_load="YES"
into /boot/loader.conf then both /dev/ums1 and /dev/atp0 are created, and the trackpad doesn't work.

I tried various ways of trying to suppress ums — module_blacklist, renaming the .ko file, disabling ums1 — in the hopes that it might allow wsp or atp to do their job, but either I didn't do it properly or it was just a bad idea.

The output from libinput debug-events is as you'd expect: when the trackpad is working, it registers movement and presses, but not taps; and when it isn't working it registers nothing from the trackpad. However, I have this line in /boot/loader.conf:
Code:
hw.usb.usbhid.enable=0
If I comment it out then the trackpad doesn't work, but I also get a new error from libinput printed in red at the top:
Code:
event5  - Apple Inc. Apple Internal Keyboard / Trackpad Touchpad: libinput bug: kernel fuzz of 40 but LIBINPUT_FUZZ_35 is missing
event5  - Apple Inc. Apple Internal Keyboard / Trackpad Touchpad: libinput bug: kernel fuzz of 27 but LIBINPUT_FUZZ_36 is missing
...that seems to be linked to udev, which is way beyond my small comfort zone, but it did make me think maybe it would work if I could solve the FUZZ issue.

I even wondered if maybe things had changed so that now ums will handle it, and I just need to configure it properly by enabling taps somewhere, which seems to be a thing with wsp and maybe atp too? But I can't find any information about that, and libinput list-devices shows all the tap settings as "n/a", I assume because the ums driver doesn't know how to deal with them.

It seems as though my trackpad is supported:
devinfo -f | grep ums
Code:
                  ums1 <Apple Inc. Apple Internal Keyboard / Trackpad, class 0/0, rev 2.00/2.24, addr 8> pnpinfo vendor=0x05ac product=0x025a devclass=0x00 devsubclass=0x00 devproto=0x00 sernum="" release=0x0224 mode=host intclass=0x03 intsubclass=0x01 intprotocol=0x02 at bus=2 hubaddr=3 port=2 devaddr=8 interface=2 ugen=ugen2.8
...and 0x025a appears in usbdevs at line 1218.

Anyway, that's my main stumbling block at the moment. I've got xfce running nicely and I've even created custom keyboard layouts for vt and X11 along with my own ~/.XCompose file to get around the fact that my CTRL key is broken (or just very, very dirty). If anyone can help me fix this last thing then suddenly it becomes a machine I could consider making a daily driver, and I will be eternally grateful.

Thanks,
Ben
This is bare metal or in a VM? I have had to do various things to get trackpads working in a VM on Mac. And was ultimately quite successful. Haven’t tried baremetal as I heard there are still challenges with apple silicon playing nice.
 
Before you stick it in loader.conf, you can just do kldload hms (or any module for that matter). Putting it in loader.conf just forces it to be loaded at boot time. Try loading it to see if that helps.
Well I can load it with kldload or put it in kldlist in rc.conf, but it doesn't seem to do anything that I can see. It still creates /dev/ums1 (no ums0, to my surprise).
 
This is bare metal or in a VM? I have had to do various things to get trackpads working in a VM on Mac. And was ultimately quite successful. Haven’t tried baremetal as I heard there are still challenges with apple silicon playing nice.
Bare metal. Interestingly I've never had any trouble at all with the trackpad in VirtualBox, or any other hardware issues. It's an Intel machine, so who knows what problems I'd be having on Apple Silicon!

And actually it's mostly pretty good. I gave up on the wi-fi card and got a dongle but other than that all the important stuff is working (for a limited definition of "important").
 
This is bare metal or in a VM? I have had to do various things to get trackpads working in a VM on Mac. And was ultimately quite successful. Haven’t tried baremetal as I heard there are still challenges with apple silicon playing nice.
If you need a module at boot time for the system to boot, then as I understand it must be in loader.conf. If it isn't needed until later on, then you can load it in rc.conf or manually as well via kldload. That is the only point I was trying to make. If loading it via kldload doesn't yield any change, then, that isn't the issue.
 
If you need a module at boot time for the system to boot, then as I understand it must be in loader.conf. If it isn't needed until later on, then you can load it in rc.conf or manually as well via kldload. That is the only point I was trying to make. If loading it via kldload doesn't yield any change, then, that isn't the issue.
Yea, that's pretty much my understanding of it.
 
You can disable ums loading by adding devmatch_blacklist="ums.ko" to /etc/rc.conf.
First of all, thanks to everyone for taking the time to help, and I'm sorry I have not had the time to reply before now.

bakul, thank you for your suggestion. I had been thinking along those lines, but I hadn't found a way to actually block the module, the best I could do was to disable /dev/ums1. Sadly, neither helps, at least not on its own: the pointer fails to move and libinput debug-events shows those LIBINPUT_FUZZ errors (in red).

More generally, I have the idea that some of the things I've done are conflicting with others. That is, maybe getting the trackpad to work with ums has taken me further from getting it to work with atp or wsp, so I thought I'd post more about the state of my system in the hopes that someone might spot my simple foolish error. In this configuration, the trackpad works for pointing and clicking, and nothing else.

Here's /boot/loader.conf:
Code:
kern.geom.label.disk_ident.enable="0"
kern.geom.label.gptid.enable="0"
zfs_load="YES"
#
#    Trackpad
#
hw.usb.usbhid.enable="0"
#wsp_load="YES"
#atp_load="YES"
#module_blacklist="ums"
#hint.ums.0.disabled="1"
#hint.ums.1.disabled="1"

Here's /etc/rc.conf:
Code:
hostname="chun"
keymap="philology.kbd"
wlans_rtwn0="wlan0"
ifconfig_wlan0="WPA  DHCP"
ifconfig_wlan0_ipv6="inet6 accept_rtadv"
sshd_enable="YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="AUTO"
zfs_enable="YES"
kld_list="i915kms fusefs hms asmc"
#kld_list="i915kms fusefs wsp hms hidmap"
ntpd_enable="YES"
ntpd_sync_on_start="YES"
apache24_enable="YES"
inetd_enable="YES"
php_fpm_enable="YES"
php_fpf_enable="YES"
cupsd_enable="YES"
#
#    Trackpad
#
#devmatch_blacklist="ums.ko"
#moused_nondefault_enable="NO"
#moused_port="wsp0"
#moused_enable="YES"

Here's /etc/sysctl.conf:
Code:
#
#  This file is read when going to multi-user and its contents piped thru
#  ``sysctl'' to adjust kernel values.  ``man 5 sysctl.conf'' for details.
#

# Uncomment this to prevent users from seeing information about processes that
# are being run under another UID.
#security.bsd.see_other_uids=0
vfs.zfs.vdev.min_auto_ashift=12
vfs.usermount=1
#dev.asmc.0.light.control=50

#
#    Trackpad
#
kern.evdev.rcpt_mask=12
kern.evdev.sysmouse_t_axis=3
#hw.usb.wsp.t_factor=1
#hw.usb.wsp.enable_single_tap_clicks=1

Here's the output of libinput debug-events:
Code:
-event0   DEVICE_ADDED                 System keyboard multiplexer       seat0 default group1  cap:k
-event1   DEVICE_ADDED                 System mouse                      seat0 default group2  cap:p left scroll-nat scroll-button
-event2   DEVICE_ADDED                 Control Method Lid Switch         seat0 default group3  cap:S
-event3   DEVICE_ADDED                 Power Button                      seat0 default group4  cap:k
-event4   DEVICE_ADDED                 Sleep Button                      seat0 default group5  cap:k
-event6   DEVICE_ADDED                 Apple Inc. Apple Internal Keyboard / Trackpad, class 0/0, rev 2.00/2.24, addr 8 seat0 default group6  cap:k
-event8   DEVICE_ADDED                 Apple Inc. Apple Internal Keyboard / Trackpad, class 0/0, rev 2.00/2.24, addr 8 seat0 default group7  cap:p left scroll-nat scroll-button
 event8   POINTER_MOTION               +0.000s     -0.30/  0.00 ( -1.00/ +0.00)
 event8   POINTER_MOTION            2  +0.008s     -1.77/  0.00 ( -2.00/ +0.00)
 event8   POINTER_MOTION            3  +0.016s     -2.00/  0.00 ( -2.00/ +0.00)
 event8   POINTER_MOTION            4  +0.024s     -3.00/  0.00 ( -3.00/ +0.00)
 event8   POINTER_BUTTON               +0.728s    BTN_LEFT (272) pressed, seat count: 1
 event8   POINTER_BUTTON               +0.840s    BTN_LEFT (272) released, seat count: 0
-event6   KEYBOARD_KEY                 +3.269s    KEY_RIGHTALT (100) pressed
 event6   KEYBOARD_KEY                 +3.342s    *** (-1) pressed

Output of kldstat
Code:
Id Refs Address                Size Name
 1  143 0xffffffff80200000  1f4daa0 kernel
 2    1 0xffffffff8214e000   620c10 zfs.ko
 3    1 0xffffffff84000000   210318 i915kms.ko
 4    2 0xffffffff84211000    8a190 drm.ko
 5    1 0xffffffff83fb0000     22b8 iic.ko
 6    2 0xffffffff83fb3000     4120 linuxkpi_video.ko
 7    3 0xffffffff83fb8000     7358 dmabuf.ko
 8    3 0xffffffff83fc0000     3378 lindebugfs.ko
 9    1 0xffffffff83fc4000     b480 ttm.ko
10    1 0xffffffff83fd0000    14958 fusefs.ko
11    1 0xffffffff83fe5000     21e8 hms.ko
12    1 0xffffffff83fe8000     30a8 hidmap.ko
13    1 0xffffffff8429c000    1c194 asmc.ko
14    1 0xffffffff83fec000     4250 ichsmb.ko
15    1 0xffffffff83ff1000     2178 smbus.ko
16    1 0xffffffff842b9000    32fa8 if_bwn.ko
17   14 0xffffffff842ec000    38060 bhnd.ko
18    2 0xffffffff83ff4000     6760 gpiobus.ko
19    4 0xffffffff84325000     b260 bhndb.ko
20    1 0xffffffff84331000     5540 bhndb_pci.ko
21    1 0xffffffff83ffb000     2300 bhnd_pci_hostb.ko
22    2 0xffffffff84337000     3244 bhnd_pci.ko
23    1 0xffffffff8433b000     21b0 bcma_bhndb.ko
24    1 0xffffffff8433e000     50c8 bcma.ko
25    1 0xffffffff84344000     2364 siba_bhndb.ko
26    1 0xffffffff84347000     60c8 siba.ko
27    1 0xffffffff8434e000     f017 if_rtwn_usb.ko
28    1 0xffffffff8435e000    1b140 rtwn.ko
29    1 0xffffffff8437a000     3360 uhid.ko
30    1 0xffffffff8437e000     4364 ums.ko
31    1 0xffffffff84383000     58c0 ng_ubt.ko
32    7 0xffffffff84389000     abb8 netgraph.ko
33    3 0xffffffff84394000     a330 ng_hci.ko
34    4 0xffffffff8439f000     2670 ng_bluetooth.ko
35    1 0xffffffff843a2000     48e0 atp.ko
36    1 0xffffffff843a7000     3360 wmt.ko
37    1 0xffffffff843ab000     4fe0 wsp.ko
38    1 0xffffffff843b0000     e4a8 ng_l2cap.ko
39    1 0xffffffff843bf000    1c0c8 ng_btsocket.ko
40    1 0xffffffff843dc000     3908 ng_socket.ko
41    1 0xffffffff843e0000     2a80 mac_ntpd.ko

Output of dmesg | grep ums
Code:
ums0 on uhub6
ums0: <vendor 0x05ac product 0x820b, class 0/0, rev 2.00/1.00, addr 6> on usbus2
ums0: 3 buttons and [XY] coordinates ID=2
ums1 on uhub5
ums1: <Apple Inc. Apple Internal Keyboard / Trackpad, class 0/0, rev 2.00/2.24, addr 8> on usbus2
ums1: 3 buttons and [XY] coordinates ID=2
ums0: at uhub6, port 2, addr 6 (disconnected)
ums0: detached

I'd really appreciate any suggestions!

Thanks,
Ben
 
I get the same "dmesg | grep ums" but 1) wsp_load="YES" in /boot/loader.conf & 2) adding moused_port="/dev/wsp0" to /etc/rc.conf solved the problem for me. This makes the pointer on console wiggle (without X).

I also have hint.ums.0.disabled="1" & hw.usb.usbhid.enable=0 in /boot/loader.conf. Not sure they are needed. I also have asmc_load="YES" there instead of in kld_list in /etc/rc.conf. In addition I have these in /etc/sysctl.conf (I don't recall now when or why I added them!):

hw.usb.wsp.enable_single_tap_clicks: 0
kern.evdev.rcpt_mask=3
hw.usb.wsp.enable_single_tap_clicks: 0
hw.usb.wsp.scr_hor_threshold: 20
hw.usb.wsp.pressure_tap_threshold: 120
hw.usb.wsp.pressure_untouch_threshold: 10
hw.usb.wsp.pressure_touch_threshold: 50
hw.usb.wsp.z_factor: 5
hw.usb.wsp.scale_factor: 12
hw.usb.wsp.debug: 1

dmidecode (from ports) shows mine is a MacBookPro9,2 machine.
 
I get the same "dmesg | grep ums" but 1) wsp_load="YES" in /boot/loader.conf & 2) adding moused_port="/dev/wsp0" to /etc/rc.conf solved the problem for me. This makes the pointer on console wiggle (without X).

I also have hint.ums.0.disabled="1" & hw.usb.usbhid.enable=0 in /boot/loader.conf. Not sure they are needed. I also have asmc_load="YES" there instead of in kld_list in /etc/rc.conf. In addition I have these in /etc/sysctl.conf (I don't recall now when or why I added them!):

hw.usb.wsp.enable_single_tap_clicks: 0
kern.evdev.rcpt_mask=3
hw.usb.wsp.enable_single_tap_clicks: 0
hw.usb.wsp.scr_hor_threshold: 20
hw.usb.wsp.pressure_tap_threshold: 120
hw.usb.wsp.pressure_untouch_threshold: 10
hw.usb.wsp.pressure_touch_threshold: 50
hw.usb.wsp.z_factor: 5
hw.usb.wsp.scale_factor: 12
hw.usb.wsp.debug: 1

dmidecode (from ports) shows mine is a MacBookPro9,2 machine.
Thank you, this looks really interesting. I get the wiggle as things are, with or without X running: are you getting taps and two-finger scrolling? Is the trackpad definitely attached to /dev/wsp*?

I'm going to try all this, thank you!
 
I get the same "dmesg | grep ums" but 1) wsp_load="YES" in /boot/loader.conf & 2) adding moused_port="/dev/wsp0" to /etc/rc.conf solved the problem for me. This makes the pointer on console wiggle (without X).

I also have hint.ums.0.disabled="1" & hw.usb.usbhid.enable=0 in /boot/loader.conf. Not sure they are needed. I also have asmc_load="YES" there instead of in kld_list in /etc/rc.conf. In addition I have these in /etc/sysctl.conf (I don't recall now when or why I added them!):

hw.usb.wsp.enable_single_tap_clicks: 0
kern.evdev.rcpt_mask=3
hw.usb.wsp.enable_single_tap_clicks: 0
hw.usb.wsp.scr_hor_threshold: 20
hw.usb.wsp.pressure_tap_threshold: 120
hw.usb.wsp.pressure_untouch_threshold: 10
hw.usb.wsp.pressure_touch_threshold: 50
hw.usb.wsp.z_factor: 5
hw.usb.wsp.scale_factor: 12
hw.usb.wsp.debug: 1

dmidecode (from ports) shows mine is a MacBookPro9,2 machine.
Well, I am almost prepared to marry you at this point. I had to make some small changes to make it work for me:
  • As well as setting moused_port in /etc/rc.conf I also had to set moused_enable="YES". Without that I got nothing.
  • I explicitly disabled ums1 as well as ums0 in /boot/loader.conf — for some reason my device was attaching there. I'm not actually sure if either of those was necessary, because...
  • I reinstated devmatch_blacklist="ums.ko" in /etc/rc.conf. I think that probably makes disabling individual ums nodes in loader.conf unnecessary, but it works as it is and I'm going to take a break before I start looking into that.
  • In /etc/sysctl.conf I set kern.evdev.rcpt_mask=12 instead of 3. This might be more thoughts and prayers than science, but I think the number does mean something and anyway it's working!
  • I also set hw.usb.wsp.enable_single_tap_clicks=1 because I want tap to click.
With those small changes to your suggestions, the mouse worked in the VT at boot, and libinput debug-events actually reacted to taps as well as clicks. Obviously they didn't do anything, but once I got into xfce4 I was able to enable tap-to-click in "Mouse and Touchpad" settings. Scrolling worked automatically, but in the "natural" direction, which seems unnatural to me, but that's just another setting. Oh and I can double-tap and drag, which makes me very happy.

In short, it's sorted. There are still some hardware issues — dodgy battery, dirty keyboard, those will cost me a little money to fix but a lot less than a new MBP, and having the trackpad working as I want means it's a viable work machine. I'm going to mark this as solved!

Thank you very much,
Ben
 
Oh, well, I don't seem to be able to mark it as solved, even though it is — either the edit window has closed, or I don't have the requisite status, or for some other reason up to and including stupidity on my part. But it is solved, to my satisfaction at least. Thank you all once again.
 
Back
Top