diff --git a/android/hidhost.c b/android/hidhost.c
index 2e589f4..729b884 100644
--- a/android/hidhost.c
+++ b/android/hidhost.c
if (!dev->hog) {
/* TODO: Get device details and primary */
- dev->hog = bt_hog_new("bluez-input-device", dev->vendor,
+ dev->hog = bt_hog_new_default("bluez-input-device", dev->vendor,
dev->product, dev->version, NULL);
if (!dev->hog) {
error("HoG: unable to create session");
diff --git a/android/hog.c b/android/hog.c
index 8133303..ff77bb3 100644
--- a/android/hog.c
+++ b/android/hog.c
GAttrib *attrib;
GSList *reports;
struct bt_uhid *uhid;
+ int uhid_fd;
gboolean has_report_id;
uint16_t bcdhid;
uint8_t bcountrycode;
g_free(hog);
}
-struct bt_hog *bt_hog_new(const char *name, uint16_t vendor, uint16_t product,
- uint16_t version, void *primary)
+struct bt_hog *bt_hog_new_default(const char *name, uint16_t vendor,
+ uint16_t product, uint16_t version,
+ void *primary)
+{
+ return bt_hog_new(-1, name, vendor, product, version, primary);
+}
+
+struct bt_hog *bt_hog_new(int fd, const char *name, uint16_t vendor,
+ uint16_t product, uint16_t version,
+ void *primary)
{
struct bt_hog *hog;
hog->gatt_op = queue_new();
hog->bas = queue_new();
- hog->uhid = bt_uhid_new_default();
+
+ if (fd < 0)
+ hog->uhid = bt_uhid_new_default();
+ else
+ hog->uhid = bt_uhid_new(fd);
+
+ hog->uhid_fd = fd;
if (!hog->gatt_op || !hog->bas || !hog->uhid) {
hog_free(hog);
return;
}
- instance = bt_hog_new(hog->name, hog->vendor, hog->product,
- hog->version, primary);
+ instance = bt_hog_new(hog->uhid_fd, hog->name, hog->vendor,
+ hog->product, hog->version, primary);
if (!instance)
return;
diff --git a/android/hog.h b/android/hog.h
index ddb2cea..2a9b899 100644
--- a/android/hog.h
+++ b/android/hog.h
struct bt_hog;
-struct bt_hog *bt_hog_new(const char *name, uint16_t vendor, uint16_t product,
- uint16_t version, void *primary);
+struct bt_hog *bt_hog_new_default(const char *name, uint16_t vendor,
+ uint16_t product, uint16_t version,
+ void *primary);
+
+struct bt_hog *bt_hog_new(int fd, const char *name, uint16_t vendor,
+ uint16_t product, uint16_t version,
+ void *primary);
struct bt_hog *bt_hog_ref(struct bt_hog *hog);
void bt_hog_unref(struct bt_hog *hog);