Linux bluetooth development
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ 3/4] android/hal-hidhost: Add implemention of .hid_info_cb
Date: Fri,  1 Nov 2013 15:08:40 +0200	[thread overview]
Message-ID: <1383311321-28429-3-git-send-email-luiz.dentz@gmail.com> (raw)
In-Reply-To: <1383311321-28429-1-git-send-email-luiz.dentz@gmail.com>

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

---
 android/hal-hidhost.c | 22 ++++++++++++++++++++++
 android/hal-msg.h     | 14 ++++++++++++++
 2 files changed, 36 insertions(+)

diff --git a/android/hal-hidhost.c b/android/hal-hidhost.c
index e148dc2..c20c785 100644
--- a/android/hal-hidhost.c
+++ b/android/hal-hidhost.c
@@ -40,6 +40,25 @@ static void handle_conn_state(void *buf)
 								ev->state);
 }
 
+static void handle_info(void *buf)
+{
+	struct hal_ev_hid_info *ev = buf;
+	bthh_hid_info_t info;
+
+	info.attr_mask = ev->attr;
+	info.sub_class = ev->subclass;
+	info.app_id = ev->app_id;
+	info.vendor_id = ev->vendor;
+	info.product_id = ev->product;
+	info.version = ev->version;
+	info.ctry_code = ev->country;
+	info.dl_len = ev->descr_len;
+	memcpy(info.dsc_list, ev->descr, info.dl_len);
+
+	if (bt_hh_cbacks->hid_info_cb)
+		bt_hh_cbacks->hid_info_cb((bt_bdaddr_t *) ev->bdaddr, info);
+}
+
 /* will be called from notification thread context */
 void bt_notify_hh(uint16_t opcode, void *buf, uint16_t len)
 {
@@ -50,6 +69,9 @@ void bt_notify_hh(uint16_t opcode, void *buf, uint16_t len)
 	case HAL_EV_HID_CONN_STATE:
 		handle_conn_state(buf);
 		break;
+	case HAL_EV_HID_INFO:
+		handle_info(buf);
+		break;
 	default:
 		DBG("Unhandled callback opcode=0x%x", opcode);
 		break;
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 8a344d8..9276a2f 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -439,6 +439,20 @@ struct hal_ev_hid_conn_state {
 	uint8_t state;
 } __attribute__((packed));
 
+#define HAL_EV_HID_INFO			0x82
+struct hal_ev_hid_info {
+	uint8_t bdaddr[6];
+	uint8_t attr;
+	uint8_t subclass;
+	uint8_t app_id;
+	uint16_t vendor;
+	uint16_t product;
+	uint16_t version;
+	uint8_t country;
+	uint16_t descr_len;
+	uint8_t descr[884];
+} __attribute__((packed));
+
 #define HAL_EV_AV_CONNECTION_STATE	0x81
 struct hal_ev_av_connection_state {
 	uint8_t state;
-- 
1.8.3.1


  parent reply	other threads:[~2013-11-01 13:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-01 13:08 [PATCH BlueZ 1/4] android/hid: Rename hdev vars to dev Luiz Augusto von Dentz
2013-11-01 13:08 ` [PATCH BlueZ 2/4] android/hid: Fix passing vendor id as version to uHID Luiz Augusto von Dentz
2013-11-01 13:08 ` Luiz Augusto von Dentz [this message]
2013-11-01 13:08 ` [PATCH BlueZ 4/4] android/hid: Add handling of HAL_EV_HID_INFO Luiz Augusto von Dentz
2013-11-01 13:24 ` [PATCH BlueZ 1/4] android/hid: Rename hdev vars to dev 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=1383311321-28429-3-git-send-email-luiz.dentz@gmail.com \
    --to=luiz.dentz@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox