From: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
To: linux-bluetooth@vger.kernel.org
Cc: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
Subject: [PATCH 4/5] android/hidhost: Handle error case properly in interrupt_connect_cb
Date: Tue, 19 Nov 2013 14:21:15 +0200 [thread overview]
Message-ID: <1384863676-12358-4-git-send-email-ravikumar.veeramally@linux.intel.com> (raw)
In-Reply-To: <1384863676-12358-1-git-send-email-ravikumar.veeramally@linux.intel.com>
---
android/hidhost.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/android/hidhost.c b/android/hidhost.c
index a929a94..05a3fe4 100644
--- a/android/hidhost.c
+++ b/android/hidhost.c
@@ -522,7 +522,6 @@ static int uhid_create(struct hid_device *dev)
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;
}
@@ -541,7 +540,6 @@ static int uhid_create(struct hid_device *dev)
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;
}
@@ -559,16 +557,20 @@ static void interrupt_connect_cb(GIOChannel *chan, GError *conn_err,
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,
@@ -579,6 +581,7 @@ static void interrupt_connect_cb(GIOChannel *chan, GError *conn_err,
return;
failed:
+ bt_hid_notify_state(dev, state);
hid_device_free(dev);
}
--
1.8.3.2
next prev parent reply other threads:[~2013-11-19 12:21 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-19 12:21 [PATCH 1/5] android/pan: Fix wrong struct parameter in disconnect function call Ravi kumar Veeramally
2013-11-19 12:21 ` [PATCH 2/5] android/hal-pan: Return error in case of unsupported PAN roles Ravi kumar Veeramally
2013-11-19 13:27 ` Johan Hedberg
2013-11-19 13:51 ` Ravi Kumar Veeramally
2013-11-19 12:21 ` [PATCH 3/5] android: Handle multiple init(register) and cleanup(unregister) calls properly Ravi kumar Veeramally
2013-11-19 13:30 ` Johan Hedberg
2013-11-19 13:52 ` Ravi Kumar Veeramally
2013-11-19 12:21 ` Ravi kumar Veeramally [this message]
2013-11-19 13:31 ` [PATCH 4/5] android/hidhost: Handle error case properly in interrupt_connect_cb Johan Hedberg
2013-11-19 13:53 ` Ravi Kumar Veeramally
2013-11-19 12:21 ` [PATCH 5/5] android/hidhost: Free all connected devices in profile cleanup call Ravi kumar Veeramally
2013-11-19 13:35 ` Johan Hedberg
2013-11-19 13:55 ` Ravi Kumar Veeramally
2013-11-19 13:23 ` [PATCH 1/5] android/pan: Fix wrong struct parameter in disconnect function call Johan Hedberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1384863676-12358-4-git-send-email-ravikumar.veeramally@linux.intel.com \
--to=ravikumar.veeramally@linux.intel.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.