Reputation: 31
We're dealing with an issue related to Bluez supervision_timeout value of 42 on a BLE connection. After following Excessive Bluetooth LE timeouts on Linux? and increasing the supervision_timeout to 200, we've found a significant decrease in BLE connection timeouts.
Here's the issue: We are creating our own Archiso ISO on the computers but cannot write to /sys/kernel/debug/bluetooth/hci0/supervision_timeout during chroot as the /sys/kernel directory does not exist at the time.
If the file does get updated when the computer starts (manually writing to file using nvim as root), the file goes back to the value of 42 on computer restart.
So I've got a couple possibilities, but unsure how to perform them.
During Archiso installation, make the supervision_timeout file be 200 instead of 42 (though we can't just copy a file during the chroot process as again, /sys/kernel/.../ directory isn't there at that point). Is this file something that is created from Bluez stack itself? I've been looking for documentation but can't find anything other than Bluez source files that define this number for supervision_timeout.
Write to the file every time the computer starts. However, I cannot perform this operation in the .xinitrc file as only the root user has access to /sys/kernel/debug/ directory.
Upvotes: 1
Views: 795
Reputation: 31
Posting this to hopefully help someone else (and, admittedly, myself in case I forget as I cannot find the below forum topic from a Google search anymore).
See https://bbs.archlinux.org/viewtopic.php?id=279872
So, following V1del's advice I can successfully update the BLE connection parameter (supervision_timeout) on startup of the computer.
I needed to change the systemd file a little bit as follows:
[Unit] Description=Switching supervision timeout Requires=bluetooth.service After=bluetooth.service sys-kernel-debug.mount [Service] Type=oneshot RemainAfterExit=yes ExecStart=/bin/sh -c "sleep 5; echo 200 > /sys/kernel/debug/bluetooth/hci0/supervision_timeout" [Install] WantedBy=multi-user.target
I found that I needed to wait for the /sys/debug/ filesystem to be mounted, so needed to add sys-kernel-debug.mount to the After declaration.
Note that the sleep in ExecStart is necessary as Bluetooth is not started yet.
Upvotes: 2