ValveSoftware / SteamOS

SteamOS community tracker
1.58k stars 70 forks source link

3rd party PS4 Bluetooth controller does not reconnect automatically #992

Open SaltyBet opened 1 year ago

SaltyBet commented 1 year ago

Your system information

Please describe your issue in as much detail as possible:

On Steam Deck.

3rd party PS4 Bluetooth controller, initial pairing/connection flawless, but does not reconnect automatically.

If you go to Bluetooth paired devices list and select it, it connects just fine.

Device details:

(deck@steamdeck ~)$ bluetoothctl info 8E:21:F8:57:49:CB
Device 8E:21:F8:57:49:CB (public)
        Name: Wireless Controller
        Alias: Wireless Controller
        Class: 0x00002508
        Icon: input-gaming
        Paired: yes
        Trusted: yes
        Blocked: no
        Connected: yes
        WakeAllowed: yes
        LegacyPairing: no
        UUID: Human Interface Device... (00001124-0000-1000-8000-00805f9b34fb)
        UUID: PnP Information           (00001200-0000-1000-8000-00805f9b34fb)
        Modalias: usb:v054Cp05C4d0100

Also tested an Xbox One controller and that one reconnects successfully.

Steps for reproducing this issue:

  1. Press SHARE+HOME on controller.
  2. Select controller in Bluetooth available devices list.
  3. Controller pairs/connects successfully.
  4. Reboot Steam Deck.
  5. Press SHARE+HOME on controller.
  6. Controller does not reconnect automatically.
  7. Select controller in Bluetooth paired devices list.
  8. Controller connects successfully.
SaltyBet commented 1 year ago

Also tested pressing only HOME, the controller gets highlighted in white on the Bluetooth paired devices list, so it seems to be detected, but then it gets grayed out a few seconds later.

SaltyBet commented 1 year ago

Desktop BT fail

SaltyBet commented 1 year ago

Before connecting:

(deck@steamdeck ~)$ sudo dmesg|grep "BLUETOOTH HID.*Controller"
[   96.631724] sony 0005:054C:05C4.0008: input,hidraw6: BLUETOOTH HID v81.00 Gamepad [Wireless Controller] on 14:d4:24:09:6e:4a
[ 5666.675876] hid-generic 0005:045E:0B20.000A: input,hidraw6: BLUETOOTH HID v5.15 Gamepad [Xbox Wireless Controller] on 14:d4:24:09:6e:4a

After connecting:

(deck@steamdeck ~)$ sudo dmesg|grep "BLUETOOTH HID.*Controller"
[   96.631724] sony 0005:054C:05C4.0008: input,hidraw6: BLUETOOTH HID v81.00 Gamepad [Wireless Controller] on 14:d4:24:09:6e:4a
[ 5666.675876] hid-generic 0005:045E:0B20.000A: input,hidraw6: BLUETOOTH HID v5.15 Gamepad [Xbox Wireless Controller] on 14:d4:24:09:6e:4a
[ 6653.535981] sony 0005:054C:05C4.000B: input,hidraw7: BLUETOOTH HID v81.00 Gamepad [Wireless Controller] on 14:d4:24:09:6e:4a
SaltyBet commented 1 year ago
[ 6653.514328] sony 0005:054C:05C4.000B: unknown main item tag 0x0
[ 6653.534603] input: Wireless Controller Touchpad as /devices/pci0000:00/0000:00:08.1/0000:04:00.4/usb3/3-5/3-5:1.0/bluetooth/hci0/hci0:8/0005:054C:05C4.000B/input/input40
[ 6653.534930] input: Wireless Controller Motion Sensors as /devices/pci0000:00/0000:00:08.1/0000:04:00.4/usb3/3-5/3-5:1.0/bluetooth/hci0/hci0:8/0005:054C:05C4.000B/input/input41
[ 6653.535410] input: Wireless Controller as /devices/pci0000:00/0000:00:08.1/0000:04:00.4/usb3/3-5/3-5:1.0/bluetooth/hci0/hci0:8/0005:054C:05C4.000B/input/input39
[ 6653.535981] sony 0005:054C:05C4.000B: input,hidraw7: BLUETOOTH HID v81.00 Gamepad [Wireless Controller] on 14:d4:24:09:6e:4a
SaltyBet commented 1 year ago

Press HOME, then:

[BT 5.0 KB ]# connect 8E:21:F8:57:49:CB
Attempting to connect to 8E:21:F8:57:49:CB
Failed to connect: org.bluez.Error.Failed br-connection-create-socket
[CHG] Device 8E:21:F8:57:49:CB Connected: no

Press SHARE+HOME, then:

[BT 5.0 KB ]# connect 8E:21:F8:57:49:CB
Attempting to connect to 8E:21:F8:57:49:CB
[CHG] Device 8E:21:F8:57:49:CB Connected: yes
Connection successful
[CHG] Device 8E:21:F8:57:49:CB ServicesResolved: yes
TTimo commented 1 year ago

Is this only observed on SteamOS? This doesn't seem particularly SteamOS specific. Similar to https://github.com/ValveSoftware/steam-for-linux/issues/9253 ? (@kisak-valve - move to other tracker?)

kisak-valve commented 1 year ago

Re-reading this issue report, this doesn't really read like a Steam client issue to me and leans more towards a general kernel or bluetooth stack issue.

Zin4uk commented 1 year ago

Have the same story as the author: steam deck, ps4 controller, org.bluez.Error.Failed br-connection-create-socket error in logs. Getting connection for a second and then disconnecting: ... Connected: yes Failed to connect: org.bluez.Error.Failed br-connection-create-socket ... Connected: no Do you have any ideas on how to fix it?

jpwhiting commented 1 year ago

This is either fixed in steamos 3.5 or was fixed by trying something slightly different. Here in step 5 instead of using Share + home to go back into pairing mode, just press home to turn on the controller. It reconnected fine here. I am using SteamOS 3.5 though, so maybe a bug fix in the newer kernel/bluetooth stack there, etc. At any rate worth trying just use home to turn on the controller. Iiuc share + home is to reenter pairing mode.

Zin4uk commented 1 year ago

This is either fixed in steamos 3.5 or was fixed by trying something slightly different. Here in step 5 instead of using Share + home to go back into pairing mode, just press home to turn on the controller. It reconnected fine here. I am using SteamOS 3.5 though, so maybe a bug fix in the newer kernel/bluetooth stack there, etc. At any rate worth trying just use home to turn on the controller. Iiuc share + home is to reenter pairing mode.

I have the same issue and pressing HOME on step 5 does not work. This is what happens:

... Connected: yes
Failed to connect: org.bluez.Error.Failed br-connection-create-socket
... Connected: no

It only works on SHARE+HOME and then select 'connect to the controller' in the Bluetooth menu.

Zin4uk commented 1 year ago

I didn't find a fix, so I'm using a workaround. The script runs in the background, it monitors and connects automatically. I'm running it on system boot as a service for 2 gamepads. Temp workaround before I find a better solution.

#!/bin/bash

if [ $# -ne 1 ]; then
    echo "Usage: $0 <gamepad_address>"
    exit 1
fi

gamepad_address="$1"

# Check if another instance is already running for this gamepad
lock_file="/tmp/gamepad_connect_${gamepad_address//:/}.lock"

if [ -e "$lock_file" ]; then
    echo "Another instance for gamepad $gamepad_address is already running."
    exit 1
fi

# Create the lock file
touch "$lock_file"

# Function to remove the lock file on script exit
cleanup() {
    rm -f "$lock_file"
    exit
}

trap cleanup EXIT

while true; do
    # Check if the device is already connected
    info_output=$(bluetoothctl info "$gamepad_address")

    if [[ $info_output == *"Connected: yes"* ]]; then
        # echo "Bluetooth device $gamepad_address is already connected!"
        :
    else
        # echo "Connecting to Bluetooth device $gamepad_address..."
        bluetoothctl connect "$gamepad_address"

        if [ $? -eq 0 ]; then
            echo "Bluetooth device $gamepad_address connected successfully!"
        else
            # echo "Connection failed. Retrying in 5 seconds..."
            :
        fi
    fi

    sleep 10
done
ZongerX commented 5 months ago

I have same issue with OLED and thirs party DualShock 4 controller. Reconnect only after delete controller and press Share + Home buttons.

But i have 2 controllers, 1 working normal, but other cant reconnect. Both is third party, not original.