* [PATCH 1/3] android/hidhost: Handle uhid output and feature events
@ 2013-11-11 12:15 Ravi kumar Veeramally
2013-11-11 12:15 ` [PATCH 2/3] android/hidhost: Remove deprecated idle opcode from ipc document Ravi kumar Veeramally
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Ravi kumar Veeramally @ 2013-11-11 12:15 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Ravi kumar Veeramally
Data read on uhid events output and feature has to be send through
SET_REPORT request to HID device.
---
android/hidhost.c | 37 ++++++++++++++++++++++++++++++++++++-
1 file changed, 36 insertions(+), 1 deletion(-)
diff --git a/android/hidhost.c b/android/hidhost.c
index 683938f..816fe3e 100644
--- a/android/hidhost.c
+++ b/android/hidhost.c
@@ -155,7 +155,42 @@ static void hid_device_free(struct hid_device *dev)
static void handle_uhid_event(struct hid_device *dev, struct uhid_event *ev)
{
- DBG("UHID_OUTPUT UHID_FEATURE unsupported");
+ int fd;
+ uint8_t *req = NULL;
+ uint8_t req_size = 0;
+
+ if (!(dev->ctrl_io))
+ return;
+
+ switch (ev->type) {
+ case UHID_OUTPUT:
+ req_size = 1 + ev->u.output.size;
+ req = g_try_malloc0(req_size);
+ if (!req)
+ return;
+
+ req[0] = HID_MSG_SET_REPORT | HID_DATA_TYPE_OUTPUT;
+ memcpy(req + 1, ev->u.output.data, ev->u.output.size);
+ break;
+
+ case UHID_FEATURE:
+ req_size = sizeof(struct uhid_feature_req);
+ req = g_try_malloc0(req_size);
+ if (!req)
+ return;
+
+ req[0] = HID_MSG_SET_REPORT | HID_DATA_TYPE_FEATURE;
+ memcpy(req + 1, (ev + sizeof(ev->type)), req_size - 1);
+ break;
+ }
+
+ fd = g_io_channel_unix_get_fd(dev->ctrl_io);
+
+ if (write(fd, req, req_size) < 0)
+ error("error writing hid_set_report: %s (%d)",
+ strerror(errno), errno);
+
+ g_free(req);
}
static gboolean uhid_event_cb(GIOChannel *io, GIOCondition cond,
--
1.8.3.2
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH 2/3] android/hidhost: Remove deprecated idle opcode from ipc document
2013-11-11 12:15 [PATCH 1/3] android/hidhost: Handle uhid output and feature events Ravi kumar Veeramally
@ 2013-11-11 12:15 ` Ravi kumar Veeramally
2013-11-11 23:05 ` Marcel Holtmann
2013-11-11 12:15 ` [PATCH 3/3] android/hidhost: Set info request from HAL is not supported Ravi kumar Veeramally
2013-11-12 10:11 ` [PATCH 1/3] android/hidhost: Handle uhid output and feature events Ravi Kumar Veeramally
2 siblings, 1 reply; 8+ messages in thread
From: Ravi kumar Veeramally @ 2013-11-11 12:15 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Ravi kumar Veeramally
Idle time is deprecated in HID 1_1. So remove it from ipc document
and update GET_REPORT and VIRTUAL_UNPLUG opcode values.
---
android/hal-ipc-api.txt | 10 ++--------
android/hal-msg.h | 4 ++--
2 files changed, 4 insertions(+), 10 deletions(-)
diff --git a/android/hal-ipc-api.txt b/android/hal-ipc-api.txt
index 91ea280..57f4c13 100644
--- a/android/hal-ipc-api.txt
+++ b/android/hal-ipc-api.txt
@@ -614,20 +614,14 @@ Notifications:
0x01 = Boot
0xff = Unsupported
- Opcode 0x84 - Idle Time notification
-
- Notification parameters: Remote address (6 octets)
- Status (1 octet)
- Idle time (2 octets)
-
- Opcode 0x85 - Get Report notification
+ Opcode 0x84 - Get Report notification
Notification parameters: Remote address (6 octets)
Status (1 octet)
Report length (2 octets)
Report data (variable)
- Opcode 0x86 - Virtual Unplug notification
+ Opcode 0x85 - Virtual Unplug notification
Notification parameters: Remote address (6 octets)
Status (1 octet)
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 569c8ea..1d20afd 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -472,7 +472,7 @@ struct hal_ev_hidhost_proto_mode {
uint8_t mode;
} __attribute__((packed));
-#define HAL_EV_HIDHOST_GET_REPORT 0x85
+#define HAL_EV_HIDHOST_GET_REPORT 0x84
struct hal_ev_hidhost_get_report {
uint8_t bdaddr[6];
uint8_t status;
@@ -480,7 +480,7 @@ struct hal_ev_hidhost_get_report {
uint8_t data[0];
} __attribute__((packed));
-#define HAL_EV_HIDHOST_VIRTUAL_UNPLUG 0x86
+#define HAL_EV_HIDHOST_VIRTUAL_UNPLUG 0x85
struct hal_ev_hidhost_virtual_unplug {
uint8_t bdaddr[6];
uint8_t status;
--
1.8.3.2
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH 2/3] android/hidhost: Remove deprecated idle opcode from ipc document
2013-11-11 12:15 ` [PATCH 2/3] android/hidhost: Remove deprecated idle opcode from ipc document Ravi kumar Veeramally
@ 2013-11-11 23:05 ` Marcel Holtmann
2013-11-12 9:29 ` Ravi Kumar Veeramally
0 siblings, 1 reply; 8+ messages in thread
From: Marcel Holtmann @ 2013-11-11 23:05 UTC (permalink / raw)
To: Ravi kumar Veeramally; +Cc: linux-bluetooth@vger.kernel.org development
Hi Ravi,
> Idle time is deprecated in HID 1_1. So remove it from ipc document
> and update GET_REPORT and VIRTUAL_UNPLUG opcode values.
> ---
> android/hal-ipc-api.txt | 10 ++--------
> android/hal-msg.h | 4 ++--
> 2 files changed, 4 insertions(+), 10 deletions(-)
>
> diff --git a/android/hal-ipc-api.txt b/android/hal-ipc-api.txt
> index 91ea280..57f4c13 100644
> --- a/android/hal-ipc-api.txt
> +++ b/android/hal-ipc-api.txt
> @@ -614,20 +614,14 @@ Notifications:
> 0x01 = Boot
> 0xff = Unsupported
>
> - Opcode 0x84 - Idle Time notification
> -
> - Notification parameters: Remote address (6 octets)
> - Status (1 octet)
> - Idle time (2 octets)
so what does HID_1.1 actually mean? I still see this notification in bt_hh.h.
Regards
Marcel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/3] android/hidhost: Remove deprecated idle opcode from ipc document
2013-11-11 23:05 ` Marcel Holtmann
@ 2013-11-12 9:29 ` Ravi Kumar Veeramally
2013-11-12 14:00 ` Ravi Kumar Veeramally
2013-11-12 15:57 ` Marcel Holtmann
0 siblings, 2 replies; 8+ messages in thread
From: Ravi Kumar Veeramally @ 2013-11-12 9:29 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth@vger.kernel.org development
Hi Marcel,
On 11/12/2013 01:05 AM, Marcel Holtmann wrote:
> Hi Ravi,
>
>> Idle time is deprecated in HID 1_1. So remove it from ipc document
>> and update GET_REPORT and VIRTUAL_UNPLUG opcode values.
>> ---
>> android/hal-ipc-api.txt | 10 ++--------
>> android/hal-msg.h | 4 ++--
>> 2 files changed, 4 insertions(+), 10 deletions(-)
>>
>> diff --git a/android/hal-ipc-api.txt b/android/hal-ipc-api.txt
>> index 91ea280..57f4c13 100644
>> --- a/android/hal-ipc-api.txt
>> +++ b/android/hal-ipc-api.txt
>> @@ -614,20 +614,14 @@ Notifications:
>> 0x01 = Boot
>> 0xff = Unsupported
>>
>> - Opcode 0x84 - Idle Time notification
>> -
>> - Notification parameters: Remote address (6 octets)
>> - Status (1 octet)
>> - Idle time (2 octets)
> so what does HID_1.1 actually mean? I still see this notification in bt_hh.h.
>
> Regards
>
> Marcel
>
In HID_SPEC_V11 (3.1) Get Idle and Set Idle are deprecated. And even in
bt_hh.h
get_idle and set_idle interfaces are not available. Bluedroid had
implementation
of those two in bluedroid/btif/src/btif_hh.c but in interface struct
those are commented out.
I didn't find the call back call there. That's why I updated ipc-doc.
Please let me know if I miss anything.
Thanks,
Ravi.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/3] android/hidhost: Remove deprecated idle opcode from ipc document
2013-11-12 9:29 ` Ravi Kumar Veeramally
@ 2013-11-12 14:00 ` Ravi Kumar Veeramally
2013-11-12 15:57 ` Marcel Holtmann
1 sibling, 0 replies; 8+ messages in thread
From: Ravi Kumar Veeramally @ 2013-11-12 14:00 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth@vger.kernel.org development
Hi Marcel,
Any comments on my reply?
Thanks,
Ravi.
On 11/12/2013 11:29 AM, Ravi Kumar Veeramally wrote:
> Hi Marcel,
>
> On 11/12/2013 01:05 AM, Marcel Holtmann wrote:
>> Hi Ravi,
>>
>>> Idle time is deprecated in HID 1_1. So remove it from ipc document
>>> and update GET_REPORT and VIRTUAL_UNPLUG opcode values.
>>> ---
>>> android/hal-ipc-api.txt | 10 ++--------
>>> android/hal-msg.h | 4 ++--
>>> 2 files changed, 4 insertions(+), 10 deletions(-)
>>>
>>> diff --git a/android/hal-ipc-api.txt b/android/hal-ipc-api.txt
>>> index 91ea280..57f4c13 100644
>>> --- a/android/hal-ipc-api.txt
>>> +++ b/android/hal-ipc-api.txt
>>> @@ -614,20 +614,14 @@ Notifications:
>>> 0x01 = Boot
>>> 0xff = Unsupported
>>>
>>> - Opcode 0x84 - Idle Time notification
>>> -
>>> - Notification parameters: Remote address (6 octets)
>>> - Status (1 octet)
>>> - Idle time (2 octets)
>> so what does HID_1.1 actually mean? I still see this notification in
>> bt_hh.h.
>>
>> Regards
>>
>> Marcel
>>
> In HID_SPEC_V11 (3.1) Get Idle and Set Idle are deprecated. And even
> in bt_hh.h
> get_idle and set_idle interfaces are not available. Bluedroid had
> implementation
> of those two in bluedroid/btif/src/btif_hh.c but in interface struct
> those are commented out.
> I didn't find the call back call there. That's why I updated ipc-doc.
>
> Please let me know if I miss anything.
>
> Thanks,
> Ravi.
>
> --
> 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
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/3] android/hidhost: Remove deprecated idle opcode from ipc document
2013-11-12 9:29 ` Ravi Kumar Veeramally
2013-11-12 14:00 ` Ravi Kumar Veeramally
@ 2013-11-12 15:57 ` Marcel Holtmann
1 sibling, 0 replies; 8+ messages in thread
From: Marcel Holtmann @ 2013-11-12 15:57 UTC (permalink / raw)
To: Ravi Kumar Veeramally; +Cc: linux-bluetooth@vger.kernel.org development
Hi Ravi,
>>> Idle time is deprecated in HID 1_1. So remove it from ipc document
>>> and update GET_REPORT and VIRTUAL_UNPLUG opcode values.
>>> ---
>>> android/hal-ipc-api.txt | 10 ++--------
>>> android/hal-msg.h | 4 ++--
>>> 2 files changed, 4 insertions(+), 10 deletions(-)
>>>
>>> diff --git a/android/hal-ipc-api.txt b/android/hal-ipc-api.txt
>>> index 91ea280..57f4c13 100644
>>> --- a/android/hal-ipc-api.txt
>>> +++ b/android/hal-ipc-api.txt
>>> @@ -614,20 +614,14 @@ Notifications:
>>> 0x01 = Boot
>>> 0xff = Unsupported
>>>
>>> - Opcode 0x84 - Idle Time notification
>>> -
>>> - Notification parameters: Remote address (6 octets)
>>> - Status (1 octet)
>>> - Idle time (2 octets)
>> so what does HID_1.1 actually mean? I still see this notification in bt_hh.h.
>>
>> Regards
>>
>> Marcel
>>
> In HID_SPEC_V11 (3.1) Get Idle and Set Idle are deprecated. And even in bt_hh.h
> get_idle and set_idle interfaces are not available. Bluedroid had implementation
> of those two in bluedroid/btif/src/btif_hh.c but in interface struct those are commented out.
> I didn't find the call back call there. That's why I updated ipc-doc.
if they are not using this notification in the Bluetooth service, then we do not need to implemented.
Regards
Marcel
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 3/3] android/hidhost: Set info request from HAL is not supported
2013-11-11 12:15 [PATCH 1/3] android/hidhost: Handle uhid output and feature events Ravi kumar Veeramally
2013-11-11 12:15 ` [PATCH 2/3] android/hidhost: Remove deprecated idle opcode from ipc document Ravi kumar Veeramally
@ 2013-11-11 12:15 ` Ravi kumar Veeramally
2013-11-12 10:11 ` [PATCH 1/3] android/hidhost: Handle uhid output and feature events Ravi Kumar Veeramally
2 siblings, 0 replies; 8+ messages in thread
From: Ravi kumar Veeramally @ 2013-11-11 12:15 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Ravi kumar Veeramally
Data from hal_cmd_hidhost_set_info is usefull only when we create
UHID device. Once device is created all the transactions will be
done through the fd. There is no way to use this information
once device is created with HID internals.
---
android/hidhost.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/android/hidhost.c b/android/hidhost.c
index 816fe3e..6579ff3 100644
--- a/android/hidhost.c
+++ b/android/hidhost.c
@@ -857,7 +857,11 @@ static uint8_t bt_hid_virtual_unplug(struct hal_cmd_hidhost_virtual_unplug *cmd,
static uint8_t bt_hid_info(struct hal_cmd_hidhost_set_info *cmd, uint16_t len)
{
- DBG("Not Implemented");
+ /* Data from hal_cmd_hidhost_set_info is usefull only when we create
+ * UHID device. Once device is created all the transactions will be
+ * done through the fd. There is no way to use this information
+ * once device is created with HID internals. */
+ DBG("Not supported");
return HAL_STATUS_FAILED;
}
--
1.8.3.2
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH 1/3] android/hidhost: Handle uhid output and feature events
2013-11-11 12:15 [PATCH 1/3] android/hidhost: Handle uhid output and feature events Ravi kumar Veeramally
2013-11-11 12:15 ` [PATCH 2/3] android/hidhost: Remove deprecated idle opcode from ipc document Ravi kumar Veeramally
2013-11-11 12:15 ` [PATCH 3/3] android/hidhost: Set info request from HAL is not supported Ravi kumar Veeramally
@ 2013-11-12 10:11 ` Ravi Kumar Veeramally
2 siblings, 0 replies; 8+ messages in thread
From: Ravi Kumar Veeramally @ 2013-11-12 10:11 UTC (permalink / raw)
To: linux-bluetooth
Hi,
This patch is buggy. Conversion needs to be done like set_report and
send_data methods. I will send _v2 of this particular patch.
Sorry for inconvenience.
Thanks,
Ravi.
On 11/11/2013 02:15 PM, Ravi kumar Veeramally wrote:
> Data read on uhid events output and feature has to be send through
> SET_REPORT request to HID device.
> ---
> android/hidhost.c | 37 ++++++++++++++++++++++++++++++++++++-
> 1 file changed, 36 insertions(+), 1 deletion(-)
>
> diff --git a/android/hidhost.c b/android/hidhost.c
> index 683938f..816fe3e 100644
> --- a/android/hidhost.c
> +++ b/android/hidhost.c
> @@ -155,7 +155,42 @@ static void hid_device_free(struct hid_device *dev)
>
> static void handle_uhid_event(struct hid_device *dev, struct uhid_event *ev)
> {
> - DBG("UHID_OUTPUT UHID_FEATURE unsupported");
> + int fd;
> + uint8_t *req = NULL;
> + uint8_t req_size = 0;
> +
> + if (!(dev->ctrl_io))
> + return;
> +
> + switch (ev->type) {
> + case UHID_OUTPUT:
> + req_size = 1 + ev->u.output.size;
> + req = g_try_malloc0(req_size);
> + if (!req)
> + return;
> +
> + req[0] = HID_MSG_SET_REPORT | HID_DATA_TYPE_OUTPUT;
> + memcpy(req + 1, ev->u.output.data, ev->u.output.size);
> + break;
> +
> + case UHID_FEATURE:
> + req_size = sizeof(struct uhid_feature_req);
> + req = g_try_malloc0(req_size);
> + if (!req)
> + return;
> +
> + req[0] = HID_MSG_SET_REPORT | HID_DATA_TYPE_FEATURE;
> + memcpy(req + 1, (ev + sizeof(ev->type)), req_size - 1);
> + break;
> + }
> +
> + fd = g_io_channel_unix_get_fd(dev->ctrl_io);
> +
> + if (write(fd, req, req_size) < 0)
> + error("error writing hid_set_report: %s (%d)",
> + strerror(errno), errno);
> +
> + g_free(req);
> }
>
> static gboolean uhid_event_cb(GIOChannel *io, GIOCondition cond,
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2013-11-12 15:57 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-11 12:15 [PATCH 1/3] android/hidhost: Handle uhid output and feature events Ravi kumar Veeramally
2013-11-11 12:15 ` [PATCH 2/3] android/hidhost: Remove deprecated idle opcode from ipc document Ravi kumar Veeramally
2013-11-11 23:05 ` Marcel Holtmann
2013-11-12 9:29 ` Ravi Kumar Veeramally
2013-11-12 14:00 ` Ravi Kumar Veeramally
2013-11-12 15:57 ` Marcel Holtmann
2013-11-11 12:15 ` [PATCH 3/3] android/hidhost: Set info request from HAL is not supported Ravi kumar Veeramally
2013-11-12 10:11 ` [PATCH 1/3] android/hidhost: Handle uhid output and feature events Ravi Kumar Veeramally
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).