From: Tyszkowski Jakub <jakub.tyszkowski@tieto.com>
To: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: "linux-bluetooth@vger.kernel.org" <linux-bluetooth@vger.kernel.org>
Subject: Re: [PATCHv3 07/17] android/tester: Make HDP tests use generic pdu struct
Date: Thu, 02 Oct 2014 09:10:10 +0200 [thread overview]
Message-ID: <542CFA52.6040602@tieto.com> (raw)
In-Reply-To: <CABBYNZJoqmsa45OQ0XO5rZSL7v877A4qMOyXm+VoZqs5wpm68g@mail.gmail.com>
Hi Luiz,
On 10/01/2014 02:21 PM, Luiz Augusto von Dentz wrote:
> Hi Jakub,
>
> On Wed, Oct 1, 2014 at 12:01 PM, Jakub Tyszkowski
> <jakub.tyszkowski@tieto.com> wrote:
>> ---
>> android/tester-hdp.c | 11 ++++++-----
>> 1 file changed, 6 insertions(+), 5 deletions(-)
>>
>> diff --git a/android/tester-hdp.c b/android/tester-hdp.c
>> index 9ecef21..e81df71 100644
>> --- a/android/tester-hdp.c
>> +++ b/android/tester-hdp.c
>> @@ -184,7 +184,8 @@ static void hdp_unregister_app_action(void)
>> schedule_action_verification(step);
>> }
>>
>> -static uint8_t hdp_rsp_pdu[] = { 0x07, /* PDU id */
>> +static const struct pdu hdp_rsp_pdu = raw_pdu(
>> + 0x07, /* PDU id */
>> 0x00, 0x00, /* Transaction id */
>> 0x01, 0xc8, /* Response length */
>> 0x01, 0xc5, /* Attributes length */
>> @@ -239,7 +240,7 @@ static uint8_t hdp_rsp_pdu[] = { 0x07, /* PDU id */
>> 0x63, 0x6f, 0x73, 0x65, 0x20, 0x4d, 0x65, 0x74, 0x65,
>> 0x72, 0x0d, 0x09, 0x03, 0x01, 0x08, 0x01, 0x09, 0x03,
>> 0x02, 0x08, 0x00,
>> - 0x00 };
>> + 0x00);
>>
>> static void hdp_sdp_cid_hook_cb(const void *data, uint16_t len, void *user_data)
>> {
>> @@ -247,11 +248,11 @@ static void hdp_sdp_cid_hook_cb(const void *data, uint16_t len, void *user_data)
>> struct bthost *bthost = hciemu_client_get_host(t_data->hciemu);
>> struct emu_cid_data *cid_data = user_data;
>>
>> - hdp_rsp_pdu[1] = ((uint8_t *) data)[1];
>> - hdp_rsp_pdu[2] = ((uint8_t *) data)[2];
>> + hdp_rsp_pdu.data[1] = ((uint8_t *) data)[1];
>> + hdp_rsp_pdu.data[2] = ((uint8_t *) data)[2];
>
> I suppose we could use memcpy here, or in case of iovec you can
> actually send them separably them like this:
>
> struct iovec iov[2]
>
> iov[0].iov_base = data;
> iov[0].iov_len = 2;
>
> iov[1].iov_base = hdp_rsp_pdu.data + 2;
> iov[1].iov_len = hdp_rsp_pdu.size - 2;
>
> This way the variables can be const.
memcpy was the first solution I proposed when this pdu refactor was part
of some other patch set. At that time You suggested to make pdus non
const and overwrite transaction ID to avoid copying. :)
But I agree that with iovecs it will work with const pdus and without
copying. I'll fix that.
>
>> bthost_send_cid(bthost, cid_data->sdp_handle, cid_data->sdp_cid,
>> - hdp_rsp_pdu, sizeof(hdp_rsp_pdu));
>> + hdp_rsp_pdu.data, hdp_rsp_pdu.size);
>> }
>>
>> static void hdp_sdp_search_cb(uint16_t handle, uint16_t cid, void *user_data)
>> --
>> 1.9.1
>>
>> --
>> 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
>
>
>
Regards
next prev parent reply other threads:[~2014-10-02 7:10 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-01 9:01 [PATCHv3 00/17] android/tester: Unifying the way PDU is handled Jakub Tyszkowski
2014-10-01 9:01 ` [PATCHv3 01/17] android/tester: Expose gatt-tester's pdu definition to other testers Jakub Tyszkowski
2014-10-01 9:01 ` [PATCHv3 02/17] android/tester: Make AVRCP tests use generic pdu struct Jakub Tyszkowski
2014-10-01 9:01 ` [PATCHv3 03/17] android/tester: Make A2DP " Jakub Tyszkowski
2014-10-01 9:01 ` [PATCHv3 04/17] android/tester: Make GATT " Jakub Tyszkowski
2014-10-01 9:01 ` [PATCHv3 05/17] android/tester: Make HidHost " Jakub Tyszkowski
2014-10-01 9:01 ` [PATCHv3 06/17] android/tester: Make PAN " Jakub Tyszkowski
2014-10-01 9:01 ` [PATCHv3 07/17] android/tester: Make HDP " Jakub Tyszkowski
2014-10-01 12:21 ` Luiz Augusto von Dentz
2014-10-02 7:10 ` Tyszkowski Jakub [this message]
2014-10-01 9:01 ` [PATCHv3 08/17] android/tester: Expose pdu_set structure so it can be reused Jakub Tyszkowski
2014-10-01 9:01 ` [PATCHv3 09/17] android/tester: Add generic hook to handle pdu exchange Jakub Tyszkowski
2014-10-01 9:01 ` [PATCHv3 10/17] android/tester: Make A2DP use pdu exchange mechanism Jakub Tyszkowski
2014-10-01 9:01 ` [PATCHv3 11/17] android/tester: Make AVRCP tests use generic " Jakub Tyszkowski
2014-10-01 9:01 ` [PATCHv3 12/17] android/tester: Make GATT use generic cid_data Jakub Tyszkowski
2014-10-01 9:01 ` [PATCHv3 13/17] android/tester: Make HDP tests use generic PDU exchange mechanism Jakub Tyszkowski
2014-10-01 9:01 ` [PATCHv3 14/17] android/tester: Make HIDHost " Jakub Tyszkowski
2014-10-01 9:01 ` [PATCHv3 15/17] android/tester: Make PAN " Jakub Tyszkowski
2014-10-01 9:01 ` [PATCHv3 16/17] android/tester: Use generic connect callback for simple cases Jakub Tyszkowski
2014-10-01 9:01 ` [PATCHv3 17/17] android/tester: Replace pdu struct with iovec Jakub Tyszkowski
2014-10-01 12:37 ` Luiz Augusto von Dentz
2014-10-02 7:18 ` Tyszkowski Jakub
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=542CFA52.6040602@tieto.com \
--to=jakub.tyszkowski@tieto.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=luiz.dentz@gmail.com \
/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.