kindlebt
Bluetooth functionality for Kindle 11th gen and up
Loading...
Searching...
No Matches
compat_ace.c
1#define _GNU_SOURCE
2
3#include <kindlebt/compat_ace.h>
4
5#include <dlfcn.h>
6#include <stdbool.h>
7#include <stdio.h>
8
9#include "log.h"
10
11// TODO: Might want to turn it into a bitmask instead
12acebt_abi acebt_abi_version(void) {
13 static acebt_abi cached_abi = PRE_5170;
14 static bool initialized = false;
15
16 if (!initialized) {
17 void* handle = dlopen(NULL, RTLD_LAZY);
18 if (handle) {
19 dlerror();
20 void* sym = dlsym(handle, "aceBt_bleRegisterGattClient");
21 if (sym) {
22 cached_abi = SINCE_5170;
23 }
24 } else {
25 log_error("dlopen failed: %s", dlerror());
26 }
27 initialized = true;
28 }
29
30 return cached_abi;
31}