On my Paper Pro Move running 3.26.0.68, my NuPhy Air 60 V2 keyboard (and another cheapo keyboard) would basically never reconnect. After reading RPi-Distro/pi-bluetooth#8 (comment), I replaced the systemctl restart bluetooth on line 30 of bt-keyboard.sh with:
systemctl stop bluetooth && \
systemctl start sys-subsystem-bluetooth-devices-hci0.device && \
hciconfig hci0 down && \
systemctl start bluetooth
This appears to have improved the issue, but chaining those commands together like that is a bit hacky in a script of this nature. There's probably a better way to address the root cause, since it still doesn't reconnect consistently. When turning on the keyboard after waking from sleep, I'll see the keyboard briefly indicate it's connected and then it will go back to disconnected, and when it's trying to reconnect, my PPM will reboot.
Running the unmodified script from the command line, I see:
root@imx93-chiappa:~/.movewriter# ./bt-keyboard.sh
No default controller available
Changing power on succeeded
Changing F2:35:67:8E:B9:CA trust succeeded
hci0 new_settings: powered bondable ssp br/edr le secure-conn cis-central cis-peripheral
[NuPhy Air60 V2-1]# agent NoInputNoOutput
Failed to register agent object
[NuPhy Air60 V2-1]# default-agent
No agent is registered
[NuPhy Air60 V2-1]# pair F2:35:67:8E:B9:CA
Attempting to pair with F2:35:67:8E:B9:CA
[NuPhy Air60 V2-1]# Changing F2:35:67:8E:B9:CA trust succeeded
Waiting to connect to bluetoothd...[bluetooth]# agent NoInputNoOutput
Failed to register agent object
[bluetooth]# default-agent
No agent is registered
[bluetooth]# pair F2:35:67:8E:B9:CA
Attempting to pair with F2:35:67:8E:B9:CA
[bluetooth]# Agent registered
[bluetooth]# Changing F2:35:67:8E:B9:CA trust succeeded
Waiting to connect to bluetoothd...[bluetooth]# hci0 new_settings: powered bondable ssp br/edr le secure-conn cis-central cis-peripheral
[bluetooth]# agent NoInputNoOutput
Failed to register agent object
[bluetooth]# default-agent
No agent is registered
[bluetooth]# pair F2:35:67:8E:B9:CA
Attempting to pair with F2:35:67:8E:B9:CA
[bluetooth]# Changing F2:35:67:8E:B9:CA trust succeeded
Waiting to connect to bluetoothd...[bluetooth]# hci0 new_settings: powered bondable ssp br/edr le secure-conn cis-central cis-peripheral
[bluetooth]# agent NoInputNoOutput
Failed to register agent object
[bluetooth]# default-agent
No agent is registered
[bluetooth]# pair F2:35:67:8E:B9:CA
Attempting to pair with F2:35:67:8E:B9:CA
[bluetooth]# Agent registered
[bluetooth]# [CHG] Controller 24:FD:FA:14:4B:D4 Pairable: yes
[bluetooth]# Changing F2:35:67:8E:B9:CA trust succeeded
Waiting to connect to bluetoothd...[bluetooth]# agent NoInputNoOutput
Failed to register agent object
[bluetooth]# default-agent
No agent is registered
[bluetooth]# pair F2:35:67:8E:B9:CA
Attempting to pair with F2:35:67:8E:B9:CA
[bluetooth]# hci0 new_settings: powered bondable ssp br/edr le secure-conn cis-central cis-peripheral
[bluetooth]# Changing F2:35:67:8E:B9:CA trust succeeded
At the beginning, the keyboard is briefly connected, but then the rest of the script's logic breaks the connection, and it never reconnects. Aborting the script and running hciconfig hci0 down && systemctl start bluetooth immediately reconnects the keyboard.
Hopefully someone with more knowledge of BT on Linux can assess the best fix for MoveWriter. I think maybe the script needs some upfront logic to check the current state.
On my Paper Pro Move running 3.26.0.68, my NuPhy Air 60 V2 keyboard (and another cheapo keyboard) would basically never reconnect. After reading RPi-Distro/pi-bluetooth#8 (comment), I replaced the
systemctl restart bluetoothon line 30 of bt-keyboard.sh with:This appears to have improved the issue, but chaining those commands together like that is a bit hacky in a script of this nature. There's probably a better way to address the root cause, since it still doesn't reconnect consistently. When turning on the keyboard after waking from sleep, I'll see the keyboard briefly indicate it's connected and then it will go back to disconnected, and when it's trying to reconnect, my PPM will reboot.
Running the unmodified script from the command line, I see:
At the beginning, the keyboard is briefly connected, but then the rest of the script's logic breaks the connection, and it never reconnects. Aborting the script and running
hciconfig hci0 down && systemctl start bluetoothimmediately reconnects the keyboard.Hopefully someone with more knowledge of BT on Linux can assess the best fix for MoveWriter. I think maybe the script needs some upfront logic to check the current state.