Skip to content

Commit

Permalink
Don't check Connected property for power-off
Browse files Browse the repository at this point in the history
Not sure if that's an issue with bluez or with my new card, but device
now shows as not connected despite being actually connected and
input working.

Only match address for power-off command.
  • Loading branch information
nowrep committed Mar 31, 2024
1 parent 3e66f17 commit 35b5f71
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -416,26 +416,21 @@ static bool dualsense_bt_disconnect(struct dualsense *ds)
int props_count = dbus_message_iter_get_element_count(&ifacedict_kv);
DBusMessageIter propdict_entry, propdict_kv;
dbus_message_iter_recurse(&ifacedict_kv, &propdict_entry);
char *address = NULL;
int connected = 0;
while (props_count-- && !ds_path) {
dbus_message_iter_recurse(&propdict_entry, &propdict_kv);
dbus_message_iter_get_basic(&propdict_kv, &prop);
DBusMessageIter variant;
if (!strcmp(prop, "Address")) {
dbus_message_iter_next(&propdict_kv);
dbus_message_iter_recurse(&propdict_kv, &variant);
char *address = NULL;
dbus_message_iter_get_basic(&variant, &address);
} else if (!strcmp(prop, "Connected")) {
dbus_message_iter_next(&propdict_kv);
dbus_message_iter_recurse(&propdict_kv, &variant);
dbus_message_iter_get_basic(&variant, &connected);
if (!strcmp(address, ds->mac_address) && !ds_path) {
ds_path = path;
}
}
dbus_message_iter_next(&propdict_entry);
}
if (connected && address && !strcmp(address, ds->mac_address) && !ds_path) {
ds_path = path;
}
}
dbus_message_iter_next(&ifacedict_entry);
}
Expand Down

1 comment on commit 35b5f71

@3dfx
Copy link

@3dfx 3dfx commented on 35b5f71 Apr 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got that "not connected" issue when upgrading my kernel to 6.8.2, going back to 6.8.1 bluez reported "connected: yes" again.
Seems like a kernel issue, rather than a bluez issue.
If it doesn't get fixed in the kernel, it seems like these changes is the right workaround.

Please sign in to comment.