Skip to content

Commit d602837

Browse files
committed
Bluetooth (FreeBSD): add support (not tested)
1 parent e425d7d commit d602837

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,7 @@ elseif(FreeBSD)
617617
src/common/sysctl.c
618618
src/detection/battery/battery_bsd.c
619619
src/detection/bios/bios_bsd.c
620-
src/detection/bluetooth/bluetooth_nosupport.c
620+
src/detection/bluetooth/bluetooth_bsd.c
621621
src/detection/bluetoothradio/bluetoothradio_nosupport.c
622622
src/detection/board/board_bsd.c
623623
src/detection/bootmgr/bootmgr_bsd.c
@@ -1468,6 +1468,7 @@ elseif(FreeBSD)
14681468
target_link_libraries(libfastfetch
14691469
PRIVATE "m"
14701470
PRIVATE "usbhid"
1471+
PRIVATE "bluetooth"
14711472
)
14721473
if(NOT DragonFly)
14731474
target_link_libraries(libfastfetch
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#include "bluetooth.h"
2+
3+
#define L2CAP_SOCKET_CHECKED
4+
#include <bluetooth.h>
5+
6+
static int enumDev(FF_MAYBE_UNUSED int sockfd, struct bt_devinfo const* dev, FFlist* devices)
7+
{
8+
FFBluetoothResult* device = ffListAdd(devices);
9+
ffStrbufInitS(&device->name, bt_devremote_name_gen(dev->devname, &dev->bdaddr));
10+
ffStrbufInitS(&device->address, bt_ntoa(&dev->bdaddr, NULL));
11+
ffStrbufUpperCase(&device->address);
12+
ffStrbufInit(&device->type);
13+
device->battery = 0;
14+
device->connected = true;
15+
return 0;
16+
}
17+
18+
const char* ffDetectBluetooth(FF_MAYBE_UNUSED FFBluetoothOptions* options, FF_MAYBE_UNUSED FFlist* devices /* FFBluetoothResult */)
19+
{
20+
// struct hostent* ent = bt_gethostent();
21+
if (bt_devenum((void*) enumDev, devices) < 0)
22+
return "bt_devenum() failed";
23+
24+
return 0;
25+
}

0 commit comments

Comments
 (0)