-- v3: winebth.sys: Don't iterate over the remaining radios once a local device has been removed. winebth.sys: Initially set numOfDevices to 0 in IOCTL_BTH_GET_DEVICE_INFO. winebth.sys: Use the correct DBus property name in IOCTL_WINEBTH_RADIO_SET_FLAG. winebth.sys: Only set the updated properties for local radios on BLUETOOTH_WATCHER_EVENT_TYPE_RADIO_PROPERTIES_CHANGED.
From: Vibhav Pant vibhavp@gmail.com
A PropertiesChanged signal only contains the updated properties for the object, so the PE driver should only modify the properties which have their corresponding mask bit set. Additionally, unset the mask bits for invalidated properties. --- dlls/winebth.sys/winebth.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-)
diff --git a/dlls/winebth.sys/winebth.c b/dlls/winebth.sys/winebth.c index 28cc67c123c..39e5a7cd988 100644 --- a/dlls/winebth.sys/winebth.c +++ b/dlls/winebth.sys/winebth.c @@ -399,8 +399,6 @@ static void update_bluetooth_radio_properties( struct winebluetooth_watcher_even { struct bluetooth_radio *device; winebluetooth_radio_t radio = event.radio; - winebluetooth_radio_props_mask_t mask = event.changed_props_mask; - struct winebluetooth_radio_properties props = event.props;
EnterCriticalSection( &device_list_cs ); LIST_FOR_EACH_ENTRY( device, &device_list, struct bluetooth_radio, entry ) @@ -408,8 +406,27 @@ static void update_bluetooth_radio_properties( struct winebluetooth_watcher_even if (winebluetooth_radio_equal( radio, device->radio ) && !device->removed) { EnterCriticalSection( &device->props_cs ); - device->props_mask = mask; - device->props = props; + device->props_mask |= event.changed_props_mask; + device->props_mask &= ~event.invalid_props_mask; + + if (event.changed_props_mask & WINEBLUETOOTH_RADIO_PROPERTY_NAME) + memcpy( device->props.name, event.props.name, sizeof( event.props.name )); + if (event.changed_props_mask & WINEBLUETOOTH_RADIO_PROPERTY_ADDRESS) + device->props.address.ullLong = RtlUlonglongByteSwap( event.props.address.ullLong ); + if (event.changed_props_mask & WINEBLUETOOTH_RADIO_PROPERTY_DISCOVERABLE) + device->props.discoverable = event.props.discoverable; + if (event.changed_props_mask & WINEBLUETOOTH_RADIO_PROPERTY_CONNECTABLE) + device->props.connectable = event.props.connectable; + if (event.changed_props_mask & WINEBLUETOOTH_RADIO_PROPERTY_CLASS) + device->props.class = event.props.class; + if (event.changed_props_mask & WINEBLUETOOTH_RADIO_PROPERTY_MANUFACTURER) + device->props.manufacturer = event.props.manufacturer; + if (event.changed_props_mask & WINEBLUETOOTH_RADIO_PROPERTY_VERSION) + device->props.version = event.props.version; + if (event.changed_props_mask & WINEBLUETOOTH_RADIO_PROPERTY_DISCOVERING) + device->props.discovering = event.props.discovering; + if (event.changed_props_mask & WINEBLUETOOTH_RADIO_PROPERTY_PAIRABLE) + device->props.pairable = event.props.pairable; bluetooth_radio_set_properties( device->device_obj, device->props_mask, &device->props ); LeaveCriticalSection( &device->props_cs );
From: Vibhav Pant vibhavp@gmail.com
--- dlls/winebth.sys/dbus.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/winebth.sys/dbus.c b/dlls/winebth.sys/dbus.c index 13e4bbe29e5..75e72249234 100644 --- a/dlls/winebth.sys/dbus.c +++ b/dlls/winebth.sys/dbus.c @@ -345,12 +345,12 @@ NTSTATUS bluez_adapter_set_prop( void *connection, struct bluetooth_adapter_set_ switch (params->prop_flag) { case LOCAL_RADIO_CONNECTABLE: - prop_name = "Discoverable"; + prop_name = "Connectable"; val.bool_val = params->prop->boolean; val_type = DBUS_TYPE_BOOLEAN; break; case LOCAL_RADIO_DISCOVERABLE: - prop_name = "Connectable"; + prop_name = "Discoverable"; val.bool_val = params->prop->boolean; val_type = DBUS_TYPE_BOOLEAN; break;
From: Vibhav Pant vibhavp@gmail.com
--- dlls/winebth.sys/winebth.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/dlls/winebth.sys/winebth.c b/dlls/winebth.sys/winebth.c index 39e5a7cd988..15f7e9586f5 100644 --- a/dlls/winebth.sys/winebth.c +++ b/dlls/winebth.sys/winebth.c @@ -168,6 +168,7 @@ static NTSTATUS WINAPI dispatch_bluetooth( DEVICE_OBJECT *device, IRP *irp ) rem_devices = (outsize - sizeof( *list ))/sizeof(BTH_DEVICE_INFO) + 1; status = STATUS_SUCCESS; irp->IoStatus.Information = 0; + list->numOfDevices = 0;
EnterCriticalSection( &ext->remote_devices_cs ); LIST_FOR_EACH_ENTRY( device, &ext->remote_devices, struct bluetooth_remote_device, entry )
From: Vibhav Pant vibhavp@gmail.com
--- dlls/winebth.sys/winebth.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/dlls/winebth.sys/winebth.c b/dlls/winebth.sys/winebth.c index 15f7e9586f5..4b0918b1dd9 100644 --- a/dlls/winebth.sys/winebth.c +++ b/dlls/winebth.sys/winebth.c @@ -489,7 +489,11 @@ static void bluetooth_radio_remove_remote_device( struct winebluetooth_watcher_e winebluetooth_device_free( device->device ); DeleteCriticalSection( &device->props_cs ); free( device ); - break; + + LeaveCriticalSection( &radio->remote_devices_cs ); + LeaveCriticalSection( &device_list_cs ); + winebluetooth_device_free( event.device ); + return; } } LeaveCriticalSection( &radio->remote_devices_cs );
This merge request was closed by Vibhav Pant.
Closing, this is a part of !7424 now.