2015-08-12 14:40:08

by Arkadiusz Lichwa

[permalink] [raw]
Subject: [PATCH] emulator: Swap max and min interval

Fixes btdev controller bits when assigning actual parameters,
max and min interval, in LE Meta event for LE Connection Update to be sent
to host.
---
emulator/btdev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/emulator/btdev.c b/emulator/btdev.c
index cd211ef..57e51a0 100644
--- a/emulator/btdev.c
+++ b/emulator/btdev.c
@@ -3322,8 +3322,8 @@ static void default_cmd_completion(struct btdev *btdev, uint16_t opcode,
return;
lecu = data;
le_conn_update(btdev, le16_to_cpu(lecu->handle),
- le16_to_cpu(lecu->min_interval),
le16_to_cpu(lecu->max_interval),
+ le16_to_cpu(lecu->min_interval),
le16_to_cpu(lecu->latency),
le16_to_cpu(lecu->supv_timeout),
le16_to_cpu(lecu->min_length),
--
1.8.2.2



2015-08-14 05:40:58

by Johan Hedberg

[permalink] [raw]
Subject: Re: [PATCH] emulator: Swap max and min interval

Hi Arek,

On Wed, Aug 12, 2015, Arkadiusz Lichwa wrote:
> Fixes btdev controller bits when assigning actual parameters,
> max and min interval, in LE Meta event for LE Connection Update to be sent
> to host.
> ---
> emulator/btdev.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/emulator/btdev.c b/emulator/btdev.c
> index cd211ef..57e51a0 100644
> --- a/emulator/btdev.c
> +++ b/emulator/btdev.c
> @@ -3322,8 +3322,8 @@ static void default_cmd_completion(struct btdev *btdev, uint16_t opcode,
> return;
> lecu = data;
> le_conn_update(btdev, le16_to_cpu(lecu->handle),
> - le16_to_cpu(lecu->min_interval),
> le16_to_cpu(lecu->max_interval),
> + le16_to_cpu(lecu->min_interval),
> le16_to_cpu(lecu->latency),
> le16_to_cpu(lecu->supv_timeout),
> le16_to_cpu(lecu->min_length),

Good catch, but I think it makes more sense to keep the order as min,
max since that's how it is in HCI as well. Since this is such a trivial
thing I went ahead and fixed is myself (i.e. swapped the order in the
function instead of the caller).

Johan