The open source OpenXR runtime

aux/os/ble_dbus: Don't require power management characteristic to be notifiable.

At least the SteamVR 2.0 lighthouses have a power management characteristic
that does not have the "notify" flag, only "write". So before this change,
the command would not find any valid characteristics to write to and be
a no-op. The power management code path does not require it to be notifiable
in the first place, so this change just ignores that flag.

Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2269>

authored by

Arnav Singh and committed by
Marge Bot
2685fb1d bdd61330

+11 -8
+11 -8
src/xrt/auxiliary/os/os_ble_dbus.c
··· 613 613 /*! 614 614 * Returns positive value if the object implements the 615 615 * `org.bluez.GattCharacteristic1` interface, its `UUID` matches the given @p 616 - * uuid and has the notify flag set. 616 + * uuid. 617 617 */ 618 618 static int 619 - gatt_char_has_uuid_and_notify(const DBusMessageIter *dict, const char *uuid, const char **out_path_str) 619 + gatt_char_has_uuid(const DBusMessageIter *dict, const char *uuid, const char **out_path_str, bool *out_notifiable) 620 620 { 621 621 DBusMessageIter first_elm; 622 622 DBusMessageIter iface_elm; ··· 645 645 continue; 646 646 } 647 647 648 - bool notifable = false; 649 - ret = gatt_iface_get_flag_notifiable(&iface_elm, &notifable); 650 - if (ret <= 0 || !notifable) { 648 + bool notifiable = false; 649 + ret = gatt_iface_get_flag_notifiable(&iface_elm, &notifiable); 650 + if (ret <= 0) { 651 651 continue; 652 652 } 653 653 654 654 *out_path_str = path_str; 655 + *out_notifiable = notifiable; 655 656 return 1; 656 657 } 657 658 ··· 904 905 { 905 906 const char *dev_path_str; 906 907 const char *char_path_str; 908 + bool notifiable; 907 909 ret = device_has_uuid(&elm, dev_uuid, &dev_path_str); 908 910 if (ret <= 0) { 909 911 continue; ··· 911 913 912 914 for_each(c, first_elm) 913 915 { 914 - ret = gatt_char_has_uuid_and_notify(&c, char_uuid, &char_path_str); 915 - if (ret <= 0) { 916 + ret = gatt_char_has_uuid(&c, char_uuid, &char_path_str, &notifiable); 917 + if (ret <= 0 || !notifiable) { 916 918 continue; 917 919 } 918 920 if (!starts_with_and_has_slash(char_path_str, dev_path_str)) { ··· 1135 1137 { 1136 1138 const char *dev_path_str; 1137 1139 const char *char_path_str; 1140 + bool notifiable; 1138 1141 ret = device_has_uuid(&elm, service_uuid, &dev_path_str); 1139 1142 if (ret <= 0) { 1140 1143 continue; ··· 1142 1145 1143 1146 for_each(c, first_elm) 1144 1147 { 1145 - ret = gatt_char_has_uuid_and_notify(&c, char_uuid, &char_path_str); 1148 + ret = gatt_char_has_uuid(&c, char_uuid, &char_path_str, &notifiable); 1146 1149 if (ret <= 0) { 1147 1150 continue; 1148 1151 }