* [PATCH 07/11] android/hid: Implement hid set report in daemon
From: Ravi kumar Veeramally @ 2013-11-04 22:20 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Ravi kumar Veeramally
In-Reply-To: <1383603615-9953-1-git-send-email-ravikumar.veeramally@linux.intel.com>
This patch requests hid device to set report.
---
android/hal-hidhost.c | 1 +
android/hal-msg.h | 1 +
android/hid.c | 40 ++++++++++++++++++++++++++++++++++++++--
3 files changed, 40 insertions(+), 2 deletions(-)
diff --git a/android/hal-hidhost.c b/android/hal-hidhost.c
index 027e3b8..040d517 100644
--- a/android/hal-hidhost.c
+++ b/android/hal-hidhost.c
@@ -284,6 +284,7 @@ static bt_status_t hh_set_report(bt_bdaddr_t *bd_addr,
return BT_STATUS_PARM_INVALID;
memcpy(cmd.bdaddr, bd_addr, sizeof(cmd.bdaddr));
+ cmd.report = report;
switch (reportType) {
case BTHH_INPUT_REPORT:
diff --git a/android/hal-msg.h b/android/hal-msg.h
index eaa5c9c..e1fd027 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -292,6 +292,7 @@ struct hal_cmd_hid_get_report {
struct hal_cmd_hid_set_report {
uint8_t bdaddr[6];
uint8_t type;
+ char *report;
} __attribute__((packed));
#define HAL_OP_HID_SEND_DATA 0x09
diff --git a/android/hid.c b/android/hid.c
index 6cb9604..2682b21e6 100644
--- a/android/hid.c
+++ b/android/hid.c
@@ -56,6 +56,7 @@
/* HID message types */
#define HID_MSG_GET_REPORT 0x40
+#define HID_MSG_SET_REPORT 0x50
#define HID_MSG_GET_PROTOCOL 0x60
#define HID_MSG_SET_PROTOCOL 0x70
#define HID_MSG_DATA 0xa0
@@ -846,9 +847,44 @@ static uint8_t bt_hid_get_report(struct hal_cmd_hid_get_report *cmd,
static uint8_t bt_hid_set_report(struct hal_cmd_hid_set_report *cmd,
uint16_t len)
{
- DBG("Not Implemented");
+ struct hid_device *dev;
+ GSList *l;
+ bdaddr_t dst;
+ int fd;
+ uint8_t *req;
+ uint8_t req_size;
- return HAL_STATUS_FAILED;
+ DBG("");
+
+ if (len < sizeof(*cmd))
+ return HAL_STATUS_INVALID;
+
+ android2bdaddr(&cmd->bdaddr, &dst);
+
+ l = g_slist_find_custom(devices, &dst, device_cmp);
+ if (!l)
+ return HAL_STATUS_FAILED;
+
+ dev = l->data;
+ dev->hid_msg = HID_MSG_SET_REPORT;
+ req_size = 1 + strlen(cmd->report);
+ req = g_try_malloc0(req_size);
+ if (!req)
+ return HAL_STATUS_NOMEM;
+
+ req[0] = HID_MSG_SET_REPORT | cmd->type;
+ memcpy(req + 1, cmd->report, req_size - 1);
+
+ fd = g_io_channel_unix_get_fd(dev->ctrl_io);
+
+ if (write(fd, req, req_size) < 0) {
+ error("error while querying device protocol");
+ g_free(req);
+ return HAL_STATUS_FAILED;
+ }
+
+ g_free(req);
+ return HAL_STATUS_SUCCESS;
}
static uint8_t bt_hid_send_data(struct hal_cmd_hid_send_data *cmd,
--
1.8.1.2
^ permalink raw reply related
* [PATCH 06/11] android/hid: Implement hid get report in daemon
From: Ravi kumar Veeramally @ 2013-11-04 22:20 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Ravi kumar Veeramally
In-Reply-To: <1383603615-9953-1-git-send-email-ravikumar.veeramally@linux.intel.com>
This patch requests hid device report and reads reply
message and sends notification to hal.
---
android/hal-hidhost.c | 1 +
android/hal-msg.h | 8 ++++
android/hid.c | 104 +++++++++++++++++++++++++++++++++++++++++++++++++-
3 files changed, 111 insertions(+), 2 deletions(-)
diff --git a/android/hal-hidhost.c b/android/hal-hidhost.c
index a287e40..027e3b8 100644
--- a/android/hal-hidhost.c
+++ b/android/hal-hidhost.c
@@ -251,6 +251,7 @@ static bt_status_t hh_get_report(bt_bdaddr_t *bd_addr,
memcpy(cmd.bdaddr, bd_addr, sizeof(cmd.bdaddr));
cmd.id = reportId;
+ cmd.buf = bufferSize;
switch (reportType) {
case BTHH_INPUT_REPORT:
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 214daa9..eaa5c9c 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -465,6 +465,14 @@ struct hal_ev_hid_protocol {
uint8_t mode;
} __attribute__((packed));
+#define HAL_EV_HID_GET_REPORT 0x84
+struct hal_ev_hid_get_report {
+ uint8_t bdaddr[6];
+ uint8_t status;
+ uint16_t len;
+ uint8_t data[0];
+} __attribute__((packed));
+
#define HAL_EV_AV_CONNECTION_STATE 0x81
struct hal_ev_av_connection_state {
uint8_t state;
diff --git a/android/hid.c b/android/hid.c
index 115a1c5..6cb9604 100644
--- a/android/hid.c
+++ b/android/hid.c
@@ -55,14 +55,23 @@
#define UHID_DEVICE_FILE "/dev/uhid"
/* HID message types */
+#define HID_MSG_GET_REPORT 0x40
#define HID_MSG_GET_PROTOCOL 0x60
#define HID_MSG_SET_PROTOCOL 0x70
#define HID_MSG_DATA 0xa0
+/* HID data types */
+#define HID_DATA_TYPE_INPUT 0x01
+#define HID_DATA_TYPE_OUTPUT 0x02
+#define HID_DATA_TYPE_FEATURE 0x03
+
/* HID protocol header parameters */
#define HID_PROTO_BOOT 0x00
#define HID_PROTO_REPORT 0x01
+/* HID GET REPORT Size Field */
+#define HID_GET_REPORT_SIZE_FIELD 0x08
+
static GIOChannel *notification_io = NULL;
static GIOChannel *ctrl_io = NULL;
static GIOChannel *intr_io = NULL;
@@ -283,6 +292,52 @@ static void bt_hid_notify_protocol_mode(struct hid_device *dev, uint8_t *buf,
HAL_EV_HID_PROTO_MODE, sizeof(ev), &ev, -1);
}
+static void bt_hid_notify_get_report(struct hid_device *dev, uint8_t *buf,
+ int len)
+{
+ struct hal_ev_hid_get_report *ev;
+ int ev_len;
+ char address[18];
+
+ ba2str(&dev->dst, address);
+ DBG("device %s", address);
+
+ ev_len = sizeof(*ev) + sizeof(struct hal_ev_hid_get_report) + 1;
+
+ if (!((buf[0] == (HID_MSG_DATA | HID_DATA_TYPE_INPUT)) ||
+ (buf[0] == (HID_MSG_DATA | HID_DATA_TYPE_OUTPUT)) ||
+ (buf[0] == (HID_MSG_DATA | HID_DATA_TYPE_FEATURE)))) {
+ ev = g_malloc(len);
+ memset(ev, 0, ev_len);
+ ev->status = buf[0];
+ bdaddr2android(&dev->dst, ev->bdaddr);
+ goto send;
+ }
+
+ /* Report porotocol mode reply contains id after hdr, in boot
+ * protocol mode id doesn't exist */
+ ev_len += (dev->boot_dev) ? (len - 1) : (len - 2);
+ ev = g_malloc(ev_len);
+ memset(ev, 0, ev_len);
+ ev->status = HAL_HID_STATUS_OK;
+ bdaddr2android(&dev->dst, ev->bdaddr);
+
+ /* Report porotocol mode reply contains id after hdr, in boot
+ * protocol mode id doesn't exist */
+ if (dev->boot_dev) {
+ ev->len = len - 1;
+ memcpy(ev->data, buf + 1, ev->len);
+ } else {
+ ev->len = len - 2;
+ memcpy(ev->data, buf + 2, ev->len);
+ }
+
+send:
+ ipc_send(notification_io, HAL_SERVICE_ID_HIDHOST, HAL_EV_HID_GET_REPORT,
+ ev_len, ev, -1);
+ g_free(ev);
+}
+
static gboolean ctrl_io_watch_cb(GIOChannel *chan, gpointer data)
{
struct hid_device *dev = data;
@@ -303,6 +358,9 @@ static gboolean ctrl_io_watch_cb(GIOChannel *chan, gpointer data)
case HID_MSG_SET_PROTOCOL:
bt_hid_notify_protocol_mode(dev, buf, bread);
break;
+ case HID_MSG_GET_REPORT:
+ bt_hid_notify_get_report(dev, buf, bread);
+ break;
default:
DBG("unhandled hid msg type 0x%02x", dev->hid_msg);
}
@@ -738,9 +796,51 @@ static uint8_t bt_hid_set_protocol(struct hal_cmd_hid_set_protocol *cmd,
static uint8_t bt_hid_get_report(struct hal_cmd_hid_get_report *cmd,
uint16_t len)
{
- DBG("Not Implemented");
+ struct hid_device *dev;
+ GSList *l;
+ bdaddr_t dst;
+ int fd;
+ uint8_t *req;
+ uint8_t req_size;
- return HAL_STATUS_FAILED;
+ DBG("");
+
+ if (len < sizeof(*cmd))
+ return HAL_STATUS_INVALID;
+
+ android2bdaddr(&cmd->bdaddr, &dst);
+
+ l = g_slist_find_custom(devices, &dst, device_cmp);
+ if (!l)
+ return HAL_STATUS_FAILED;
+
+ dev = l->data;
+ dev->hid_msg = HID_MSG_GET_REPORT;
+ req_size = (cmd->buf > 0) ? 4 : 2;
+ req = g_try_malloc0(req_size);
+ if (!req)
+ return HAL_STATUS_NOMEM;
+
+ req[0] = HID_MSG_GET_REPORT | cmd->type;
+
+ if (cmd->buf > 0)
+ req[0] = req[0] | HID_GET_REPORT_SIZE_FIELD;
+
+ req[1] = cmd->id;
+
+ if (cmd->buf > 0)
+ bt_put_le16(cmd->buf, (req + 2));
+
+ fd = g_io_channel_unix_get_fd(dev->ctrl_io);
+
+ if (write(fd, req, req_size) < 0) {
+ error("error while querying device protocol");
+ g_free(req);
+ return HAL_STATUS_FAILED;
+ }
+
+ g_free(req);
+ return HAL_STATUS_SUCCESS;
}
static uint8_t bt_hid_set_report(struct hal_cmd_hid_set_report *cmd,
--
1.8.1.2
^ permalink raw reply related
* [PATCH 05/11] android/hid: Handle protocol mode notification in hal
From: Ravi kumar Veeramally @ 2013-11-04 22:20 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Ravi kumar Veeramally
In-Reply-To: <1383603615-9953-1-git-send-email-ravikumar.veeramally@linux.intel.com>
---
android/hal-hidhost.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/android/hal-hidhost.c b/android/hal-hidhost.c
index c20c785..a287e40 100644
--- a/android/hal-hidhost.c
+++ b/android/hal-hidhost.c
@@ -59,6 +59,15 @@ static void handle_info(void *buf)
bt_hh_cbacks->hid_info_cb((bt_bdaddr_t *) ev->bdaddr, info);
}
+static void handle_protocol_mode(void *buf)
+{
+ struct hal_ev_hid_protocol *ev = buf;
+
+ if (bt_hh_cbacks->protocol_mode_cb)
+ bt_hh_cbacks->protocol_mode_cb((bt_bdaddr_t *) ev->bdaddr,
+ ev->status, ev->mode);
+}
+
/* will be called from notification thread context */
void bt_notify_hh(uint16_t opcode, void *buf, uint16_t len)
{
@@ -72,6 +81,9 @@ void bt_notify_hh(uint16_t opcode, void *buf, uint16_t len)
case HAL_EV_HID_INFO:
handle_info(buf);
break;
+ case HAL_EV_HID_PROTO_MODE:
+ handle_protocol_mode(buf);
+ break;
default:
DBG("Unhandled callback opcode=0x%x", opcode);
break;
--
1.8.1.2
^ permalink raw reply related
* [PATCH 04/11] android/hid: Implement hid set protocol in daemon
From: Ravi kumar Veeramally @ 2013-11-04 22:20 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Ravi kumar Veeramally
In-Reply-To: <1383603615-9953-1-git-send-email-ravikumar.veeramally@linux.intel.com>
This patch requests hid device to set protocol mode and reads
reply message and sends notification to hal.
---
android/hid.c | 35 +++++++++++++++++++++++++++++++++--
1 file changed, 33 insertions(+), 2 deletions(-)
diff --git a/android/hid.c b/android/hid.c
index 9a5477d..115a1c5 100644
--- a/android/hid.c
+++ b/android/hid.c
@@ -56,6 +56,7 @@
/* HID message types */
#define HID_MSG_GET_PROTOCOL 0x60
+#define HID_MSG_SET_PROTOCOL 0x70
#define HID_MSG_DATA 0xa0
/* HID protocol header parameters */
@@ -299,6 +300,7 @@ static gboolean ctrl_io_watch_cb(GIOChannel *chan, gpointer data)
switch (dev->hid_msg) {
case HID_MSG_GET_PROTOCOL:
+ case HID_MSG_SET_PROTOCOL:
bt_hid_notify_protocol_mode(dev, buf, bread);
break;
default:
@@ -699,9 +701,38 @@ static uint8_t bt_hid_get_protocol(struct hal_cmd_hid_get_protocol *cmd,
static uint8_t bt_hid_set_protocol(struct hal_cmd_hid_set_protocol *cmd,
uint16_t len)
{
- DBG("Not Implemented");
+ struct hid_device *dev;
+ GSList *l;
+ bdaddr_t dst;
+ int fd;
+ uint8_t hdr[1];
- return HAL_STATUS_FAILED;
+ DBG("");
+
+ if (len < sizeof(*cmd))
+ return HAL_STATUS_INVALID;
+
+ android2bdaddr(&cmd->bdaddr, &dst);
+
+ l = g_slist_find_custom(devices, &dst, device_cmp);
+ if (!l)
+ return HAL_STATUS_FAILED;
+
+ dev = l->data;
+
+ if (dev->boot_dev)
+ return HAL_STATUS_UNSUPPORTED;
+
+ dev->hid_msg = HID_MSG_SET_PROTOCOL;
+ hdr[0] = HID_MSG_SET_PROTOCOL | cmd->mode;
+ fd = g_io_channel_unix_get_fd(dev->ctrl_io);
+
+ if (write(fd, hdr, sizeof(hdr)) < 0) {
+ error("error while setting device protocol");
+ return HAL_STATUS_FAILED;
+ }
+
+ return HAL_STATUS_SUCCESS;
}
static uint8_t bt_hid_get_report(struct hal_cmd_hid_get_report *cmd,
--
1.8.1.2
^ permalink raw reply related
* [PATCH 03/11] android/hid: Implement hid get protocol in daemon
From: Ravi kumar Veeramally @ 2013-11-04 22:20 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Ravi kumar Veeramally
In-Reply-To: <1383603615-9953-1-git-send-email-ravikumar.veeramally@linux.intel.com>
This patch requests hid device protocol mode and reads reply
message and sends notification to hal.
---
android/hal-msg.h | 9 +++++
android/hid.c | 108 ++++++++++++++++++++++++++++++++++++++++++++++++++++--
2 files changed, 113 insertions(+), 4 deletions(-)
diff --git a/android/hal-msg.h b/android/hal-msg.h
index f381862..214daa9 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -442,6 +442,8 @@ struct hal_ev_hid_conn_state {
uint8_t state;
} __attribute__((packed));
+#define HAL_HID_STATUS_OK 0x00
+
#define HAL_EV_HID_INFO 0x82
struct hal_ev_hid_info {
uint8_t bdaddr[6];
@@ -456,6 +458,13 @@ struct hal_ev_hid_info {
uint8_t descr[884];
} __attribute__((packed));
+#define HAL_EV_HID_PROTO_MODE 0x83
+struct hal_ev_hid_protocol {
+ uint8_t bdaddr[6];
+ uint8_t status;
+ uint8_t mode;
+} __attribute__((packed));
+
#define HAL_EV_AV_CONNECTION_STATE 0x81
struct hal_ev_av_connection_state {
uint8_t state;
diff --git a/android/hid.c b/android/hid.c
index c0c9aeb..9a5477d 100644
--- a/android/hid.c
+++ b/android/hid.c
@@ -54,6 +54,14 @@
#define L2CAP_PSM_HIDP_INTR 0x13
#define UHID_DEVICE_FILE "/dev/uhid"
+/* HID message types */
+#define HID_MSG_GET_PROTOCOL 0x60
+#define HID_MSG_DATA 0xa0
+
+/* HID protocol header parameters */
+#define HID_PROTO_BOOT 0x00
+#define HID_PROTO_REPORT 0x01
+
static GIOChannel *notification_io = NULL;
static GIOChannel *ctrl_io = NULL;
static GIOChannel *intr_io = NULL;
@@ -76,6 +84,7 @@ struct hid_device {
guint intr_watch;
int uhid_fd;
guint uhid_watch_id;
+ int hid_msg;
};
static int device_cmp(gconstpointer s, gconstpointer user_data)
@@ -243,12 +252,74 @@ static gboolean intr_watch_cb(GIOChannel *chan, GIOCondition cond,
return FALSE;
}
+static void bt_hid_notify_protocol_mode(struct hid_device *dev, uint8_t *buf,
+ int len)
+{
+ struct hal_ev_hid_protocol ev;
+ char address[18];
+
+ ba2str(&dev->dst, address);
+ DBG("device %s", address);
+
+ memset(&ev, 0, sizeof(ev));
+ bdaddr2android(&dev->dst, ev.bdaddr);
+
+ if (buf[0] == HID_MSG_DATA) {
+ ev.status = HAL_HID_STATUS_OK;
+ if (buf[1] == HID_PROTO_REPORT)
+ ev.mode = HAL_HID_REPORT_PROTOCOL;
+ else if (buf[1] == HID_PROTO_BOOT)
+ ev.mode = HAL_HID_BOOT_PROTOCOL;
+ else
+ ev.mode = HAL_HID_UNSUPPORTED_PROTOCOL;
+
+ } else {
+ ev.status = buf[0];
+ ev.mode = HAL_HID_UNSUPPORTED_PROTOCOL;
+ }
+
+ ipc_send(notification_io, HAL_SERVICE_ID_HIDHOST,
+ HAL_EV_HID_PROTO_MODE, sizeof(ev), &ev, -1);
+}
+
+static gboolean ctrl_io_watch_cb(GIOChannel *chan, gpointer data)
+{
+ struct hid_device *dev = data;
+ int fd, bread;
+ uint8_t buf[UHID_DATA_MAX];
+
+ DBG("");
+
+ fd = g_io_channel_unix_get_fd(chan);
+ bread = read(fd, buf, sizeof(buf));
+ if (bread < 0) {
+ error("read: %s(%d)", strerror(errno), -errno);
+ return TRUE;
+ }
+
+ switch (dev->hid_msg) {
+ case HID_MSG_GET_PROTOCOL:
+ bt_hid_notify_protocol_mode(dev, buf, bread);
+ break;
+ default:
+ DBG("unhandled hid msg type 0x%02x", dev->hid_msg);
+ }
+
+ /* reset msg type request */
+ dev->hid_msg = -1;
+
+ return TRUE;
+}
+
static gboolean ctrl_watch_cb(GIOChannel *chan, GIOCondition cond,
gpointer data)
{
struct hid_device *dev = data;
char address[18];
+ if (cond & G_IO_IN)
+ return ctrl_io_watch_cb(chan, data);
+
ba2str(&dev->dst, address);
bt_hid_notify_state(dev, HAL_HID_STATE_DISCONNECTED);
@@ -395,8 +466,8 @@ static void control_connect_cb(GIOChannel *chan, GError *conn_err,
}
dev->ctrl_watch = g_io_add_watch(dev->ctrl_io,
- G_IO_HUP | G_IO_ERR | G_IO_NVAL,
- ctrl_watch_cb, dev);
+ G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL,
+ ctrl_watch_cb, dev);
return;
@@ -591,9 +662,38 @@ static uint8_t bt_hid_info(struct hal_cmd_hid_set_info *cmd, uint16_t len)
static uint8_t bt_hid_get_protocol(struct hal_cmd_hid_get_protocol *cmd,
uint16_t len)
{
- DBG("Not Implemented");
+ struct hid_device *dev;
+ GSList *l;
+ bdaddr_t dst;
+ int fd;
+ uint8_t hdr[1];
- return HAL_STATUS_FAILED;
+ DBG("");
+
+ if (len < sizeof(*cmd))
+ return HAL_STATUS_INVALID;
+
+ android2bdaddr(&cmd->bdaddr, &dst);
+
+ l = g_slist_find_custom(devices, &dst, device_cmp);
+ if (!l)
+ return HAL_STATUS_FAILED;
+
+ dev = l->data;
+
+ if (dev->boot_dev)
+ return HAL_STATUS_UNSUPPORTED;
+
+ dev->hid_msg = HID_MSG_GET_PROTOCOL;
+ hdr[0] = HID_MSG_GET_PROTOCOL | cmd->mode;
+ fd = g_io_channel_unix_get_fd(dev->ctrl_io);
+
+ if (write(fd, hdr, sizeof(hdr)) < 0) {
+ error("error while querying device protocol");
+ return HAL_STATUS_FAILED;
+ }
+
+ return HAL_STATUS_SUCCESS;
}
static uint8_t bt_hid_set_protocol(struct hal_cmd_hid_set_protocol *cmd,
--
1.8.1.2
^ permalink raw reply related
* [PATCH 02/11] android/hid: Retrieve BOOT_DEVICE attribute from SDP and cache it
From: Ravi kumar Veeramally @ 2013-11-04 22:20 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Ravi kumar Veeramally
In-Reply-To: <1383603615-9953-1-git-send-email-ravikumar.veeramally@linux.intel.com>
It will be usefull to handle when application level requests
get or set protocol from hid device.
---
android/hid.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/android/hid.c b/android/hid.c
index 2498d2d..c0c9aeb 100644
--- a/android/hid.c
+++ b/android/hid.c
@@ -69,6 +69,7 @@ struct hid_device {
uint8_t country;
int rd_size;
void *rd_data;
+ uint8_t boot_dev;
GIOChannel *ctrl_io;
GIOChannel *intr_io;
guint ctrl_watch;
@@ -446,6 +447,10 @@ static void hid_sdp_search_cb(sdp_list_t *recs, int err, gpointer data)
if (data)
dev->subclass = data->val.uint8;
+ data = sdp_data_get(rec, SDP_ATTR_HID_BOOT_DEVICE);
+ if (data)
+ dev->boot_dev = data->val.uint8;
+
data = sdp_data_get(rec, SDP_ATTR_HID_DESCRIPTOR_LIST);
if (data) {
if (!SDP_IS_SEQ(data->dtd))
--
1.8.1.2
^ permalink raw reply related
* [PATCH 01/11] android/hid: Rename function name set_state to notify_state
From: Ravi kumar Veeramally @ 2013-11-04 22:20 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Ravi kumar Veeramally
In-Reply-To: <1383603615-9953-1-git-send-email-ravikumar.veeramally@linux.intel.com>
Renaming notification preparation function name from bt_hid_set_state
to bt_hid_notify_state. Rest of the funtions name will have proper
notify* names.
---
android/hid.c | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/android/hid.c b/android/hid.c
index 1ee8ed4..2498d2d 100644
--- a/android/hid.c
+++ b/android/hid.c
@@ -194,7 +194,7 @@ static gboolean intr_io_watch_cb(GIOChannel *chan, gpointer data)
return TRUE;
}
-static void bt_hid_set_state(struct hid_device *dev, uint8_t state)
+static void bt_hid_notify_state(struct hid_device *dev, uint8_t state)
{
struct hal_ev_hid_conn_state ev;
char address[18];
@@ -249,7 +249,7 @@ static gboolean ctrl_watch_cb(GIOChannel *chan, GIOCondition cond,
char address[18];
ba2str(&dev->dst, address);
- bt_hid_set_state(dev, HAL_HID_STATE_DISCONNECTED);
+ bt_hid_notify_state(dev, HAL_HID_STATE_DISCONNECTED);
/* Checking for intr_watch avoids a double g_io_channel_shutdown since
* it's likely that intr_watch_cb has been queued for dispatching in
@@ -296,6 +296,7 @@ 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_HID_STATE_NO_HID);
return -errno;
}
@@ -344,7 +345,7 @@ static void interrupt_connect_cb(GIOChannel *chan, GError *conn_err,
G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL,
intr_watch_cb, dev);
- bt_hid_set_state(dev, HAL_HID_STATE_CONNECTED);
+ bt_hid_notify_state(dev, HAL_HID_STATE_CONNECTED);
return;
@@ -374,7 +375,7 @@ static void control_connect_cb(GIOChannel *chan, GError *conn_err,
DBG("");
if (conn_err) {
- bt_hid_set_state(dev, HAL_HID_STATE_DISCONNECTED);
+ bt_hid_notify_state(dev, HAL_HID_STATE_DISCONNECTED);
error("%s", conn_err->message);
goto failed;
}
@@ -491,7 +492,7 @@ static void hid_sdp_search_cb(sdp_list_t *recs, int err, gpointer data)
return;
fail:
- bt_hid_set_state(dev, HAL_HID_STATE_DISCONNECTED);
+ bt_hid_notify_state(dev, HAL_HID_STATE_DISCONNECTED);
hid_device_free(dev);
}
@@ -531,7 +532,7 @@ static uint8_t bt_hid_connect(struct hal_cmd_hid_connect *cmd, uint16_t len)
}
devices = g_slist_append(devices, dev);
- bt_hid_set_state(dev, HAL_HID_STATE_CONNECTING);
+ bt_hid_notify_state(dev, HAL_HID_STATE_CONNECTING);
return HAL_STATUS_SUCCESS;
}
@@ -563,7 +564,7 @@ static uint8_t bt_hid_disconnect(struct hal_cmd_hid_disconnect *cmd,
if (dev->ctrl_io)
g_io_channel_shutdown(dev->ctrl_io, TRUE, NULL);
- bt_hid_set_state(dev, HAL_HID_STATE_DISCONNECTING);
+ bt_hid_notify_state(dev, HAL_HID_STATE_DISCONNECTING);
return HAL_STATUS_SUCCESS;
}
@@ -715,7 +716,7 @@ static void connect_cb(GIOChannel *chan, GError *err, gpointer user_data)
dev->ctrl_watch = g_io_add_watch(dev->ctrl_io,
G_IO_HUP | G_IO_ERR | G_IO_NVAL,
ctrl_watch_cb, dev);
- bt_hid_set_state(dev, HAL_HID_STATE_CONNECTING);
+ bt_hid_notify_state(dev, HAL_HID_STATE_CONNECTING);
break;
case L2CAP_PSM_HIDP_INTR:
@@ -728,7 +729,7 @@ static void connect_cb(GIOChannel *chan, GError *err, gpointer user_data)
dev->intr_watch = g_io_add_watch(dev->intr_io,
G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL,
intr_watch_cb, dev);
- bt_hid_set_state(dev, HAL_HID_STATE_CONNECTED);
+ bt_hid_notify_state(dev, HAL_HID_STATE_CONNECTED);
break;
}
}
--
1.8.1.2
^ permalink raw reply related
* [PATCH 00/11] Implemented hid interfaces in daemon and hal
From: Ravi kumar Veeramally @ 2013-11-04 22:20 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Ravi kumar Veeramally
This patch set implements get/set protocol and get/set report
interfaces and supported functionality in daemon. Sending notifications
and notification handling in hal. Few naming fixes and error handling.
And last handling of few uHID events.
Ravi kumar Veeramally (11):
android/hid: Rename function name set_state to notify_state
android/hid: Retrieve BOOT_DEVICE attribute from SDP and cache it
android/hid: Implement hid get protocol in daemon
android/hid: Implement hid set protocol in daemon
android/hid: Handle protocol mode notification in hal
android/hid: Implement hid get report in daemon
android/hid: Implement hid set report in daemon
android/hid: Handle get report notification in hal
android/hid: Replace header checking magic number with defines
android/hid: Handle invalid parameters in hal
android/hid: Handle uhid events
android/hal-hidhost.c | 40 +++++-
android/hal-msg.h | 18 +++
android/hid.c | 353 +++++++++++++++++++++++++++++++++++++++++++++++---
3 files changed, 384 insertions(+), 27 deletions(-)
--
1.8.1.2
^ permalink raw reply
* Re: [PATCH 1/3] android: Add support for handling get properties commands
From: Johan Hedberg @ 2013-11-04 19:32 UTC (permalink / raw)
To: Szymon Janc, linux-bluetooth
In-Reply-To: <20131104191918.GE13837@x220.p-661hnu-f1>
Hi,
On Mon, Nov 04, 2013, Johan Hedberg wrote:
> Hi Szymon,
>
> On Mon, Nov 04, 2013, Szymon Janc wrote:
> > When this commands is received all properties shall be reported to HAL.
> > ---
> > android/adapter.c | 17 +++++++++++++++++
> > 1 file changed, 17 insertions(+)
>
> This patch doesn't compile:
>
> CC android/adapter.o
> android/adapter.c: In function ‘get_properties’:
> android/adapter.c:1125:2: error: implicit declaration of function ‘send_adapter_address’ [-Werror=implicit-function-declaration]
> send_adapter_address();
> ^
> cc1: all warnings being treated as errors
> make[1]: *** [android/adapter.o] Error 1
Since this was a rather trivial thing introduced by a rename patch from
Andrei E, I went ahead and fixed it myself and applied all three
patches.
Johan
^ permalink raw reply
* Re: [PATCH 1/3] android: Add support for handling get properties commands
From: Johan Hedberg @ 2013-11-04 19:19 UTC (permalink / raw)
To: Szymon Janc; +Cc: linux-bluetooth
In-Reply-To: <1383579265-24614-1-git-send-email-szymon.janc@tieto.com>
Hi Szymon,
On Mon, Nov 04, 2013, Szymon Janc wrote:
> When this commands is received all properties shall be reported to HAL.
> ---
> android/adapter.c | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
This patch doesn't compile:
CC android/adapter.o
android/adapter.c: In function ‘get_properties’:
android/adapter.c:1125:2: error: implicit declaration of function ‘send_adapter_address’ [-Werror=implicit-function-declaration]
send_adapter_address();
^
cc1: all warnings being treated as errors
make[1]: *** [android/adapter.o] Error 1
Johan
^ permalink raw reply
* Re: [PATCHv3 1/4] android/daemon: Implement get adapter name
From: Johan Hedberg @ 2013-11-04 19:18 UTC (permalink / raw)
To: Andrei Emeltchenko; +Cc: linux-bluetooth
In-Reply-To: <1383571358-4942-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
Hi Andrei,
On Mon, Nov 04, 2013, Andrei Emeltchenko wrote:
> Use adapter_name_changed for get_property call.
> ---
> android/adapter.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
All four patches have been applied. Thanks.
Johan
^ permalink raw reply
* Re: [PATCH] android/client: Fix annoying delay in command line
From: Johan Hedberg @ 2013-11-04 19:15 UTC (permalink / raw)
To: Jerzy Kasenberg; +Cc: linux-bluetooth
In-Reply-To: <1383564824-32337-1-git-send-email-jerzy.kasenberg@tieto.com>
Hi Jerzy,
On Mon, Nov 04, 2013, Jerzy Kasenberg wrote:
> Move fflush(stdout) to after prints and user input.
> This removes delay of showing prompt.
> ---
> Same effect could be achieved by calling setbuf(stdout, NULL)
> in terminal_setup() then all fflush calls could be removed.
>
> If you think this should be better approach, I will change it.
>
> android/client/pollhandler.c | 5 -----
> android/client/terminal.c | 6 ++++++
> 2 files changed, 6 insertions(+), 5 deletions(-)
Applied. Thanks.
Johan
^ permalink raw reply
* Re: [PATCH] android/client: Change interface name to bluetooth
From: Johan Hedberg @ 2013-11-04 19:14 UTC (permalink / raw)
To: Jerzy Kasenberg; +Cc: linux-bluetooth
In-Reply-To: <1383564579-32025-1-git-send-email-jerzy.kasenberg@tieto.com>
Hi Jerzy,
On Mon, Nov 04, 2013, Jerzy Kasenberg wrote:
> This changes 'adapter' to 'bluetooth' as name of HAL interface.
> This name matches name fond in bluetooth.h where all interfaces
> are defined.
> ---
> android/client/if-bt.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Applied. Thanks.
Johan
^ permalink raw reply
* Re: [PATCH BlueZ 1/4] android: Add initial skeleton for a2dp in the daemon
From: Johan Hedberg @ 2013-11-04 19:13 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: linux-bluetooth
In-Reply-To: <1383562617-9029-1-git-send-email-luiz.dentz@gmail.com>
Hi Luiz,
On Mon, Nov 04, 2013, Luiz Augusto von Dentz wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
>
> ---
> android/Android.mk | 1 +
> android/Makefile.am | 1 +
> android/a2dp.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++
> android/a2dp.h | 25 ++++++++++++++++++++++++
> android/main.c | 9 +++++++++
> 5 files changed, 92 insertions(+)
> create mode 100644 android/a2dp.c
> create mode 100644 android/a2dp.h
All four patches have been applied. Thanks.
Johan
^ permalink raw reply
* Re: [PATCH v2] hid2hci: fix regression in /dev format after moving away from libusb
From: Johan Hedberg @ 2013-11-04 18:11 UTC (permalink / raw)
To: Giovanni Campagna; +Cc: linux-bluetooth
In-Reply-To: <1380798229-4319-1-git-send-email-scampa.giovanni@gmail.com>
Hi Giovanni,
On Thu, Oct 03, 2013, Giovanni Campagna wrote:
> The paths under /dev, in the default udev configuration, are formatted
> with two leading zeros, but the number obtained from sysfs don't have
> them, so we must convert them to integers and reformat them.
> ---
> tools/hid2hci.c | 15 +++++++++------
> 1 file changed, 9 insertions(+), 6 deletions(-)
Applied. Thanks.
Johan
^ permalink raw reply
* [PATCH 2/2] Bluetooth: Refactor hci_disconn_complete_evt
From: Andre Guedes @ 2013-11-04 17:57 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1383587847-16523-1-git-send-email-andre.guedes@openbossa.org>
hci_disconn_complete_evt() logic is more complicated than what it
should be, making it hard to follow and add new features.
So this patch does some code refactoring by handling the error cases
in the beginning of the function and by moving the main flow into the
first level of function scope. No change is done in the event handling
logic itself.
Besides organizing this messy code, this patch makes easier to add
code for handling LE auto connection (which will be added in a further
patch).
Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
---
net/bluetooth/hci_event.c | 53 +++++++++++++++++++++++------------------------
1 file changed, 26 insertions(+), 27 deletions(-)
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 560296d..8054e3c 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -1779,7 +1779,9 @@ static u8 hci_to_mgmt_reason(u8 err)
static void hci_disconn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
{
struct hci_ev_disconn_complete *ev = (void *) skb->data;
+ u8 reason = hci_to_mgmt_reason(ev->reason);
struct hci_conn *conn;
+ u8 type;
BT_DBG("%s status 0x%2.2x", hdev->name, ev->status);
@@ -1789,40 +1791,37 @@ static void hci_disconn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
if (!conn)
goto unlock;
- if (ev->status == 0)
- conn->state = BT_CLOSED;
-
if (ev->status) {
mgmt_disconnect_failed(hdev, &conn->dst, conn->type,
conn->dst_type, ev->status);
- } else {
- u8 reason = hci_to_mgmt_reason(ev->reason);
-
- mgmt_device_disconnected(hdev, &conn->dst, conn->type,
- conn->dst_type, reason);
+ goto unlock;
}
- if (ev->status == 0) {
- u8 type = conn->type;
+ conn->state = BT_CLOSED;
- if (type == ACL_LINK && conn->flush_key)
- hci_remove_link_key(hdev, &conn->dst);
- hci_proto_disconn_cfm(conn, ev->reason);
- hci_conn_del(conn);
+ mgmt_device_disconnected(hdev, &conn->dst, conn->type,
+ conn->dst_type, reason);
- /* Re-enable advertising if necessary, since it might
- * have been disabled by the connection. From the
- * HCI_LE_Set_Advertise_Enable command description in
- * the core specification (v4.0):
- * "The Controller shall continue advertising until the Host
- * issues an LE_Set_Advertise_Enable command with
- * Advertising_Enable set to 0x00 (Advertising is disabled)
- * or until a connection is created or until the Advertising
- * is timed out due to Directed Advertising."
- */
- if (type == LE_LINK)
- mgmt_reenable_advertising(hdev);
- }
+ if (conn->type == ACL_LINK && conn->flush_key)
+ hci_remove_link_key(hdev, &conn->dst);
+
+ type = conn->type;
+
+ hci_proto_disconn_cfm(conn, ev->reason);
+ hci_conn_del(conn);
+
+ /* Re-enable advertising if necessary, since it might
+ * have been disabled by the connection. From the
+ * HCI_LE_Set_Advertise_Enable command description in
+ * the core specification (v4.0):
+ * "The Controller shall continue advertising until the Host
+ * issues an LE_Set_Advertise_Enable command with
+ * Advertising_Enable set to 0x00 (Advertising is disabled)
+ * or until a connection is created or until the Advertising
+ * is timed out due to Directed Advertising."
+ */
+ if (type == LE_LINK)
+ mgmt_reenable_advertising(hdev);
unlock:
hci_dev_unlock(hdev);
--
1.8.4
^ permalink raw reply related
* [PATCH 1/2] Bluetooth: Remove unneeded check in hci_disconn_complete_evt()
From: Andre Guedes @ 2013-11-04 17:57 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1383587847-16523-1-git-send-email-andre.guedes@openbossa.org>
According to b644ba336 (patch that introduced HCI_CONN_MGMT_CONNECTED
flag), the HCI_CONN_MGMT_CONNECTED flag tracks when mgmt has been
notified about the connection.
That being said, there is no point in checking this flag in hci_
disconn_complete_evt() since neither mgmt_disconnect_failed() nor
mgmt_device_disconnected() depend on it. Below follows more details:
* mgmt_disconnect_failed() removes pending MGMT_OP_DISCONNECT
commands, it doesn't matter if that connection was notified or not.
* mgmt_device_disconnected() sends the mgmt event only if the link
type is ACL_LINK or LE_LINK. For those connection type, the flag is
always set.
So this patch removes the HCI_CONN_MGMT_CONNECTED check.
Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
---
net/bluetooth/hci_event.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 142aa61..560296d 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -1792,16 +1792,14 @@ static void hci_disconn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
if (ev->status == 0)
conn->state = BT_CLOSED;
- if (test_and_clear_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags)) {
- if (ev->status) {
- mgmt_disconnect_failed(hdev, &conn->dst, conn->type,
- conn->dst_type, ev->status);
- } else {
- u8 reason = hci_to_mgmt_reason(ev->reason);
+ if (ev->status) {
+ mgmt_disconnect_failed(hdev, &conn->dst, conn->type,
+ conn->dst_type, ev->status);
+ } else {
+ u8 reason = hci_to_mgmt_reason(ev->reason);
- mgmt_device_disconnected(hdev, &conn->dst, conn->type,
- conn->dst_type, reason);
- }
+ mgmt_device_disconnected(hdev, &conn->dst, conn->type,
+ conn->dst_type, reason);
}
if (ev->status == 0) {
--
1.8.4
^ permalink raw reply related
* [PATCH 0/2] Disconnect complete refactoring
From: Andre Guedes @ 2013-11-04 17:57 UTC (permalink / raw)
To: linux-bluetooth
Hi all,
This small patch set contains the remaining patches from "[RFC] Disconnect
complete refactoring" patch set which weren't applied due to coding style
issues.
Andre Guedes (2):
Bluetooth: Remove unneeded check in hci_disconn_complete_evt()
Bluetooth: Refactor hci_disconn_complete_evt
net/bluetooth/hci_event.c | 59 ++++++++++++++++++++++-------------------------
1 file changed, 28 insertions(+), 31 deletions(-)
--
1.8.4
^ permalink raw reply
* Re: [RFC 4/5] Bluetooth: Remove unneeded check in hci_disconn_complete_evt()
From: Andre Guedes @ 2013-11-04 17:15 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth@vger.kernel.org development
In-Reply-To: <4794090B-F1E7-4B60-860A-3BD42CE6CA93@holtmann.org>
Hi Marcel,
On 02/11/13 15:14, Marcel Holtmann wrote:
> Hi Andre,
>
>> According to b644ba336 (patch that introduced HCI_CONN_MGMT_CONNECTED
>> flag), the HCI_CONN_MGMT_CONNECTED flag tracks when mgmt has been
>> notified about the connection.
>>
>> That being said, there is no point in checking this flag in hci_
>> disconn_complete_evt() since neither mgmt_disconnect_failed() nor
>> mgmt_device_disconnected() depend on it. Below follows more details:
>> * mgmt_disconnect_failed() removes pending MGMT_OP_DISCONNECT
>> commands, it doesn't matter if that connection was notified or not.
>> * mgmt_device_disconnected() sends the mgmt event only if the link
>> type is ACL_LINK or LE_LINK. For those connection type, the flag is
>> always set.
>>
>> So this patch removes the HCI_CONN_MGMT_CONNECTED check.
>>
>> Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
>> ---
>> net/bluetooth/hci_event.c | 16 +++++++---------
>> 1 file changed, 7 insertions(+), 9 deletions(-)
>>
>> diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
>> index 4673cfb..9225a9c 100644
>> --- a/net/bluetooth/hci_event.c
>> +++ b/net/bluetooth/hci_event.c
>> @@ -1795,16 +1795,14 @@ static void hci_disconn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
>> if (ev->status == 0)
>> conn->state = BT_CLOSED;
>>
>> - if (test_and_clear_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags)) {
>> - if (ev->status) {
>> - mgmt_disconnect_failed(hdev, &conn->dst, conn->type,
>> - conn->dst_type, ev->status);
>> - } else {
>> - u8 reason = hci_to_mgmt_reason(ev->reason);
>> + if (ev->status) {
>> + mgmt_disconnect_failed(hdev, &conn->dst, conn->type,
>> + conn->dst_type, ev->status);
>
> something went wrong with the coding style here.
>
>> + } else {
>> + u8 reason = hci_to_mgmt_reason(ev->reason);
>>
>> - mgmt_device_disconnected(hdev, &conn->dst, conn->type,
>> - conn->dst_type, reason);
>> - }
>> + mgmt_device_disconnected(hdev, &conn->dst, conn->type,
>> + conn->dst_type, reason);
>
> And here.
I'm fixing it.
Thanks,
Andre
^ permalink raw reply
* Re: [PATCH] tools/hci2hid: properly format device path
From: Matthew Monaco @ 2013-11-04 16:52 UTC (permalink / raw)
To: Vinicius Costa Gomes, Bastien Nocera; +Cc: linux-bluetooth
In-Reply-To: <20131104164206.GB31305@molly.amr.corp.intel.com>
Ah, didn't see it in git. Sorry about the noise.
On 11/04/2013 09:42 AM, Vinicius Costa Gomes wrote:
> Hi Bastien,
>
> On 17:23 Mon 04 Nov, Bastien Nocera wrote:
>> On Mon, 2013-11-04 at 14:18 -0200, Vinicius Costa Gomes wrote:
>>> Hi Matthew,
>>>
>>> On 18:46 Sun 03 Nov, Matthew Monaco wrote:
>>>> From: Matthew Monaco <matthew.monaco@0x01b.net>
>>>>
>>>> ---
>>>> Hello! I hope this is the correct place to send a bugfix for bluez.
>>>> tools/hid2hci.c | 15 +++++++++------
>>>> 1 file changed, 9 insertions(+), 6 deletions(-)
>>>
>>> The patch itself looks good.
>>>
>>> What I think is missing is a better description of the problem it solves, I
>>> would suggest including in the commit message the values of 'path' for before
>>> and after the patch, for a situation that the current implementation doesn't
>>> work.
>>>
>>> Changing the subject line to something like: "tools: Fix wrong paths for
>>> adapters" would make it easier to tell that this patch is indeed a bug fix.
>>
>> Isn't this the same patch Giovanni sent a couple of weeks ago?
>>
>> http://thread.gmane.org/gmane.linux.bluez.kernel/38329
>
> Yeah, same fix. Thanks for noticing.
>
>>
>> Cheers
>>
>
>
> Cheers,
>
^ permalink raw reply
* Re: [PATCH] tools/hci2hid: properly format device path
From: Vinicius Costa Gomes @ 2013-11-04 16:42 UTC (permalink / raw)
To: Bastien Nocera; +Cc: Matthew Monaco, linux-bluetooth
In-Reply-To: <1383582221.3373.15.camel@nuvo>
Hi Bastien,
On 17:23 Mon 04 Nov, Bastien Nocera wrote:
> On Mon, 2013-11-04 at 14:18 -0200, Vinicius Costa Gomes wrote:
> > Hi Matthew,
> >
> > On 18:46 Sun 03 Nov, Matthew Monaco wrote:
> > > From: Matthew Monaco <matthew.monaco@0x01b.net>
> > >
> > > ---
> > > Hello! I hope this is the correct place to send a bugfix for bluez.
> > > tools/hid2hci.c | 15 +++++++++------
> > > 1 file changed, 9 insertions(+), 6 deletions(-)
> >
> > The patch itself looks good.
> >
> > What I think is missing is a better description of the problem it solves, I
> > would suggest including in the commit message the values of 'path' for before
> > and after the patch, for a situation that the current implementation doesn't
> > work.
> >
> > Changing the subject line to something like: "tools: Fix wrong paths for
> > adapters" would make it easier to tell that this patch is indeed a bug fix.
>
> Isn't this the same patch Giovanni sent a couple of weeks ago?
>
> http://thread.gmane.org/gmane.linux.bluez.kernel/38329
Yeah, same fix. Thanks for noticing.
>
> Cheers
>
Cheers,
--
Vinicius
^ permalink raw reply
* Re: [PATCH v2] hid2hci: fix regression in /dev format after moving away from libusb
From: Vinicius Costa Gomes @ 2013-11-04 16:37 UTC (permalink / raw)
To: Giovanni Campagna; +Cc: linux-bluetooth
In-Reply-To: <1380798229-4319-1-git-send-email-scampa.giovanni@gmail.com>
Hi,
On 13:03 Thu 03 Oct, Giovanni Campagna wrote:
> From: Giovanni Campagna <gcampagna@src.gnome.org>
>
> The paths under /dev, in the default udev configuration, are formatted
> with two leading zeros, but the number obtained from sysfs don't have
> them, so we must convert them to integers and reformat them.
> ---
> tools/hid2hci.c | 15 +++++++++------
> 1 file changed, 9 insertions(+), 6 deletions(-)
Ack.
Cheers,
--
Vinicius
^ permalink raw reply
* Re: [PATCH] tools/hci2hid: properly format device path
From: Bastien Nocera @ 2013-11-04 16:23 UTC (permalink / raw)
To: Vinicius Costa Gomes; +Cc: Matthew Monaco, linux-bluetooth
In-Reply-To: <20131104161805.GA32089@molly.amr.corp.intel.com>
On Mon, 2013-11-04 at 14:18 -0200, Vinicius Costa Gomes wrote:
> Hi Matthew,
>
> On 18:46 Sun 03 Nov, Matthew Monaco wrote:
> > From: Matthew Monaco <matthew.monaco@0x01b.net>
> >
> > ---
> > Hello! I hope this is the correct place to send a bugfix for bluez.
> > tools/hid2hci.c | 15 +++++++++------
> > 1 file changed, 9 insertions(+), 6 deletions(-)
>
> The patch itself looks good.
>
> What I think is missing is a better description of the problem it solves, I
> would suggest including in the commit message the values of 'path' for before
> and after the patch, for a situation that the current implementation doesn't
> work.
>
> Changing the subject line to something like: "tools: Fix wrong paths for
> adapters" would make it easier to tell that this patch is indeed a bug fix.
Isn't this the same patch Giovanni sent a couple of weeks ago?
http://thread.gmane.org/gmane.linux.bluez.kernel/38329
Cheers
^ permalink raw reply
* Re: [PATCH] tools/hci2hid: properly format device path
From: Vinicius Costa Gomes @ 2013-11-04 16:18 UTC (permalink / raw)
To: Matthew Monaco; +Cc: linux-bluetooth
In-Reply-To: <963b569308352e0b0fc18a0a17e2b0c0fe721d72.1383529026.git.matthew.monaco@0x01b.net>
Hi Matthew,
On 18:46 Sun 03 Nov, Matthew Monaco wrote:
> From: Matthew Monaco <matthew.monaco@0x01b.net>
>
> ---
> Hello! I hope this is the correct place to send a bugfix for bluez.
> tools/hid2hci.c | 15 +++++++++------
> 1 file changed, 9 insertions(+), 6 deletions(-)
The patch itself looks good.
What I think is missing is a better description of the problem it solves, I
would suggest including in the commit message the values of 'path' for before
and after the patch, for a situation that the current implementation doesn't
work.
Changing the subject line to something like: "tools: Fix wrong paths for
adapters" would make it easier to tell that this patch is indeed a bug fix.
>
> diff --git a/tools/hid2hci.c b/tools/hid2hci.c
> index bb8a521..8f22047 100644
> --- a/tools/hid2hci.c
> +++ b/tools/hid2hci.c
> @@ -221,18 +221,21 @@ static int usb_switch_dell(int fd, enum mode mode)
> static int find_device(struct udev_device *udev_dev)
> {
> char path[PATH_MAX];
> - const char *busnum, *devnum;
> + const char *str;
> + long int busnum, devnum;
> int fd;
>
> - busnum = udev_device_get_sysattr_value(udev_dev, "busnum");
> - if (!busnum)
> + str = udev_device_get_sysattr_value(udev_dev, "busnum");
> + if (!str)
> return -1;
> + busnum = strtol(str, NULL, 0);
>
> - devnum = udev_device_get_sysattr_value(udev_dev, "devnum");
> - if (!devnum)
> + str = udev_device_get_sysattr_value(udev_dev, "devnum");
> + if (!str)
> return -1;
> + devnum = strtol(str, NULL, 0);
>
> - snprintf(path, sizeof(path), "/dev/bus/usb/%s/%s", busnum, devnum);
> + snprintf(path, sizeof(path), "/dev/bus/usb/%03d/%03d", busnum, devnum);
>
> fd = open(path, O_RDWR, O_CLOEXEC);
> if (fd < 0) {
> --
> 1.8.4.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
Cheers,
--
Vinicius
^ permalink raw reply
* [PATCH] Bluetooth: ath3k: Add support for a new AR3012 device
From: Sujith Manoharan @ 2013-11-04 16:08 UTC (permalink / raw)
To: linux-bluetooth; +Cc: gustavo
T: Bus=02 Lev=01 Prnt=01 Port=04 Cnt=01 Dev#= 9 Spd=12 MxCh= 0
D: Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1
P: Vendor=0489 ProdID=e05f Rev= 0.02
C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA
A: FirstIf#= 0 IfCount= 2 Cls=e0(wlcon) Sub=01 Prot=01
I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
Reported-by: Joshua Richenhagen <richenhagen@gmail.com>
Signed-off-by: Sujith Manoharan <sujith@msujith.org>
---
drivers/bluetooth/ath3k.c | 2 ++
drivers/bluetooth/btusb.c | 1 +
2 files changed, 3 insertions(+)
diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c
index 6bfc1bb..32582ec 100644
--- a/drivers/bluetooth/ath3k.c
+++ b/drivers/bluetooth/ath3k.c
@@ -96,6 +96,7 @@ static const struct usb_device_id ath3k_table[] = {
{ USB_DEVICE(0x13d3, 0x3402) },
{ USB_DEVICE(0x0cf3, 0x3121) },
{ USB_DEVICE(0x0cf3, 0xe003) },
+ { USB_DEVICE(0x0489, 0xe05f) },
/* Atheros AR5BBU12 with sflash firmware */
{ USB_DEVICE(0x0489, 0xE02C) },
@@ -138,6 +139,7 @@ static const struct usb_device_id ath3k_blist_tbl[] = {
{ USB_DEVICE(0x13d3, 0x3402), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x0cf3, 0x3121), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x0cf3, 0xe003), .driver_info = BTUSB_ATH3012 },
+ { USB_DEVICE(0x0489, 0xe05f), .driver_info = BTUSB_ATH3012 },
/* Atheros AR5BBU22 with sflash firmware */
{ USB_DEVICE(0x0489, 0xE03C), .driver_info = BTUSB_ATH3012 },
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 30868fa..9ce82ef 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -163,6 +163,7 @@ static const struct usb_device_id blacklist_table[] = {
{ USB_DEVICE(0x13d3, 0x3402), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x0cf3, 0x3121), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x0cf3, 0xe003), .driver_info = BTUSB_ATH3012 },
+ { USB_DEVICE(0x0489, 0xe05f), .driver_info = BTUSB_ATH3012 },
/* Atheros AR5BBU12 with sflash firmware */
{ USB_DEVICE(0x0489, 0xe02c), .driver_info = BTUSB_IGNORE },
--
1.8.4.2
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox