Skip to content

Commit b152b38

Browse files
committed
Bluetooth (Windows): optimise
1. don't report disconnected devices if `showDisconnected == false` 2. don't report unknown devices 3. don't report errors when no devices found
1 parent ae26692 commit b152b38

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/detection/bluetooth/bluetooth_windows.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,14 @@ const char* ffDetectBluetooth(FFBluetoothOptions* options, FFlist* devices /* FF
2020
};
2121
HBLUETOOTH_DEVICE_FIND hFind = ffBluetoothFindFirstDevice(&(BLUETOOTH_DEVICE_SEARCH_PARAMS) {
2222
.fReturnConnected = TRUE,
23-
.fReturnRemembered = TRUE,
24-
.fReturnAuthenticated = TRUE,
25-
.fReturnUnknown = TRUE,
23+
.fReturnRemembered = options->showDisconnected,
24+
.fReturnAuthenticated = options->showDisconnected,
2625
.dwSize = sizeof(BLUETOOTH_DEVICE_SEARCH_PARAMS)
2726
}, &btdi);
2827
if(!hFind)
2928
{
29+
if (GetLastError() == ERROR_NO_MORE_ITEMS)
30+
return NULL;
3031
return "BluetoothFindFirstDevice() failed";
3132
}
3233

0 commit comments

Comments
 (0)