diff --git a/android/hidhost.c b/android/hidhost.c
index d0000a8..502b10b 100644
--- a/android/hidhost.c
+++ b/android/hidhost.c
dev->uhid_fd = open(UHID_DEVICE_FILE, O_RDWR | O_CLOEXEC);
if (dev->uhid_fd < 0) {
error("Failed to open uHID device: %s", strerror(errno));
- bt_hid_notify_state(dev, HAL_HIDHOST_STATE_NO_HID);
return -errno;
}
error("Failed to create uHID device: %s", strerror(errno));
close(dev->uhid_fd);
dev->uhid_fd = -1;
- bt_hid_notify_state(dev, HAL_HIDHOST_STATE_NO_HID);
return -errno;
}
gpointer user_data)
{
struct hid_device *dev = user_data;
+ uint8_t state;
DBG("");
if (conn_err) {
error("%s", conn_err->message);
+ state = HAL_HIDHOST_STATE_FAILED;
goto failed;
}
- if (uhid_create(dev) < 0)
+ if (uhid_create(dev) < 0) {
+ state = HAL_HIDHOST_STATE_NO_HID;
goto failed;
+ }
dev->intr_watch = g_io_add_watch(dev->intr_io,
G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL,
return;
failed:
+ bt_hid_notify_state(dev, state);
hid_device_free(dev);
}