All of lore.kernel.org
 help / color / mirror / Atom feed
* [Proposed Patch Bluez v5] btmon: Print connection latency correctly
@ 2016-08-19  7:00 Leigh Fiddes
  2016-08-19  8:49 ` Marcel Holtmann
  0 siblings, 1 reply; 3+ messages in thread
From: Leigh Fiddes @ 2016-08-19  7:00 UTC (permalink / raw)
  To: Linux Bluetooth

Hi,
I submit the following small patch for consideration.
Leigh
---

In at least two places the Connection Latency field was being displayed by btmon in units of 1.25mS,
which is incorrect. Print in decimal instead of hex as it is a number.

--
 monitor/packet.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/monitor/packet.c b/monitor/packet.c
index 259c20b..9b9b037 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -6226,7 +6226,7 @@ static void le_create_conn_cmd(const void *data, uint8_t size)
 
 	print_slot_125("Min connection interval", cmd->min_interval);
 	print_slot_125("Max connection interval", cmd->max_interval);
-	print_field("Connection latency: 0x%4.4x", le16_to_cpu(cmd->latency));
+	print_field("Connection latency: %u", le16_to_cpu(cmd->latency));
 	print_field("Supervision timeout: %d msec (0x%4.4x)",
 					le16_to_cpu(cmd->supv_timeout) * 10,
 					le16_to_cpu(cmd->supv_timeout));
@@ -6265,7 +6265,7 @@ static void le_conn_update_cmd(const void *data, uint8_t size)
 	print_handle(cmd->handle);
 	print_slot_125("Min connection interval", cmd->min_interval);
 	print_slot_125("Max connection interval", cmd->max_interval);
-	print_field("Connection latency: 0x%4.4x", le16_to_cpu(cmd->latency));
+	print_field("Connection latency: %u", le16_to_cpu(cmd->latency));
 	print_field("Supervision timeout: %d msec (0x%4.4x)",
 					le16_to_cpu(cmd->supv_timeout) * 10,
 					le16_to_cpu(cmd->supv_timeout));
@@ -6409,7 +6409,7 @@ static void le_conn_param_req_reply_cmd(const void *data, uint8_t size)
 	print_handle(cmd->handle);
 	print_slot_125("Min connection interval", cmd->min_interval);
 	print_slot_125("Max connection interval", cmd->max_interval);
-	print_field("Connection latency: 0x%4.4x", le16_to_cpu(cmd->latency));
+	print_field("Connection latency: %u", le16_to_cpu(cmd->latency));
 	print_field("Supervision timeout: %d msec (0x%4.4x)",
 					le16_to_cpu(cmd->supv_timeout) * 10,
 					le16_to_cpu(cmd->supv_timeout));
@@ -8218,7 +8218,7 @@ static void le_conn_complete_evt(const void *data, uint8_t size)
 	print_peer_addr_type("Peer address type", evt->peer_addr_type);
 	print_addr("Peer address", evt->peer_addr, evt->peer_addr_type);
 	print_slot_125("Connection interval", evt->interval);
-	print_slot_125("Connection latency", evt->latency);
+	print_field("Connection latency: %d", le16_to_cpu(evt->latency));
 	print_field("Supervision timeout: %d msec (0x%4.4x)",
 					le16_to_cpu(evt->supv_timeout) * 10,
 					le16_to_cpu(evt->supv_timeout));
@@ -8263,7 +8263,7 @@ static void le_conn_update_complete_evt(const void *data, uint8_t size)
 	print_status(evt->status);
 	print_handle(evt->handle);
 	print_slot_125("Connection interval", evt->interval);
-	print_slot_125("Connection latency", evt->latency);
+	print_field("Connection latency: %d", le16_to_cpu(evt->latency));
 	print_field("Supervision timeout: %d msec (0x%4.4x)",
 					le16_to_cpu(evt->supv_timeout) * 10,
 					le16_to_cpu(evt->supv_timeout));
@@ -8294,7 +8294,7 @@ static void le_conn_param_request_evt(const void *data, uint8_t size)
 	print_handle(evt->handle);
 	print_slot_125("Min connection interval", evt->min_interval);
 	print_slot_125("Max connection interval", evt->max_interval);
-	print_field("Connection latency: 0x%4.4x", le16_to_cpu(evt->latency));
+	print_field("Connection latency: %d", le16_to_cpu(evt->latency));
 	print_field("Supervision timeout: %d msec (0x%4.4x)",
 					le16_to_cpu(evt->supv_timeout) * 10,
 					le16_to_cpu(evt->supv_timeout));
@@ -8339,7 +8339,7 @@ static void le_enhanced_conn_complete_evt(const void *data, uint8_t size)
 	print_addr("Local resolvable private address", evt->local_rpa, 0x01);
 	print_addr("Peer resolvable private address", evt->peer_rpa, 0x01);
 	print_slot_125("Connection interval", evt->interval);
-	print_slot_125("Connection latency", evt->latency);
+	print_field("Connection latency: %d", le16_to_cpu(evt->latency));
 	print_field("Supervision timeout: %d msec (0x%4.4x)",
 					le16_to_cpu(evt->supv_timeout) * 10,
 					le16_to_cpu(evt->supv_timeout));


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Proposed Patch Bluez v5] btmon: Print connection latency correctly
  2016-08-19  7:00 [Proposed Patch Bluez v5] btmon: Print connection latency correctly Leigh Fiddes
@ 2016-08-19  8:49 ` Marcel Holtmann
  2016-08-19 12:01   ` Leigh Fiddes
  0 siblings, 1 reply; 3+ messages in thread
From: Marcel Holtmann @ 2016-08-19  8:49 UTC (permalink / raw)
  To: Leigh Fiddes; +Cc: Linux Bluetooth

Hi Leigh,

> I submit the following small patch for consideration.
> Leigh
> ---
> 
> In at least two places the Connection Latency field was being displayed by btmon in units of 1.25mS,
> which is incorrect. Print in decimal instead of hex as it is a number.

then print the connection latency with a correct unit and the hex value in parentheses. This way is not acceptable. If we need a print_field_msec helper, then introduce that and use it throughout.

Regards

Marcel


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Proposed Patch Bluez v5] btmon: Print connection latency correctly
  2016-08-19  8:49 ` Marcel Holtmann
@ 2016-08-19 12:01   ` Leigh Fiddes
  0 siblings, 0 replies; 3+ messages in thread
From: Leigh Fiddes @ 2016-08-19 12:01 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: Linux Bluetooth

Hi Marcel,

> Hi Leigh,
>
>> I submit the following small patch for consideration.
>> Leigh
>> ---
>>
>> In at least two places the Connection Latency field was being displayed by btmon in units of 1.25mS,
>> which is incorrect. Print in decimal instead of hex as it is a number.
> then print the connection latency with a correct unit and the hex value in parentheses. This way is not acceptable. If we need a print_field_msec helper, then introduce that and use it throughout.
>
> Regards
>
> Marcel
>
Thank you for the quick response.
I think there may be a misunderstanding here. In these LE messages, the 
Connection Latency is not a time unit. It is a count of the number of
Connection messages from the Host that the Peripheral can ignore if the 
Peripheral has no new data to send at that time.
Since it is just a count, printing the same value in both decimal and 
hex is a stylistic decision.
Regards,
Leigh

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-08-19 12:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-19  7:00 [Proposed Patch Bluez v5] btmon: Print connection latency correctly Leigh Fiddes
2016-08-19  8:49 ` Marcel Holtmann
2016-08-19 12:01   ` Leigh Fiddes

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.