0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

T2 Macにおけるサスペンド復帰後のTouch Bar(Fnキー)とキーボードバックライトの修正

0
Last updated at Posted at 2026-03-06

T2チップ搭載Macにおいて、サスペンド(スリープ)から復帰した際にTouch Bar(Tiny-DFR)が真っ暗なままになったり、キーボードバックライトが点灯しなかったりする一般的な問題を解決するためのsystemdサービススクリプトを作成しました。

このスクリプトの主な特徴

ハードウェアの完全なリセット: サスペンド処理中に apple-bce、appletbdrm、および関連するHIDモジュールを強制的にリセットし、復帰時にクリーンな状態にすることを保証します。

プロセスの管理: サスペンド前に tiny-dfr プロセスを終了させ、復帰後に再起動させることで、プロセスのフリーズや通信の停止を防ぎます。

バックライトの復元: sysfs 経由でキーボードバックライトを手動で点灯させ、さらに upower を再起動することで輝度調整キー(F1/F2など)のレスポンスを正常に戻します。

BCEの安定化: 私のマシンでは、ハードウェアを正常に起こすために apple-bce モジュールの再初期化が不可欠であることを突き止め、それを明示的に処理しています。

Wi-Fiに関する注意: brcmfmac のリセットに関する行をコメントアウト状態で含めています。私自身はWi-Fiの修正についてはテストしていませんが、復帰後にWi-Fiが切断される問題がある方のために用意しています。

suspend-fix-t2.service
[Unit]
Description=T2 Linux Full Hardware Reset (BCE/DRM/TouchBar/KBD_BL)
Before=sleep.target
StopWhenUnneeded=yes

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

# --- サスペンド前:モジュールとプロセスのクリーンアップ ---
# Wi-Fiモジュールのリセット (オプション/未検証)
#ExecStart=-/usr/bin/modprobe -r brcmfmac_wcc
#ExecStart=-/usr/bin/modprobe -r brcmfmac

# tiny-dfrを強制停止し、T2関連モジュールをアンロードする
ExecStart=-/usr/bin/systemctl stop tiny-dfr.service
ExecStart=-/usr/bin/pkill -9 tiny-dfr
ExecStart=-/usr/bin/rmmod appletbdrm
ExecStart=-/usr/bin/rmmod hid_appletb_kbd
ExecStart=-/usr/bin/rmmod hid_appletb_bl
# 重要:BCEブリッジのリセット
ExecStart=-/usr/bin/rmmod -f apple-bce

# --- 復帰時:スタックの再構築 ---
ExecStop=/usr/bin/modprobe apple-bce
ExecStop=/usr/bin/sleep 2
# Wi-Fiの復元 (オプション/未検証)
#ExecStop=/usr/bin/modprobe brcmfmac
#ExecStop=/usr/bin/modprobe brcmfmac_wcc

ExecStop=/usr/bin/modprobe hid_appletb_bl
ExecStop=/usr/bin/modprobe hid_appletb_kbd
ExecStop=/usr/bin/modprobe appletbdrm
ExecStop=/usr/bin/sleep 2

# --- 復帰後:最終仕上げ ---
ExecStopPost=/usr/bin/systemctl reset-failed tiny-dfr.service
ExecStopPost=/usr/bin/systemctl restart tiny-dfr.service
# キーボードバックライトを強制点灯(必要に応じて輝度値255を調整してください)
ExecStopPost=/usr/bin/sh -c "/usr/bin/echo 255 | /usr/bin/tee /sys/class/leds/apple::kbd_backlight/brightness"
# UPowerを再起動して輝度調整の反応を直す
ExecStopPost=/usr/bin/systemctl restart upower

[Install]
WantedBy=sleep.target

使い方

1.上記のコードを /etc/systemd/system/suspend-fix-t2.service に保存します。
2.sudo systemctl daemon-reload を実行します。
3.sudo systemctl enable suspend-fix-t2.service を実行して有効化します。
4.MacBookをサスペンドさせてテストします。

参考

https://www.reddit.com/r/linux_on_mac/comments/1qu2ct9/fixing_sleepresume_on_t2_macs/#:~:text=Fixing%20Sleep/Resume%20on%20T2%20Macs.

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?