Skip to contentSkip to conversation

sixaxis: Fix another problem with already setup devices

PATCH In review Bastien Nocera 2 participants 3 messages Jun 7, 2019 – Jun 13, 2019 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 sixaxis: Fix another problem with already setup devices

If the device went through any kind of pairing once, it might have been set as trusted. Make sure to set the device as untrusted before starting the cable pairing authorization so that we don't exit early from process_auth_queue() (which considers trusted devices to be paired).

---
 plugins/sixaxis.c | 1 +
 1 file changed, 1 insertion(+)
plugins/sixaxis.c +1 -0
index fed68d2d8..12638829b 100644
@@ -365,6 +365,7 @@ static bool setup_device(int fd, const char *sysfs_path,
 
 	btd_device_device_set_name(device, cp->name);
 	btd_device_set_pnpid(device, cp->source, cp->vid, cp->pid, cp->version);
+	btd_device_set_trusted(device, false);
 	btd_device_set_temporary(device, true);
 
 	closure = g_new0(struct authentication_closure, 1);
Signature · 1 line
2.21.0
#1 lore raw

PATCH 2/2 sixaxis: Throw an error when cable setup fails

If btd_request_authorization_cable_configured() fails, throw an error and free resources.

---
 plugins/sixaxis.c | 6 ++++++
 1 file changed, 6 insertions(+)
plugins/sixaxis.c +6 -0
index 12638829b..939fed759 100644
@@ -384,6 +384,12 @@ static bool setup_device(int fd, const char *sysfs_path,
 					adapter_bdaddr, &device_bdaddr,
 					HID_UUID, agent_auth_cb, closure);
 
+	if (closure->auth_id == 0) {
+		error("sixaxis: could not request cable authorization");
+		auth_closure_destroy(closure, true);
+		return false;
+	}
+
 	g_hash_table_insert(pending_auths, closure->sysfs_path, closure);
 
 	return true;
Signature · 1 line
2.21.0
#2 lore raw
In reply to Bastien Nocera

Hi Bastien,

Quoted 20 lines · On Friday, 7 June 2019 08:54:10 CEST Bastien Nocera wrote:

If the device went through any kind of pairing once, it might have been set as trusted. Make sure to set the device as untrusted before starting the cable pairing authorization so that we don't exit early from process_auth_queue() (which considers trusted devices to be paired).

---
 plugins/sixaxis.c | 1 +
 1 file changed, 1 insertion(+)
plugins/sixaxis.c +1 -0
index fed68d2d8..12638829b 100644
@@ -365,6 +365,7 @@ static bool setup_device(int fd, const char *sysfs_path,
 
 	btd_device_device_set_name(device, cp->name);
 	btd_device_set_pnpid(device, cp->source, cp->vid, cp->pid, cp-
 version);
+	btd_device_set_trusted(device, false);
 	btd_device_set_temporary(device, true);
 
Quoted 1 line

closure = g_new0(struct authentication_closure, 1);

Both patches applied, thanks.

Signature · 2 lines
pozdrawiam
Szymon Janc