2020-12-07 17:05:49

by Lionel Jeanson

[permalink] [raw]
Subject: sixaxis patch proposal

Hi;

I'd like to propose the following patch to fix the following issue :

- if an already paired PS3 DualShock is plugged to USB, while it is
turned off (PS button wasn't pushed or no more battery for instance),
then it's connection will be reset and it will have to be paired again

- to fix this, I removed the device connection check

- tested on Ubuntu 20.x (bluez-5.53 and bluez-5.55) and works fine in
all cases.

Thank you;
Lionel



diff --git a/plugins/sixaxis.c b/plugins/sixaxis.c
index d693a86c0..ccede193e 100644
--- a/plugins/sixaxis.c
+++ b/plugins/sixaxis.c
@@ -337,7 +337,6 @@ static bool setup_device(int fd, const char *sysfs_path,
device = btd_adapter_find_device(adapter, &device_bdaddr,
BDADDR_BREDR);
if (device != NULL &&
- btd_device_is_connected(device) &&
g_slist_find_custom(btd_device_get_uuids(device), HID_UUID,
(GCompareFunc)strcasecmp)) {
char device_addr[18];


2020-12-08 09:02:29

by Bastien Nocera

[permalink] [raw]
Subject: Re: sixaxis patch proposal

On Mon, 2020-12-07 at 18:04 +0100, Lionel Jeanson wrote:
> Hi;
>
> I'd like to propose the following patch to fix the following issue :
>
>  - if an already paired PS3 DualShock is plugged to USB, while it is
> turned off (PS button wasn't pushed or no more battery for instance),
> then it's connection will be reset and it will have to be paired
> again
>
>  - to fix this, I removed the device connection check
>
>  - tested on Ubuntu 20.x (bluez-5.53 and bluez-5.55) and works fine
> in
> all cases.

It doesn't have to be paired again if the pairing agent doesn't accept
the pairing.

Also, see 7bb73f092a.

2020-12-08 09:47:31

by Lionel Jeanson

[permalink] [raw]
Subject: Re: sixaxis patch proposal

Hi;

yes, I've seen your commit, and actually I don't get it, since it was
integrated, and bluez updated, sixaxis pads are not working as well as
they used to, I need to repair the device again and again.

I tried to do it with the pairing agent using bluetoothctl but
couldn't get it to work as expected, any hint? I can't find anything
on google or anywhere else.

Merci;
Lionel


Le mar. 8 déc. 2020 à 10:01, Bastien Nocera <[email protected]> a écrit :
>
> On Mon, 2020-12-07 at 18:04 +0100, Lionel Jeanson wrote:
> > Hi;
> >
> > I'd like to propose the following patch to fix the following issue :
> >
> > - if an already paired PS3 DualShock is plugged to USB, while it is
> > turned off (PS button wasn't pushed or no more battery for instance),
> > then it's connection will be reset and it will have to be paired
> > again
> >
> > - to fix this, I removed the device connection check
> >
> > - tested on Ubuntu 20.x (bluez-5.53 and bluez-5.55) and works fine
> > in
> > all cases.
>
> It doesn't have to be paired again if the pairing agent doesn't accept
> the pairing.
>
> Also, see 7bb73f092a.
>

2020-12-08 09:57:09

by Bastien Nocera

[permalink] [raw]
Subject: Re: sixaxis patch proposal

On Tue, 2020-12-08 at 10:45 +0100, Lionel Jeanson wrote:
> Hi;
>
> yes, I've seen your commit, and actually I don't get it, since it was
> integrated, and bluez updated, sixaxis pads are not working as well
> as
> they used to, I need to repair the device again and again.
>
> I tried to do it with the pairing agent using bluetoothctl but
> couldn't get it to work as expected, any hint? I can't find anything
> on google or anywhere else.

1. Start bluetoothctl
2. Plug in the device
3. Answer yes when bluetoothctl asks to pair

The same should work using GNOME's Bluetooth Settings.

If it doesn't work, send the bluetoothd logs when reproducing the
problem.

2020-12-08 10:48:41

by Lionel Jeanson

[permalink] [raw]
Subject: Re: sixaxis patch proposal

Cleaned known devices.
Restart bluetooth service.
déc. 08 11:36:11 Plugged sixaxis on USB, new device, pair, yes.
Checked that it is working.
déc. 08 11:36:47 Plugged back sixaxis on USB while on, all went fine.
Unplugged.
Turned six axis off (long press on PS button).
déc. 08 11:37:03 Plugged back in USB -> Authorize service etc...,
in bluetoothctl, didn't answer, request canceled <--- this
shouldn't happen
Unplugged.
déc. 08 11:39:39 Tried to connect using BT, won't connect
(normal, it's nor paired anymore)


déc. 08 11:36:11 lionelux bluetoothd[8616]: sixaxis: compatible device
connected: Sony PLAYSTATION(R)3 Controller (054C:0268
/sys/devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/0003:054C:0268.0005/hidraw/hidraw0)
déc. 08 11:36:11 lionelux bluetoothd[8616]: sixaxis: setting up new device
déc. 08 11:36:14 lionelux bluetoothd[8616]: Set device flags return
status: Unknown Command
déc. 08 11:36:47 lionelux bluetoothd[8616]: sixaxis: compatible device
connected: Sony PLAYSTATION(R)3 Controller (054C:0268
/sys/devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/0003:054C:0268.0008/hidraw/hidraw4)
déc. 08 11:37:03 lionelux bluetoothd[8616]: sixaxis: compatible device
connected: Sony PLAYSTATION(R)3 Controller (054C:0268
/sys/devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/0003:054C:0268.0009/hidraw/hidraw0)
déc. 08 11:37:03 lionelux bluetoothd[8616]: sixaxis: setting up new device
déc. 08 11:39:39 lionelux bluetoothd[8616]:
profiles/input/server.c:connect_event_cb() Refusing input device
connect: No such file or directory (2)
déc. 08 11:39:39 lionelux bluetoothd[8616]:
profiles/input/server.c:confirm_event_cb() Refusing connection from
44:D8:32:7E:6B:6A: unknown device




Le mar. 8 déc. 2020 à 10:53, Bastien Nocera <[email protected]> a écrit :
>
> On Tue, 2020-12-08 at 10:45 +0100, Lionel Jeanson wrote:
> > Hi;
> >
> > yes, I've seen your commit, and actually I don't get it, since it was
> > integrated, and bluez updated, sixaxis pads are not working as well
> > as
> > they used to, I need to repair the device again and again.
> >
> > I tried to do it with the pairing agent using bluetoothctl but
> > couldn't get it to work as expected, any hint? I can't find anything
> > on google or anywhere else.
>
> 1. Start bluetoothctl
> 2. Plug in the device
> 3. Answer yes when bluetoothctl asks to pair
>
> The same should work using GNOME's Bluetooth Settings.
>
> If it doesn't work, send the bluetoothd logs when reproducing the
> problem.
>

2020-12-08 11:03:26

by Bastien Nocera

[permalink] [raw]
Subject: Re: sixaxis patch proposal

On Tue, 2020-12-08 at 11:46 +0100, Lionel Jeanson wrote:
> Cleaned known devices.
> Restart bluetooth service.
> déc. 08 11:36:11      Plugged sixaxis on USB, new device, pair, yes.
> Checked that it is working.
>  déc. 08 11:36:47     Plugged back sixaxis on USB while on, all went
> fine.
> Unplugged.
> Turned six axis off (long press on PS button).
> déc. 08 11:37:03      Plugged back in USB -> Authorize service
> etc...,
> in bluetoothctl, didn't answer, request canceled     <--- this
> shouldn't happen
> Unplugged.
> déc. 08 11:39:39      Tried to connect using BT, won't connect
> (normal, it's nor paired anymore)
>
>
> déc. 08 11:36:11 lionelux bluetoothd[8616]: sixaxis: compatible
> device
> connected: Sony PLAYSTATION(R)3 Controller (054C:0268
> /sys/devices/pci0000:00/0000:00:14.0/usb1/1-1/1-
> 1:1.0/0003:054C:0268.0005/hidraw/hidraw0)
> déc. 08 11:36:11 lionelux bluetoothd[8616]: sixaxis: setting up new
> device
> déc. 08 11:36:14 lionelux bluetoothd[8616]: Set device flags return
> status: Unknown Command

Looks like you didn't enable debug, as we can't see the response from
the sixaxis plugin. It's supposed to send either:
"Agent replied negatively, removing temporary device"
or:
"remote %s old_master %s new_master %s"

2020-12-08 11:28:09

by Lionel Jeanson

[permalink] [raw]
Subject: Re: sixaxis patch proposal

My bad :

1) connect and pair (OK)

déc. 08 12:14:44 lionelux bluetoothd[16446]: sixaxis: compatible
device connected: Sony PLAYSTATION(R)3 Controller (054C:0268
/sys/devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/0003:054C:0268.0010/hidraw/hidraw0)
déc. 08 12:14:44 lionelux bluetoothd[16446]:
src/device.c:device_create() dst 44:D8:32:7E:6B:6A
déc. 08 12:14:44 lionelux bluetoothd[16446]: src/device.c:device_new()
address 44:D8:32:7E:6B:6A
déc. 08 12:14:44 lionelux bluetoothd[16446]: src/device.c:device_new()
Creating device /org/bluez/hci0/dev_44_D8_32_7E_6B_6A
déc. 08 12:14:44 lionelux bluetoothd[16446]: sixaxis: setting up new device
déc. 08 12:14:44 lionelux bluetoothd[16446]:
src/device.c:btd_device_device_set_name()
/org/bluez/hci0/dev_44_D8_32_7E_6B_6A Sony PLAYSTATION(R)3 Controller
déc. 08 12:14:44 lionelux bluetoothd[16446]: src/agent.c:agent_ref()
0x5579c3bc4e70: ref=2
déc. 08 12:14:44 lionelux bluetoothd[16446]:
src/agent.c:agent_call_authorize_service() authorize service request
was sent for /org/bluez/hci0/dev_44_D8_32_7E_6B_6A
déc. 08 12:14:47 lionelux bluetoothd[16446]: src/agent.c:agent_ref()
0x5579c3bc4e70: ref=3
déc. 08 12:14:47 lionelux bluetoothd[16446]:
src/device.c:btd_device_set_trusted() trusted 1
déc. 08 12:14:47 lionelux bluetoothd[16446]:
src/device.c:btd_device_set_temporary() temporary 0
déc. 08 12:14:47 lionelux bluetoothd[16446]:
src/device.c:device_probe_profiles() Probing profiles for device
44:D8:32:7E:6B:6A
déc. 08 12:14:47 lionelux bluetoothd[16446]:
profiles/input/device.c:input_device_register()
/org/bluez/hci0/dev_44_D8_32_7E_6B_6A
déc. 08 12:14:47 lionelux bluetoothd[16446]:
src/service.c:btd_service_ref() 0x5579c3bca4f0: ref=2
déc. 08 12:14:47 lionelux bluetoothd[16446]:
src/service.c:change_state() 0x5579c3bca4f0: device 44:D8:32:7E:6B:6A
profile input-hid state changed: unavailable -> disconnected (0)
déc. 08 12:14:47 lionelux bluetoothd[16446]:
src/device.c:device_svc_resolved()
/org/bluez/hci0/dev_44_D8_32_7E_6B_6A err 0
déc. 08 12:14:47 lionelux bluetoothd[16446]:
plugins/sixaxis.c:agent_auth_cb() remote 44:D8:32:7E:6B:6A old_master
A4:34:D9:3F:36:93 new_master A4:34:D9:3F:36:93
déc. 08 12:14:47 lionelux bluetoothd[16446]: src/agent.c:agent_unref()
0x5579c3bc4e70: ref=2
déc. 08 12:14:47 lionelux bluetoothd[16446]: src/agent.c:agent_unref()
0x5579c3bc4e70: ref=1
déc. 08 12:14:47 lionelux bluetoothd[16446]:
src/adapter.c:add_whitelist_complete() 44:D8:32:7E:6B:6A added to
kernel whitelist
déc. 08 12:14:47 lionelux bluetoothd[16446]: Set device flags return
status: Unknown Command


2) disconnect and check BT connectivity (OK)

déc. 08 12:14:54 lionelux bluetoothd[16446]:
src/adapter.c:connected_callback() hci0 device 44:D8:32:7E:6B:6A
connected eir_len 5
déc. 08 12:14:54 lionelux bluetoothd[16446]:
src/device.c:device_set_class() /org/bluez/hci0/dev_44_D8_32_7E_6B_6A
0x000508
déc. 08 12:14:54 lionelux bluetoothd[16446]:
profiles/input/server.c:connect_event_cb() Incoming connection from
44:D8:32:7E:6B:6A on PSM 17
déc. 08 12:14:54 lionelux bluetoothd[16446]:
profiles/input/device.c:input_device_set_channel() idev 0x5579c3bcebc0
psm 17
déc. 08 12:14:54 lionelux bluetoothd[16446]:
profiles/input/server.c:confirm_event_cb()
déc. 08 12:14:54 lionelux bluetoothd[16446]:
profiles/input/server.c:connect_event_cb() Incoming connection from
44:D8:32:7E:6B:6A on PSM 19
déc. 08 12:14:54 lionelux bluetoothd[16446]:
profiles/input/device.c:input_device_set_channel() idev 0x5579c3bcebc0
psm 19
déc. 08 12:14:54 lionelux bluetoothd[16446]:
src/service.c:change_state() 0x5579c3bca4f0: device 44:D8:32:7E:6B:6A
profile input-hid state changed: disconnected -> connected (0)
déc. 08 12:14:54 lionelux bluetoothd[16446]:
src/service.c:btd_service_ref() 0x5579c3bca4f0: ref=3
déc. 08 12:14:54 lionelux bluetoothd[16446]:
plugins/policy.c:service_cb() Added input-hid reconnect 0


3) reconnect on USB while on (OK)

déc. 08 12:14:57 lionelux bluetoothd[16446]: sixaxis: compatible
device connected: Sony PLAYSTATION(R)3 Controller (054C:0268
/sys/devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/0003:054C:0268.0012/hidraw/hidraw4)

4) disconnect and turn off (OK)

déc. 08 12:15:11 lionelux bluetoothd[16446]:
profiles/input/device.c:intr_watch_cb() Device 44:D8:32:7E:6B:6A
disconnected
déc. 08 12:15:11 lionelux bluetoothd[16446]:
src/service.c:change_state() 0x5579c3bca4f0: device 44:D8:32:7E:6B:6A
profile input-hid state changed: connected -> disconnected (0)
déc. 08 12:15:11 lionelux bluetoothd[16446]:
profiles/input/device.c:input_device_enter_reconnect_mode()
path=/org/bluez/hci0/dev_44_D8_32_7E_6B_6A reconnect_mode=device
déc. 08 12:15:11 lionelux bluetoothd[16446]:
profiles/input/device.c:ctrl_watch_cb() Device 44:D8:32:7E:6B:6A
disconnected
déc. 08 12:15:12 lionelux bluetoothd[16446]:
src/adapter.c:dev_disconnected() Device 44:D8:32:7E:6B:6A
disconnected, reason 3
déc. 08 12:15:12 lionelux bluetoothd[16446]:
src/adapter.c:adapter_remove_connection()
déc. 08 12:15:12 lionelux bluetoothd[16446]:
plugins/policy.c:disconnect_cb() reason 3
déc. 08 12:15:12 lionelux bluetoothd[16446]:
src/adapter.c:bonding_attempt_complete() hci0 bdaddr 44:D8:32:7E:6B:6A
type 0 status 0xe
déc. 08 12:15:12 lionelux bluetoothd[16446]:
src/device.c:device_bonding_complete() bonding (nil) status 0x0e
déc. 08 12:15:12 lionelux bluetoothd[16446]:
src/device.c:device_bonding_failed() status 14
déc. 08 12:15:12 lionelux bluetoothd[16446]: src/adapter.c:resume_discovery()

5) reconnect while off (KO)

déc. 08 12:15:14 lionelux bluetoothd[16446]: sixaxis: compatible
device connected: Sony PLAYSTATION(R)3 Controller (054C:0268
/sys/devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/0003:054C:0268.0013/hidraw/hidraw0)
déc. 08 12:15:14 lionelux bluetoothd[16446]: sixaxis: setting up new device
déc. 08 12:15:14 lionelux bluetoothd[16446]:
src/device.c:btd_device_set_trusted() trusted 0
déc. 08 12:15:14 lionelux bluetoothd[16446]:
src/device.c:btd_device_set_temporary() temporary 1
déc. 08 12:15:14 lionelux bluetoothd[16446]:
src/adapter.c:remove_whitelist_complete() 44:D8:32:7E:6B:6A removed
from kernel whitelist
déc. 08 12:15:14 lionelux bluetoothd[16446]: src/agent.c:agent_ref()
0x5579c3bc4e70: ref=2
déc. 08 12:15:14 lionelux bluetoothd[16446]:
src/agent.c:agent_call_authorize_service() authorize service request
was sent for /org/bluez/hci0/dev_44_D8_32_7E_6B_6A
déc. 08 12:15:44 lionelux bluetoothd[16446]:
plugins/sixaxis.c:agent_auth_cb() Agent replied negatively, removing
temporary device
déc. 08 12:15:44 lionelux bluetoothd[16446]:
src/agent.c:send_cancel_request() Sending Cancel request to :1.174,
/org/bluez/agent
déc. 08 12:15:44 lionelux bluetoothd[16446]: src/agent.c:agent_unref()
0x5579c3bc4e70: ref=1
déc. 08 12:15:44 lionelux bluetoothd[16446]:
src/device.c:device_remove() Removing device
/org/bluez/hci0/dev_44_D8_32_7E_6B_6A
déc. 08 12:15:44 lionelux bluetoothd[16446]:
src/service.c:change_state() 0x5579c3bca4f0: device 44:D8:32:7E:6B:6A
profile input-hid state changed: disconnected -> unavailable (0)
déc. 08 12:15:44 lionelux bluetoothd[16446]:
src/service.c:btd_service_unref() 0x5579c3bca4f0: ref=2
déc. 08 12:15:44 lionelux bluetoothd[16446]:
profiles/input/device.c:input_device_unregister()
/org/bluez/hci0/dev_44_D8_32_7E_6B_6A
déc. 08 12:15:44 lionelux bluetoothd[16446]:
src/service.c:btd_service_unref() 0x5579c3bca4f0: ref=1
déc. 08 12:15:44 lionelux bluetoothd[16446]:
src/service.c:btd_service_unref() 0x5579c3bca4f0: ref=0
déc. 08 12:15:44 lionelux bluetoothd[16446]:
src/device.c:btd_device_unref() Freeing device
/org/bluez/hci0/dev_44_D8_32_7E_6B_6A
déc. 08 12:15:44 lionelux bluetoothd[16446]:
src/device.c:device_free() 0x5579c3bc83c0



Le mar. 8 déc. 2020 à 11:59, Bastien Nocera <[email protected]> a écrit :
>
> On Tue, 2020-12-08 at 11:46 +0100, Lionel Jeanson wrote:
> > Cleaned known devices.
> > Restart bluetooth service.
> > déc. 08 11:36:11 Plugged sixaxis on USB, new device, pair, yes.
> > Checked that it is working.
> > déc. 08 11:36:47 Plugged back sixaxis on USB while on, all went
> > fine.
> > Unplugged.
> > Turned six axis off (long press on PS button).
> > déc. 08 11:37:03 Plugged back in USB -> Authorize service
> > etc...,
> > in bluetoothctl, didn't answer, request canceled <--- this
> > shouldn't happen
> > Unplugged.
> > déc. 08 11:39:39 Tried to connect using BT, won't connect
> > (normal, it's nor paired anymore)
> >
> >
> > déc. 08 11:36:11 lionelux bluetoothd[8616]: sixaxis: compatible
> > device
> > connected: Sony PLAYSTATION(R)3 Controller (054C:0268
> > /sys/devices/pci0000:00/0000:00:14.0/usb1/1-1/1-
> > 1:1.0/0003:054C:0268.0005/hidraw/hidraw0)
> > déc. 08 11:36:11 lionelux bluetoothd[8616]: sixaxis: setting up new
> > device
> > déc. 08 11:36:14 lionelux bluetoothd[8616]: Set device flags return
> > status: Unknown Command
>
> Looks like you didn't enable debug, as we can't see the response from
> the sixaxis plugin. It's supposed to send either:
> "Agent replied negatively, removing temporary device"
> or:
> "remote %s old_master %s new_master %s"
>

2020-12-08 11:30:47

by Bastien Nocera

[permalink] [raw]
Subject: Re: sixaxis patch proposal

On Tue, 2020-12-08 at 12:21 +0100, Lionel Jeanson wrote:
> My bad :
>
>
> 1) connect and pair :
>
>
> déc. 08 12:14:44 lionelux bluetoothd[16446]: sixaxis: compatible
> device connected: Sony PLAYSTATION(R)3 Controller (054C:0268
> /sys/devices/pci0000:00/0000:00:14.0/usb1/1-1/1-
> 1:1.0/0003:054C:0268.0010/hidraw/hidraw0)
> déc. 08 12:14:44 lionelux bluetoothd[16446]:
> src/device.c:device_create() dst 44:D8:32:7E:6B:6A
> déc. 08 12:14:44 lionelux bluetoothd[16446]:
> src/device.c:device_new() address 44:D8:32:7E:6B:6A
> déc. 08 12:14:44 lionelux bluetoothd[16446]:
> src/device.c:device_new() Creating device
> /org/bluez/hci0/dev_44_D8_32_7E_6B_6A
> déc. 08 12:14:44 lionelux bluetoothd[16446]: sixaxis: setting up new
> device
> déc. 08 12:14:44 lionelux bluetoothd[16446]:
> src/device.c:btd_device_device_set_name()
> /org/bluez/hci0/dev_44_D8_32_7E_6B_6A Sony PLAYSTATION(R)3 Controller
> déc. 08 12:14:44 lionelux bluetoothd[16446]: src/agent.c:agent_ref()
> 0x5579c3bc4e70: ref=2
> déc. 08 12:14:44 lionelux bluetoothd[16446]:
> src/agent.c:agent_call_authorize_service() authorize service request
> was sent for /org/bluez/hci0/dev_44_D8_32_7E_6B_6A
> déc. 08 12:14:47 lionelux bluetoothd[16446]: src/agent.c:agent_ref()
> 0x5579c3bc4e70: ref=3
> déc. 08 12:14:47 lionelux bluetoothd[16446]:
> src/device.c:btd_device_set_trusted() trusted 1
> déc. 08 12:14:47 lionelux bluetoothd[16446]:
> src/device.c:btd_device_set_temporary() temporary 0
> déc. 08 12:14:47 lionelux bluetoothd[16446]:
> src/device.c:device_probe_profiles() Probing profiles for device
> 44:D8:32:7E:6B:6A
> déc. 08 12:14:47 lionelux bluetoothd[16446]:
> profiles/input/device.c:input_device_register()
> /org/bluez/hci0/dev_44_D8_32_7E_6B_6A
> déc. 08 12:14:47 lionelux bluetoothd[16446]:
> src/service.c:btd_service_ref() 0x5579c3bca4f0: ref=2
> déc. 08 12:14:47 lionelux bluetoothd[16446]:
> src/service.c:change_state() 0x5579c3bca4f0: device 44:D8:32:7E:6B:6A
> profile input-hid state changed: unavailable -> disconnected (0)
> déc. 08 12:14:47 lionelux bluetoothd[16446]:
> src/device.c:device_svc_resolved()
> /org/bluez/hci0/dev_44_D8_32_7E_6B_6A err 0
> déc. 08 12:14:47 lionelux bluetoothd[16446]:
> plugins/sixaxis.c:agent_auth_cb() remote 44:D8:32:7E:6B:6A old_master
> A4:34:D9:3F:36:93 new_master A4:34:D9:3F:36:93
> déc. 08 12:14:47 lionelux bluetoothd[16446]:
> src/agent.c:agent_unref() 0x5579c3bc4e70: ref=2
> déc. 08 12:14:47 lionelux bluetoothd[16446]:
> src/agent.c:agent_unref() 0x5579c3bc4e70: ref=1
> déc. 08 12:14:47 lionelux bluetoothd[16446]:
> src/adapter.c:add_whitelist_complete() 44:D8:32:7E:6B:6A added to
> kernel whitelist
> déc. 08 12:14:47 lionelux bluetoothd[16446]: Set device flags return
> status: Unknown Command

What's the output of:
bluetoothctl info for the device after this?

Also, long-pressing the PS button on PS3 joypads will start a new one-
time pairing, making the device visible. I don't think that's what you
want to do.

The only way to turn off the joypad is to "disconnect" from it via
Bluetooth, IIRC.

2020-12-08 12:53:43

by Lionel Jeanson

[permalink] [raw]
Subject: Re: sixaxis patch proposal

ok, restarting :

1) after connect to USB and pair :

lionel@lionelux:~$ bluetoothctl info 44:D8:32:7E:6B:6A
Device 44:D8:32:7E:6B:6A (public)
Name: Sony PLAYSTATION(R)3 Controller
Alias: Sony PLAYSTATION(R)3 Controller
Paired: no
Trusted: yes
Blocked: no
Connected: no
WakeAllowed: no
LegacyPairing: no
UUID: Human Interface Device... (00001124-0000-1000-8000-00805f9b34fb)
Modalias: usb:v054Cp0268d0000



2) disconnect USB and connect BT

lionel@lionelux:~$ bluetoothctl info 44:D8:32:7E:6B:6A
Device 44:D8:32:7E:6B:6A (public)
Name: Sony PLAYSTATION(R)3 Controller
Alias: Sony PLAYSTATION(R)3 Controller
Class: 0x00000508
Icon: input-gaming
Paired: no
Trusted: yes
Blocked: no
Connected: yes
WakeAllowed: no
LegacyPairing: no
UUID: Human Interface Device... (00001124-0000-1000-8000-00805f9b34fb)
Modalias: usb:v054Cp0268d0000


3) disconnect BT from BT Manager (no more long press on sixaxis, using
only computer BT manager)

lionel@lionelux:~$ bluetoothctl info 44:D8:32:7E:6B:6A
Device 44:D8:32:7E:6B:6A (public)
Name: Sony PLAYSTATION(R)3 Controller
Alias: Sony PLAYSTATION(R)3 Controller
Class: 0x00000508
Icon: input-gaming
Paired: no
Trusted: yes
Blocked: no
Connected: no
WakeAllowed: no
LegacyPairing: no
UUID: Human Interface Device... (00001124-0000-1000-8000-00805f9b34fb)
Modalias: usb:v054Cp0268d0000

4) connect to USB while off :

déc. 08 13:10:38 lionelux bluetoothd[20928]: sixaxis: compatible
device connected: Sony PLAYSTATION(R)3 Controller (054C:0268
/sys/devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/0003:054C:0268.001A/hidraw/hidraw0)
déc. 08 13:10:38 lionelux bluetoothd[20928]: sixaxis: setting up new device
déc. 08 13:10:38 lionelux bluetoothd[20928]:
src/device.c:btd_device_set_trusted() trusted 0
déc. 08 13:10:38 lionelux bluetoothd[20928]:
src/device.c:btd_device_set_temporary() temporary 1
déc. 08 13:10:38 lionelux bluetoothd[20928]:
src/adapter.c:remove_whitelist_complete() 44:D8:32:7E:6B:6A removed
from kernel whitelist
déc. 08 13:10:38 lionelux bluetoothd[20928]: src/agent.c:agent_ref()
0x56294fe6a950: ref=2
déc. 08 13:10:38 lionelux bluetoothd[20928]:
src/agent.c:agent_call_authorize_service() authorize service request
was sent for /org/bluez/hci0/dev_44_D8_32_7E_6B_6A

lionel@lionelux:~$ bluetoothctl info 44:D8:32:7E:6B:6A
Device 44:D8:32:7E:6B:6A (public)
Name: Sony PLAYSTATION(R)3 Controller
Alias: Sony PLAYSTATION(R)3 Controller
Class: 0x00000508
Icon: input-gaming
Paired: no
Trusted: no
Blocked: no
Connected: no
WakeAllowed: no
LegacyPairing: no
UUID: Human Interface Device... (00001124-0000-1000-8000-00805f9b34fb)
Modalias: usb:v054Cp0268d0000


5) didn't accept new service, disconnect from USB

lionel@lionelux:~$ bluetoothctl info 44:D8:32:7E:6B:6A
Device 44:D8:32:7E:6B:6A not available



4') redoing step 4) but with my proposed patch : works as expected

déc. 08 13:14:25 lionelux bluetoothd[22191]: sixaxis: compatible
device connected: Sony PLAYSTATION(R)3 Controller (054C:0268
/sys/devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/0003:054C:0268.001D/hidraw/hidraw0)
déc. 08 13:14:25 lionelux bluetoothd[22191]:
plugins/sixaxis.c:setup_device() device 44:D8:32:7E:6B:6A already
known, skipping


Le mar. 8 déc. 2020 à 13:16, Lionel Jeanson <[email protected]> a écrit :
>
> ok, restarting :
>
> 1) after connect to USB and pair :
>
> lionel@lionelux:~$ bluetoothctl info 44:D8:32:7E:6B:6A
> Device 44:D8:32:7E:6B:6A (public)
> Name: Sony PLAYSTATION(R)3 Controller
> Alias: Sony PLAYSTATION(R)3 Controller
> Paired: no
> Trusted: yes
> Blocked: no
> Connected: no
> WakeAllowed: no
> LegacyPairing: no
> UUID: Human Interface Device... (00001124-0000-1000-8000-00805f9b34fb)
> Modalias: usb:v054Cp0268d0000
>
>
>
> 2) disconnect USB and connect BT
>
> lionel@lionelux:~$ bluetoothctl info 44:D8:32:7E:6B:6A
> Device 44:D8:32:7E:6B:6A (public)
> Name: Sony PLAYSTATION(R)3 Controller
> Alias: Sony PLAYSTATION(R)3 Controller
> Class: 0x00000508
> Icon: input-gaming
> Paired: no
> Trusted: yes
> Blocked: no
> Connected: yes
> WakeAllowed: no
> LegacyPairing: no
> UUID: Human Interface Device... (00001124-0000-1000-8000-00805f9b34fb)
> Modalias: usb:v054Cp0268d0000
>
>
> 3) disconnect BT from BT Manager (no more long press on sixaxis, using only computer BT manager)
>
> lionel@lionelux:~$ bluetoothctl info 44:D8:32:7E:6B:6A
> Device 44:D8:32:7E:6B:6A (public)
> Name: Sony PLAYSTATION(R)3 Controller
> Alias: Sony PLAYSTATION(R)3 Controller
> Class: 0x00000508
> Icon: input-gaming
> Paired: no
> Trusted: yes
> Blocked: no
> Connected: no
> WakeAllowed: no
> LegacyPairing: no
> UUID: Human Interface Device... (00001124-0000-1000-8000-00805f9b34fb)
> Modalias: usb:v054Cp0268d0000
>
> 4) connect to USB while off :
>
> déc. 08 13:10:38 lionelux bluetoothd[20928]: sixaxis: compatible device connected: Sony PLAYSTATION(R)3 Controller (054C:0268 /sys/devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/0003:054C:0268.001A/hidraw/hidraw0)
> déc. 08 13:10:38 lionelux bluetoothd[20928]: sixaxis: setting up new device
> déc. 08 13:10:38 lionelux bluetoothd[20928]: src/device.c:btd_device_set_trusted() trusted 0
> déc. 08 13:10:38 lionelux bluetoothd[20928]: src/device.c:btd_device_set_temporary() temporary 1
> déc. 08 13:10:38 lionelux bluetoothd[20928]: src/adapter.c:remove_whitelist_complete() 44:D8:32:7E:6B:6A removed from kernel whitelist
> déc. 08 13:10:38 lionelux bluetoothd[20928]: src/agent.c:agent_ref() 0x56294fe6a950: ref=2
> déc. 08 13:10:38 lionelux bluetoothd[20928]: src/agent.c:agent_call_authorize_service() authorize service request was sent for /org/bluez/hci0/dev_44_D8_32_7E_6B_6A
>
> lionel@lionelux:~$ bluetoothctl info 44:D8:32:7E:6B:6A
> Device 44:D8:32:7E:6B:6A (public)
> Name: Sony PLAYSTATION(R)3 Controller
> Alias: Sony PLAYSTATION(R)3 Controller
> Class: 0x00000508
> Icon: input-gaming
> Paired: no
> Trusted: no
> Blocked: no
> Connected: no
> WakeAllowed: no
> LegacyPairing: no
> UUID: Human Interface Device... (00001124-0000-1000-8000-00805f9b34fb)
> Modalias: usb:v054Cp0268d0000
>
>
> 5) didn't accept new service, disconnect from USB
>
> lionel@lionelux:~$ bluetoothctl info 44:D8:32:7E:6B:6A
> Device 44:D8:32:7E:6B:6A not available
>
>
>
> 4') redoing step 4) but with my proposed patch : works as expected
>
> déc. 08 13:14:25 lionelux bluetoothd[22191]: sixaxis: compatible device connected: Sony PLAYSTATION(R)3 Controller (054C:0268 /sys/devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/0003:054C:0268.001D/hidraw/hidraw0)
> déc. 08 13:14:25 lionelux bluetoothd[22191]: plugins/sixaxis.c:setup_device() device 44:D8:32:7E:6B:6A already known, skipping
>
>
>
>
>
> Le mar. 8 déc. 2020 à 12:29, Bastien Nocera <[email protected]> a écrit :
>>
>> On Tue, 2020-12-08 at 12:21 +0100, Lionel Jeanson wrote:
>> > My bad :
>> >
>> >
>> > 1) connect and pair :
>> >
>> >
>> > déc. 08 12:14:44 lionelux bluetoothd[16446]: sixaxis: compatible
>> > device connected: Sony PLAYSTATION(R)3 Controller (054C:0268
>> > /sys/devices/pci0000:00/0000:00:14.0/usb1/1-1/1-
>> > 1:1.0/0003:054C:0268.0010/hidraw/hidraw0)
>> > déc. 08 12:14:44 lionelux bluetoothd[16446]:
>> > src/device.c:device_create() dst 44:D8:32:7E:6B:6A
>> > déc. 08 12:14:44 lionelux bluetoothd[16446]:
>> > src/device.c:device_new() address 44:D8:32:7E:6B:6A
>> > déc. 08 12:14:44 lionelux bluetoothd[16446]:
>> > src/device.c:device_new() Creating device
>> > /org/bluez/hci0/dev_44_D8_32_7E_6B_6A
>> > déc. 08 12:14:44 lionelux bluetoothd[16446]: sixaxis: setting up new
>> > device
>> > déc. 08 12:14:44 lionelux bluetoothd[16446]:
>> > src/device.c:btd_device_device_set_name()
>> > /org/bluez/hci0/dev_44_D8_32_7E_6B_6A Sony PLAYSTATION(R)3 Controller
>> > déc. 08 12:14:44 lionelux bluetoothd[16446]: src/agent.c:agent_ref()
>> > 0x5579c3bc4e70: ref=2
>> > déc. 08 12:14:44 lionelux bluetoothd[16446]:
>> > src/agent.c:agent_call_authorize_service() authorize service request
>> > was sent for /org/bluez/hci0/dev_44_D8_32_7E_6B_6A
>> > déc. 08 12:14:47 lionelux bluetoothd[16446]: src/agent.c:agent_ref()
>> > 0x5579c3bc4e70: ref=3
>> > déc. 08 12:14:47 lionelux bluetoothd[16446]:
>> > src/device.c:btd_device_set_trusted() trusted 1
>> > déc. 08 12:14:47 lionelux bluetoothd[16446]:
>> > src/device.c:btd_device_set_temporary() temporary 0
>> > déc. 08 12:14:47 lionelux bluetoothd[16446]:
>> > src/device.c:device_probe_profiles() Probing profiles for device
>> > 44:D8:32:7E:6B:6A
>> > déc. 08 12:14:47 lionelux bluetoothd[16446]:
>> > profiles/input/device.c:input_device_register()
>> > /org/bluez/hci0/dev_44_D8_32_7E_6B_6A
>> > déc. 08 12:14:47 lionelux bluetoothd[16446]:
>> > src/service.c:btd_service_ref() 0x5579c3bca4f0: ref=2
>> > déc. 08 12:14:47 lionelux bluetoothd[16446]:
>> > src/service.c:change_state() 0x5579c3bca4f0: device 44:D8:32:7E:6B:6A
>> > profile input-hid state changed: unavailable -> disconnected (0)
>> > déc. 08 12:14:47 lionelux bluetoothd[16446]:
>> > src/device.c:device_svc_resolved()
>> > /org/bluez/hci0/dev_44_D8_32_7E_6B_6A err 0
>> > déc. 08 12:14:47 lionelux bluetoothd[16446]:
>> > plugins/sixaxis.c:agent_auth_cb() remote 44:D8:32:7E:6B:6A old_master
>> > A4:34:D9:3F:36:93 new_master A4:34:D9:3F:36:93
>> > déc. 08 12:14:47 lionelux bluetoothd[16446]:
>> > src/agent.c:agent_unref() 0x5579c3bc4e70: ref=2
>> > déc. 08 12:14:47 lionelux bluetoothd[16446]:
>> > src/agent.c:agent_unref() 0x5579c3bc4e70: ref=1
>> > déc. 08 12:14:47 lionelux bluetoothd[16446]:
>> > src/adapter.c:add_whitelist_complete() 44:D8:32:7E:6B:6A added to
>> > kernel whitelist
>> > déc. 08 12:14:47 lionelux bluetoothd[16446]: Set device flags return
>> > status: Unknown Command
>>
>> What's the output of:
>> bluetoothctl info for the device after this?
>>
>> Also, long-pressing the PS button on PS3 joypads will start a new one-
>> time pairing, making the device visible. I don't think that's what you
>> want to do.
>>
>> The only way to turn off the joypad is to "disconnect" from it via
>> Bluetooth, IIRC.
>>