Linuxの起動時にBluetoothデバイス(ゲームパッドなど)に自動接続するsystemd Unitです。
デバイスは事前にbluetoothctlでペアリングしておく必要あり。
<MAC_ADDRESS>
は接続先BluetoothデバイスのMACアドレス(例:AB:CD:EF:12:34:56
)に置き換えてください。
Created
March 13, 2022 14:09
-
-
Save tana/6539197cbe0a3658bb8ac67140a780b9 to your computer and use it in GitHub Desktop.
systemdを使ってBluetoothデバイスに自動接続する
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Bluetooth Device Auto-connect | |
After=bluetooth.service | |
Requires=bluetooth.service | |
[Service] | |
Type=simple | |
RemainAfterExit=yes | |
ExecStart=/usr/bin/bluetoothctl -- connect D4:F0:57:67:DA:72 | |
ExecStop=/usr/bin/bluetoothctl -- disconnect D4:F0:57:67:DA:72 | |
# Retry until connection succeeds | |
Restart=on-failure | |
StartLimitIntervalSec=0 | |
[Install] | |
WantedBy=multi-user.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment