This MR is the first of at least three MRs adding support for the Bluetooth stack API in Wine:
1. The winebth.sys driver, which talks to BlueZ and implements several key IOCTLs for communicating with Bluetooth devices and radios. 2. A bthserv service, which is responsible for keeping track of the authentication agent, and relaying authentication requests and responses to and from the driver. 3. Userspace APIs (bluetoothapis.dll, bthprops.cpl, Windows.Devices.Bluetooth, etc).
winebth.sys is split into two "sub" drivers:
`winebth.sys`: The main entrypoint, loaded by winedevice. It listens for changes to Bluetooth devices and radios and authentication events on BlueZ, passing them on the bthenum. It also handles most IOCTL operations on Bluetooth radio PDOs.
`bthenum`: Responsible for creating nodes for discovered Bluetooth devices and associated services. It also tries to validate any IOCTLs relating to bluetooth devices before passing them to winebth.sys.
The unix code is split between dbus.c, unixlib.c and winebluetooth.c, where winebluetooth is a simple wrapper around unixlib for the sake of organization.
-- v6: dlls/winebth.sys: Add support for RequestAuthorization requests from BlueZ. dlls/winebth.sys: Add support for RequestPasskey requests from BlueZ. dlls/winebth.sys: Add support for DisplayPasskey requests from BlueZ. dlls/winebth.sys: Add support for AuthorizeService requests from BlueZ. dlls/winebth.sys: Add support for DisplayPinCode requests from BlueZ. dlls/winebth.sys: Add support for RequestPinCode requests from BlueZ. dlls/winebth.sys: Add support for RequestConfirmation requests from BlueZ. dlls/winebth.sys: Implement IOCTL_WINEBTH_SEND_AUTH_RESPONSE. dlls/winebth.sys: Add IOCTLs IOCTL_WINEBTH_START_AUTH_AGENT and IOCTL_WINEBTH_STOP_AUTH_AGENT. dlls/winebth.sys: Add support for BLUETOOTH_RADIO_IN_RANGE events (WM_DEVICECHANGE). dlls/winebth.sys: Implement IOCTL commands IOCTL_WINEBTH_RADIO_SET_FLAG and IOCTL_WINEBTH_RADIO_UNSET_FLAG. dlls/winebth.sys: Implement IOCTL commands IOCTL_WINEBTH_RADIO_START_DISCOVERY and IOCTL_WINEBTH_RADIO_STOP_DISCOVERY. dlls/winebth.sys: Implement IOCTL_BTH_GET_LOCAL_INFO for radio devices. dlls/winebth.sys: Update radio PDO properties when BlueZ sends us a PropertiesChanged for an adapter. dlls/winebth.sys: Create PDOs for Bluetooth services discovered on remote devices. dlls/winebth.sys: Create PDOs for newly discovered remote Bluetooth devices. dlls/winebth.sys: Remove radio PDOs on receiving InterfacesRemoved for a BlueZ adapter. dlls/winebth.sys: Dispatch a BLUETOOTH_WATCHER_EVENT_TYPE_RADIO_ADDED event on receiving InterfacesAdded for a BlueZ adapter. dlls/winebth.sys: Add radio device properties from BlueZ. dlls/winebth.sys: Register and enable BTHPORT_DEVICE and BLUETOOTH_RADIO interfaces for radio PDOs. dlls/winebth.sys: Derive a unique hardware ID for radio PDOs from their corresponding BlueZ object path. dlls/winebth.sys: Create PDOs for newly discovered Bluetooth radios. dlls/winebth.sys: Add base winebth.sys driver.
This merge request has too many patches to be relayed via email. Please visit the URL below to see the contents of the merge request. https://gitlab.winehq.org/wine/wine/-/merge_requests/6621
Nicholas Ansell (@roadrunnerto) commented about dlls/winebth.sys/Makefile.in:
+MODULE = winebth.sys
```suggestion:-0+0 MODULE = winebth.sys ```
Nicholas Ansell (@roadrunnerto) commented about dlls/winebth.sys/Makefile.in:
MODULE = winebth.sys -IMPORTS = ntoskrnl +IMPORTS = ntoskrnl uuid +UNIXLIB = winebth.so +UNIX_CFLAGS = $(DBUS_CFLAGS)
EXTRADLLFLAGS = -Wl,--subsystem,native
SOURCES = \ winebth.c \
- bthenum.c \
bthenum.c is not in this commit
Nicholas Ansell (@roadrunnerto) commented about dlls/winebth.sys/dbus.c:
+#define WIN32_NO_STATUS +#include <windef.h> +#include <winternl.h> +#include <winbase.h> +#include <bthsdpdef.h> +#include <bluetoothapis.h>
+#include <wine/debug.h>
+#include "winebluetooth.h"
+#include "unixlib.h" +#include "unixlib_priv.h" +#include "dbus.h"
+WINE_DEFAULT_DEBUG_CHANNEL( winebluetooth );
```suggestion:-0+0 WINE_DEFAULT_DEBUG_CHANNEL( winebth ); ```
Nicholas Ansell (@roadrunnerto) commented about dlls/winebth.sys/dbus.h:
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
- */
+#ifndef __WINE_BLUETOOTHAPIS_UNIXLIB_DBUS_H
```suggestion:-0+0 #ifndef __WINE_WINEBTH_UNIXLIB_DBUS_H ```
Nicholas Ansell (@roadrunnerto) commented about dlls/winebth.sys/unixlib.c:
+#include <ctype.h> +#include <pthread.h>
+#include <ntstatus.h> +#define WIN32_NO_STATUS +#include <winternl.h> +#include <winbase.h> +#include <windef.h> +#include <wine/debug.h> +#include <wine/list.h> +#include <wine/rbtree.h>
+#include "unixlib.h" +#include "unixlib_priv.h"
+WINE_DEFAULT_DEBUG_CHANNEL( winebluetooth );
```suggestion:-0+0 WINE_DEFAULT_DEBUG_CHANNEL( winebth ); ```
Nicholas Ansell (@roadrunnerto) commented about dlls/winebth.sys/unixlib.h:
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
- */
+#ifndef __WINE_WINEBLUETOOTH_UNIXLIB_H
```suggestion:-0+0 #ifndef __WINE_WINEBTH_UNIXLIB_H ```
Nicholas Ansell (@roadrunnerto) commented about dlls/winebth.sys/unixlib_priv.h:
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
- */
+#ifndef __WINE_BLUETOOTHAPIS_UNIXLIB_PRIV_H
```suggestion:-0+0 #ifndef __WINE_WINEBTH_UNIXLIB_PRIV_H ```
Nicholas Ansell (@roadrunnerto) commented about dlls/winebth.sys/winebluetooth.c:
+#include <stdarg.h>
+#include <ntstatus.h> +#define WIN32_NO_STATUS
+#include <windef.h> +#include <winbase.h>
+#include <wine/debug.h> +#include <wine/heap.h> +#include <wine/unixlib.h>
+#include "winebluetooth.h" +#include "unixlib.h"
+WINE_DEFAULT_DEBUG_CHANNEL( winebluetooth );
```suggestion:-0+0 WINE_DEFAULT_DEBUG_CHANNEL( winebth ); ```