Skip to contentSkip to conversation

sixaxis: Fix fliping device.trusted automatically

PATCH In review Luiz Augusto von Dentz 2 participants 2 messages Aug 2, 2022 Bluetooth drivers

lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH 1/1 sixaxis: Fix fliping device.trusted automatically

From: Luiz Augusto von Dentz <[email protected]>

device.trusted is a user preference which controls if the devices needs to be authorized or not so the plugin shall not overwrite it and instead just honor what user has set and skip authorizing if already trusted.

---
 plugins/sixaxis.c | 9 +++------
 src/device.c      | 6 ++++++
 src/device.h      | 1 +
 3 files changed, 10 insertions(+), 6 deletions(-)
plugins/sixaxis.c +3 -6
index 10cf15948..9b9d51914 100644
@@ -294,7 +294,6 @@ static void agent_auth_cb(DBusError *derr, void *user_data)
 	}
 
 	remove_device = false;
-	btd_device_set_trusted(closure->device, true);
 	btd_device_set_temporary(closure->device, false);
 
 	if (closure->type == CABLE_PAIRING_SIXAXIS)
@@ -336,10 +335,9 @@ static bool setup_device(int fd, const char *sysfs_path,
 	 * connected eg. to charge up battery. */
 	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)) {
+	if (device && btd_device_has_uuid(device, HID_UUID) &&
+			(btd_device_is_connected(device) ||
+			 device_is_trusted(device))) {
 		char device_addr[18];
 		ba2str(&device_bdaddr, device_addr);
 		DBG("device %s already known, skipping", device_addr);
@@ -352,7 +350,6 @@ 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);
src/device.c +6 -0
index 775003796..8fa035b73 100644
@@ -4509,6 +4509,12 @@ GSList *btd_device_get_uuids(struct btd_device *device)
 	return device->uuids;
 }
 
+bool btd_device_has_uuid(struct btd_device *device, const char *uuid)
+{
+	return g_slist_find_custom(device->uuids, uuid,
+						(GCompareFunc)strcasecmp);
+}
+
 struct probe_data {
 	struct btd_device *dev;
 	GSList *uuids;
src/device.h +1 -0
index d7f886224..e8116c305 100644
@@ -54,6 +54,7 @@ struct device_addr_type {
 
 int device_addr_type_cmp(gconstpointer a, gconstpointer b);
 GSList *btd_device_get_uuids(struct btd_device *device);
+bool btd_device_has_uuid(struct btd_device *device, const char *uuid);
 void device_probe_profiles(struct btd_device *device, GSList *profiles);
 
 void btd_device_set_record(struct btd_device *device, const char *uuid,
Signature · 1 line
2.37.1
#1 lore raw

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=664649

---Test result---

Test Summary:

CheckPatch                    PASS      0.81 seconds
GitLint                       PASS      0.54 seconds
Prep - Setup ELL              PASS      26.23 seconds
Build - Prep                  PASS      0.62 seconds
Build - Configure             PASS      8.08 seconds
Build - Make                  PASS      740.98 seconds
Make Check                    PASS      11.09 seconds
Make Check w/Valgrind         PASS      282.33 seconds
Make Distcheck                PASS      234.63 seconds
Build w/ext ELL - Configure   PASS      8.17 seconds
Build w/ext ELL - Make        PASS      80.51 seconds
Incremental Build w/ patches  PASS      0.00 seconds
Scan Build                    PASS      584.10 seconds

---
Regards,
Linux Bluetooth