diff --git a/profiles/input/device.c b/profiles/input/device.c
index a7bc4d4..3642cc3 100644
--- a/profiles/input/device.c
+++ b/profiles/input/device.c
error("Unknown value '%s'", state);
}
-uint8_t input_get_userspace_hid(void)
-{
- return uhid_state;
-}
-
void input_set_classic_bonded_only(bool state)
{
classic_bonded_only = state;
diff --git a/profiles/input/device.h b/profiles/input/device.h
index 036a889..9056695 100644
--- a/profiles/input/device.h
+++ b/profiles/input/device.h
void input_set_idle_timeout(int timeout);
void input_set_userspace_hid(char *state);
-uint8_t input_get_userspace_hid(void);
void input_set_classic_bonded_only(bool state);
bool input_get_classic_bonded_only(void);
diff --git a/profiles/input/hog.c b/profiles/input/hog.c
index f82648f..a3c876c 100644
--- a/profiles/input/hog.c
+++ b/profiles/input/hog.c
#include "src/shared/gatt-client.h"
#include "src/plugin.h"
-#include "device.h"
#include "suspend.h"
#include "attrib/att.h"
#include "attrib/gattrib.h"
static gboolean suspend_supported = FALSE;
static bool auto_sec = true;
+static bool uhid_state_persist = false;
static struct queue *devices = NULL;
static void hog_device_accept(struct hog_device *dev, struct gatt_db *db)
{
struct hog_device *dev = btd_service_get_user_data(service);
- if (input_get_userspace_hid() == UHID_PERSIST)
+ if (uhid_state_persist)
bt_hog_detach(dev->hog, false);
else
bt_hog_detach(dev->hog, true);
GKeyFile *config;
GError *err = NULL;
bool config_auto_sec;
+ char *uhid_enabled;
config = g_key_file_new();
if (!config) {
} else
g_clear_error(&err);
+ uhid_enabled = g_key_file_get_string(config, "General",
+ "UserspaceHID", &err);
+ if (!err) {
+ DBG("input.conf: UserspaceHID=%s", uhid_enabled);
+ uhid_state_persist = strcasecmp(uhid_enabled, "persist") == 0;
+ free(uhid_enabled);
+ } else
+ g_clear_error(&err);
+
g_key_file_free(config);
}