Solved Apple(R) Trackpads on FreeBSD.

Hello!
I recently installed FreeBSD 12.3-RELEASE (r371126 GENERIC) to my MacBook4,1, which is an A1181 (white polycarbonate) model.
The "ums" driver seems to make the trackpad "partially" work. The thing does move around the screen, the physical button clicks, but there's no scroll feature and more importantly, tap to click (and two-finger tap for right click) does not work.
I've searched the internet and read many documents on forums, realized that wsp and atp are two major(?) drivers for this, and it also seems like atp is now considered legacy and wsp is the new driver now.
The first issue I had faced was, that there was no package named "atp" or "wsp". Searching in /usr/ports (I have it installed) gives me none, and the pkg install wsp shows me that there's no such package, and pkg install atp shows me a package that removes the whole X11 system?

I saw news/atp package on ports so I thought that maybe the drivers are pre-packaged onto the kernel/os.
I modified the /boot/loader.conf and tried adding atp_load="YES" or wsp_load="YES", however, even after both attempts, dmesg showed no sign of atp or wsp and just used ums.

On Debian Linux (R), the touchpad works with a small X configuration file. ( External link : https://wolf1e.ga/posts/2021/02/how-to-install-debian-10-on-a-macbook-early-2008/ )

On the post, there is a small libinput conf file available that works on Debian Linux (R).
So, I installed the required packages mentioned by the post's author (With different names from Debian), and added this content to /etc/X11/xorg.conf.

Code:
---
Section "InputClass"
        Identifier "libinput touchpad catchall"
        MatchIsTouchpad "on"
        MatchDevicePath "/dev/input/event9"
        Driver "libinput"
        Option "Tapping" "on"
EndSection
---

However, that also did not work, and this is the /var/log/Xorg.0.log content which I believe is related.

Code:
---
[    43.846] (II) config/udev: Adding input device Touchpad (/dev/input/event9)
[    43.847] (**) Touchpad: Applying InputClass "evdev pointer catchall"
[    43.847] (**) Touchpad: Applying InputClass "libinput pointer catchall"
[    43.847] (**) Touchpad: Applying InputClass "libinput catchall"
[    43.847] (II) Using input driver 'libinput' for 'Touchpad'
[    43.847] (**) Touchpad: always reports core events
[    43.847] (**) Option "Device" "/dev/input/event9"
[    43.847] (**) Option "_source" "server/udev"
[    43.848] (II) event9  - Touchpad: is tagged by udev as: Mouse
[    43.849] (II) event9  - Touchpad: device is a pointer
[    43.849] (II) event9  - Touchpad: device removed
[    43.849] (**) Option "config_info" "udev:/dev/input/event9"
[    43.849] (II) XINPUT: Adding extended input device "Touchpad" (type: MOUSE, id 14)
---

Thus, I want to ask, what is the correct method to do this.

I'm very new to the FreeBSD operating system, so I'm sorry if I forgot something important.
I'm currently running the Common Desktop Environment with dtlogin, which I installed with the help of a FreeBSD Forum post : https://forums.freebsd.org/threads/setting-up-common-desktop-environment-for-modern-use.69475/

Best regards,
HexagonWin
 
… wsp …

There's a manual page, wsp(4)

… 12.3-RELEASE (r371126 GENERIC) …

… for that version of the operating system:
… new to the FreeBSD operating system, …

Hints

FreeBSD+12.3-RELEASE within the URL above results in pre-selection of a specific menu option:

1640327986466.png


With what's pictured above:
  1. it's certain that the driver is integral to this version (12.3-RELEASE) of FreeBSD – addition of a driver, from the collection of ports for FreeBSD, is not required
  2. there's direction on how to compile into the kernel – you can ignore this, because your kernel is GENERIC
  3. there's direction on what to write into a file
  4. there's a link to the 12.3-RELEASE -specific manual page for loader.conf(5)
<https://www.freebsd.org/cgi/man.cgi...tion=5&apropos=0&manpath=FreeBSD+12.3-RELEASE>

The masses of information in manual pages, also known as man pages, may be overwhelming for a newcomer.



Essentially:
  • you should attempt to load a module at boot time only if (for example) later loading of the module is a problem to you
  • in some cases, using /boot/loader.conf to load a module will worsen the situation, might make the OS unusable.
… running the Common Desktop Environment with dtlogin, …

You're not likely to require use of the pad before login to CDE. This is a good example of later loading. You might safely remove atp_load="YES" and wsp_load="YES" from your loader.conf.



Suggestions

Try 13.0-RELEASE instead of 12.3-RELEASE. Either:
  • simply start afresh, if you have not already invested too much in 12.3; or
  • use the upgrade command of freebsd-update(8) – if you're a user or former user of Mac OS X, part of what occurs might be horribly alien; be prepared to seek advice in advance.
References

<https://everymac.com/ultimate-mac-lookup/?search_keywords=MacBook4,1>
  • three 2008 models.
HW probe of Apple MacBook4,1 #539b95f535 (2021-01-19)
<https://www.freebsd.org/cgi/man.cgi?query=ukbd&sektion=4&manpath=FreeBSD+12.3-RELEASE>

FreeBSD 13.0-RELEASE Release Notes | The FreeBSD Project

… new usbhid(4) driver …
 
Last edited:
Hello!
First, sorry for the late reply.
The reason for me switching to FreeBSD 12.3-RELEASE was because FreeBSD 13 was causing issues on apple's bootloader.
There is a "OpenCore Legacy Patcher" Opencore bootloader which basically is another bootloader. When FreeBSD 13 is loaded inside this bootloader (Or the rEFInd chainloaded inside the "OCLP") FreeBSD 13 boots and works fine, but the fonts on the tty gets huge.
However, since OCLP was basically for running later Mac OS X versions, as I stopped using Mac OS X, I cleared my drive and tried to setup a multi-boot of FreeBSD and "Devuan GNU/Linux chimaera".
And, without that OCLP, FreeBSD 13 did not work, so I installed FreeBSD 12.
(Additionally, on my previous FreeBSD 13 installation, I had a Broadcom BCM4320 wlan card so I needed to compile a custom kernel to include Broadcom's GPL drivers, but now I switched to a intel wireless card instead that just works with GENERIC kernel plus the firmware package which I forgot the name)

To answer about the FreeBSD's manpages about "wsp(4)", I actually read it before, and I can see that by typing man wsp on my freebsd installation, it actually loads that man page fine.
I did try adding wsp_load="YES" to the /boot/loader.conf which did not work. May I ask how to load the module after boot? You're right, I do not need the trackpad to function on dtlogin.

(P.S. : I do have "some" experience using Linux distributions for some years, and some random *nix systems, so I'm not really unfamiliar with modifying text files and reading man pages but I do not know FreeBSD systems well. Sorry!)

Thanks! :D
 
By the way, I'm unsure if my trackpad is supported on wsp (although both drivers didn't work yet), since I heard that atp is for the older trackpads and wsp is for the newer one.
I do not actually know the method of properly listing my usb devices, is lsusb correct?
This is the lsusb result.

---
root@mincrad-pckr:~ # lsusb
Protocol spec without prior Class and Subclass spec at line 23179
Bus /dev/usb Device /dev/ugen5.3: ID 05ac:0229 Apple, Inc. Internal Keyboard/Trackpad (ANSI)
Bus /dev/usb Device /dev/ugen0.3: ID 045e:074f Microsoft Corp.
Bus /dev/usb Device /dev/ugen5.2: ID 05ac:8242 Apple, Inc. Built-in IR Receiver
Bus /dev/usb Device /dev/ugen0.2: ID 05ac:1000 Apple, Inc. Bluetooth HCI MacBookPro (HID mode)
Bus /dev/usb Device /dev/ugen6.2: ID 05ac:8300 Apple, Inc. Built-in iSight (no firmware loaded)
Bus /dev/usb Device /dev/ugen0.1: ID 0000:0000
Bus /dev/usb Device /dev/ugen1.1: ID 0000:0000
Bus /dev/usb Device /dev/ugen2.1: ID 0000:0000
Bus /dev/usb Device /dev/ugen4.1: ID 0000:0000
Bus /dev/usb Device /dev/ugen5.1: ID 0000:0000
Bus /dev/usb Device /dev/ugen6.1: ID 0000:0000
Bus /dev/usb Device /dev/ugen3.1: ID 0000:0000
---
What I believe is that maybe this thing is with this id 05ac:0229 which is not the 05ac-022a originally referred by grahamperrin, maybe this is a different trackpad unsupported by this OS?
Additionally, there is no /dev/wsp0 or any wsp named device, and dmesg | grep wsp gives me nothing, I can see this as wsp not working? Or should I see any other logs? (Perhaps, is there a method to list the modules currently loaded?)
Thanks.
 
By the way, I'm unsure if my trackpad is supported on wsp (although both drivers didn't work yet), since I heard that atp is for the older trackpads and wsp is for the newer one.

I'm not 100% sure, but looking at usbdevs it could be that your product id is not supported (or just missing from the list of known devices).

For comparison, I have a MacbookAir Early-2015 model running FreeBSD 12.3-STABLE, and here are my attached Apple (0x05ac) USB devices;

devinfo -v | grep 0x05ac
Code:
ukbd0 pnpinfo vendor=0x05ac product=0x0291 devclass=0x00 devsubclass=0x00 devproto=0x00 sernum="FM751830V5UG6LMA9F3" release=0x0171 mode=host intclass=0x03 intsubclass=0x01 intprotocol=0x01 at bus=0 hubaddr=1 port=5 devaddr=4 interface=1 ugen=ugen0.4
wsp0 pnpinfo vendor=0x05ac product=0x0291 devclass=0x00 devsubclass=0x00 devproto=0x00 sernum="FM751830V5UG6LMA9F3" release=0x0171 mode=host intclass=0x03 intsubclass=0x01 intprotocol=0x02 at bus=0 hubaddr=1 port=5 devaddr=4 interface=2 ugen=ugen0.4
umass0 pnpinfo vendor=0x05ac product=0x8406 devclass=0x00 devsubclass=0x00 devproto=0x00 sernum="000000000820" release=0x0820 mode=host intclass=0x08 intsubclass=0x06 intprotocol=0x50 at bus=0 hubaddr=1 port=14 devaddr=5 interface=0 ugen=ugen0.5

Note that my keyboard/trackpad is displayed with a ProductID of 0x0291, which can be found in the usbdevs;
product APPLE WELLSPRING8_ISO 0x0291 Apple Internal Keyboard/Trackpad

I also have the following in /boot/loader.conf
wsp_load="YES"


Edit: Found your Product Id listed here;
https://usb-ids.gowdy.us/read/UD/05ac/0229

If you are feeling adventurous, you could try grabbing the FreeBSD 12.3-RELEASE sources, adding your product id to /usr/src/sys/dev/usb/usbdevs, and /usr/src/sys/dev/usb/input/wsp.c. Then rebuild + reinstall the kernel, and check to see if the device then gets detected at boot! :)
 
… maybe this thing is with this id 05ac:0229 which is not the 05ac-022a …

Good point.

<https://bsd-hardware.info/?probe=539b95f535> has just one line for Internal Keyboard/Trackpad.

<https://bsd-hardware.info/?probe=539b95f535&log=usbconfig> includes:

Code:
ugen5.3: <Apple Computer Apple Internal Keyboard / Trackpad> at usbus5, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (40mA)
ugen5.3.0: ukbd1: <Apple Internal Keyboard>
ugen5.3.1: ums1: <Touchpad>
ugen5.3.2: uhid1: <Apple Internal Keyboard>

That's ums(4) <https://www.freebsd.org/cgi/man.cgi?query=ums&sektion=4&manpath=FreeBSD+12.3-RELEASE>.
 
Code:
Bus /dev/usb Device /dev/ugen5.3: ID 05ac:0229 Apple, Inc. Internal Keyboard/Trackpad (ANSI)

This shows that the generic usb driver attached to the trackpad, and not wsp.
To list usb devices in FreeBSD, we usually use usbconfig().

To see whether the wsp driver is loaded into the running kernel, try kldstat -v | grep wsp .

If you are feeling adventurous, you could try grabbing the FreeBSD 12.3-RELEASE sources, adding your product id to /usr/src/sys/dev/usb/usbdevs, and /usr/src/sys/dev/usb/input/wsp.c. Then rebuild + reinstall the kernel, and check to see if the device then gets detected at boot!
This is probably the way to go, although I would search in bugs.freebsd.org for "apple" or "trackpad" first.
 
Hello.
First, sorry for the late reply.
I realized with the kldstat command, that when I have the loader.conf's wsp option enabled, it loads *both* wsp and atp, but does not create /dev/atp* or /dev/wsp*.
When I put the atp_load option in loader.conf (without the wsp option), only atp gets loaded, and /dev/atp0 is created. However, the trackpad is not functioning at all.

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

additionally, devinfo with atp grep returns this.

root@mincrad-pckr:/dev # devinfo -v | grep atp
atp0 pnpinfo vendor=0x05ac product=0x0229 devclass=0x00 devsubclass=0x00 devproto=0x00 sernum="" release=0x0007 mode=host intclass=0x03 intsubclass=0x01 intprotocol=0x02 at bus=5 hubaddr=1 port=2 devaddr=3 interface=1 ugen=ugen5.3

but I'm not sure what something has to do with this...
anyway, Thanks :D
 
I just found something weird : The touchpad actually works, but it stopps working right as the thing launches dtlogin (CDE login manager).
The trackpad can move the cursor while on the boot process, with logs appearing on screen. I see logs about atp0 trackpad too.
Maybe can I see some X logs to see what's going on? Or try installing alternate X session (ex: XDM + twm)?
Thanks!
 
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.
 
Back
Top