NoaHimesaka1873 / linux-t2-arch

Kernel for T2 Macs - Under New Management!
GNU General Public License v3.0
46 stars 10 forks source link

tiny-dfr Fails to Initialize Touch Bar After Suspend #65

Closed blakewenzel closed 3 months ago

blakewenzel commented 4 months ago

Bug Report: tiny-dfr Fails to Initialize Touch Bar After Suspend

System Information:

Problem Description: tiny-dfr fails to initialize the Touch Bar correctly after resuming from suspend. This issue does not occur after a fresh boot, only after suspend/resume.

After suspending and resuming, there were also other problems until I added the suspend-fix-t2.service file recommended by t2linux.org:

[Unit]
Description=Disable and Re-Enable Apple BCE Module (and Wi-Fi)
Before=sleep.target
StopWhenUnneeded=yes

[Service]
User=root
Type=oneshot
RemainAfterExit=yes

ExecStart=/usr/bin/modprobe -r brcmfmac_wcc
ExecStart=/usr/bin/modprobe -r brcmfmac
ExecStart=/usr/bin/rmmod -f apple-bce

ExecStop=/usr/bin/modprobe apple-bce
ExecStop=/usr/bin/modprobe brcmfmac
ExecStop=/usr/bin/modprobe brcmfmac_wcc

[Install]
WantedBy=sleep.target

After adding that, everything else works, but trying to start tiny-dfr after resume still reports no touchbar device found:

$ /usr/bin/tiny-dfr
thread 'main' panicked at src/main.rs:381:43:
called `Result::unwrap()` on an `Err` value: No touchbar device found
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

lsusb reports that the device is still present after resuming:

$ lsusb | grep Apple
Bus 001 Device 002: ID 05ac:8233 Apple, Inc. iBridge
Bus 001 Device 003: ID 05ac:8514 Apple, Inc. FaceTime HD Camera (Built-in)
Bus 001 Device 004: ID 05ac:8262 Apple, Inc. Ambient Light Sensor
Bus 001 Device 005: ID 05ac:8103 Apple, Inc. Headset
Bus 001 Device 006: ID 05ac:027c Apple, Inc. Apple Internal Keyboard / Trackpad
Bus 001 Device 007: ID 05ac:8302 Apple, Inc. Touch Bar Display
Bus 001 Device 008: ID 05ac:8102 Apple, Inc. Touch Bar Backlight

dmesg after resume:

$ sudo dmesg | grep -i touch
[    2.643924] usb 1-6: Product: Touch Bar Display
[    2.924444] usb 1-7: Product: Touch Bar Backlight
[    3.512264] hid-appletb-bl 0003:05AC:8102.000A: : USB HID v1.01 Device [Apple Inc. Touch Bar Backlight] on usb-bce-vhci-7/input0
[   19.159672] input: Apple Inc. Touch Bar Display Touchpad as /devices/pci0000:00/0000:00:1b.0/0000:02:00.1/apple-bce/apple-bce/bce-vhci/usb1/1-6/1-6:2.0/0003:05AC:8302.000D/input/input12
[   19.159751] hid-multitouch 0003:05AC:8302.000D: input,hiddev102,hidraw9: USB HID v1.01 Device [Apple Inc. Touch Bar Display] on usb-bce-vhci-6/input0
[  186.032956] usb 1-6: Product: Touch Bar Display
[  186.042521] input: Apple Inc. Touch Bar Display as /devices/pci0000:00/0000:00:1b.0/0000:02:00.1/apple-bce/apple-bce/bce-vhci/usb1/1-6/1-6:1.0/0003:05AC:8302.0015/input/input25
[  186.098705] hid-appletb-kbd 0003:05AC:8302.0015: input: USB HID v1.01 Keyboard [Apple Inc. Touch Bar Display] on usb-bce-vhci-6/input0
[  186.383927] usb 1-7: Product: Touch Bar Backlight
[  186.394789] hid-appletb-bl 0003:05AC:8102.0016: : USB HID v1.01 Device [Apple Inc. Touch Bar Backlight] on usb-bce-vhci-7/input0

modules_after_suspend.txt

I also built the most recent tiny-dfr from github, but it reported the same no touchbard device found error.

I saw that some users were also unloading the touchbar module before suspending, but since this is built into the linux-t2-arch kernel I wasn't able to try this.

NoaHimesaka1873 commented 3 months ago

WONTFIX for now, also you can unload the module whether or not it's built into the kernel.

ayr-ton commented 2 weeks ago

It's also happening to me. Tried unloading and reloading the modules like:

#ExecStart=/usr/bin/modprobe -r brcmfmac_wcc
#ExecStart=/usr/bin/modprobe -r brcmfmac
ExecStart=/usr/bin/systemctl stop tiny-dfr
ExecStart=/usr/bin/rmmod -f hid-appletb-bl
ExecStart=/usr/bin/rmmod -f hid-appletb-kbd
ExecStart=/usr/bin/rmmod -f hid-multitouch 
ExecStart=/usr/bin/rmmod -f apple-bce

ExecStop=/usr/bin/modprobe apple-bce
ExecStop=/usr/bin/modprobe hid-appletb-bl
ExecStop=/usr/bin/modprobe hid-appletb-kbd
ExecStop=/usr/bin/modprobe hid-multitouch 
ExecStop=/usr/bin/systemctl start tiny-dfr
#ExecStop=/usr/bin/modprobe brcmfmac
#ExecStop=/usr/bin/modprobe brcmfmac_wcc

The after suspend issue kept happening so I disabled suspend for now.

@blakewenzel Do you keep experiencing this issue or did you find a fix?

blakewenzel commented 1 week ago

@ayr-ton I was still having the issue and didn't have success with unloading/reloading modules after trying every combination. I eventually went back to just using Arch on my desktop pc.

ayr-ton commented 1 week ago

I'm using MacBookPro16,2:

OS: Arch Linux x86_64
Host: MacBookPro16,2 (1.0)
Kernel: Linux 6.11.3-arch1-Adashima-T2-1-t2
Shell: zsh 5.9
Display (Color LCD): 2560x1600 @ 60 Hz (as 1462x914) in 13" [Built-in]
DE: KDE Plasma 6.2.2
WM: KWin (Wayland)

@blakewenzel In my case I disabled sleep via /etc/systemd/sleep.conf @NoaHimesaka1873 Do you recommend other paths for debugging this? From the behavior I'm seeing, after resuming from sleeping, the default touchbar seems to start before tiny-dfr and then it gets frozen. Without tiny-dfr the same behavior is happening. Different combinations of modprobe -r/rmmod -f and then modprobing them all after sleep is not helping.