linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ 1/2] monitor: Fix using uuid128_to_str
@ 2016-07-14 10:08 Luiz Augusto von Dentz
  2016-07-14 10:08 ` [PATCH BlueZ 2/2] monitor: Remove uuid128_to_str Luiz Augusto von Dentz
  2016-07-15  7:39 ` [PATCH BlueZ 1/2] monitor: Fix using uuid128_to_str Luiz Augusto von Dentz
  0 siblings, 2 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2016-07-14 10:08 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This function always return "Unknown" regardless of the input, instead
uuidstr_to_str shall be used for UUID 128 bit format since it can return
proper friendly names:

> ACL Data RX: Handle 3585 flags 0x02 dlen 26
      ATT: Read By Group Type Response (0x11) len 21
        Attribute data length: 20
        Attribute group list: 1 entry
        Handle range: 0x0001-0x0015
        UUID: Eddystone Configuration Service (a3c87500-8ed3-4bdf-8a39-a01bebede295)
---
 monitor/l2cap.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/monitor/l2cap.c b/monitor/l2cap.c
index 93a1b20..59a3206 100644
--- a/monitor/l2cap.c
+++ b/monitor/l2cap.c
@@ -1999,6 +1999,7 @@ static void print_hex_field(const char *label, const uint8_t *data,
 static void print_uuid(const char *label, const void *data, uint16_t size)
 {
 	const char *str;
+	char uuidstr[36];
 
 	switch (size) {
 	case 2:
@@ -2010,12 +2011,12 @@ static void print_uuid(const char *label, const void *data, uint16_t size)
 		print_field("%s: %s (0x%8.8x)", label, str, get_le32(data));
 		break;
 	case 16:
-		str = uuid128_to_str(data);
-		print_field("%s: %s (%8.8x-%4.4x-%4.4x-%4.4x-%8.8x%4.4x)",
-				label, str,
+		sprintf(uuidstr, "%8.8x-%4.4x-%4.4x-%4.4x-%8.8x%4.4x",
 				get_le32(data + 12), get_le16(data + 10),
 				get_le16(data + 8), get_le16(data + 6),
 				get_le32(data + 2), get_le16(data + 0));
+		str = uuidstr_to_str(uuidstr);
+		print_field("%s: %s (%s)", label, str, uuidstr);
 		break;
 	default:
 		packet_hexdump(data, size);
-- 
2.7.4


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

* [PATCH BlueZ 2/2] monitor: Remove uuid128_to_str
  2016-07-14 10:08 [PATCH BlueZ 1/2] monitor: Fix using uuid128_to_str Luiz Augusto von Dentz
@ 2016-07-14 10:08 ` Luiz Augusto von Dentz
  2016-07-15  7:39 ` [PATCH BlueZ 1/2] monitor: Fix using uuid128_to_str Luiz Augusto von Dentz
  1 sibling, 0 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2016-07-14 10:08 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

uuid128_to_str is no longer necessary since all the user have been
converted to use uuidstr_to_str.
---
 monitor/uuid.c | 5 -----
 monitor/uuid.h | 2 --
 2 files changed, 7 deletions(-)

diff --git a/monitor/uuid.c b/monitor/uuid.c
index 1ceaa6f..6660bc7 100644
--- a/monitor/uuid.c
+++ b/monitor/uuid.c
@@ -585,11 +585,6 @@ const char *uuid32_to_str(uint32_t uuid)
 	return "Unknown";
 }
 
-const char *uuid128_to_str(const unsigned char *uuid)
-{
-	return "Unknown";
-}
-
 const char *uuidstr_to_str(const char *uuid)
 {
 	uint32_t val;
diff --git a/monitor/uuid.h b/monitor/uuid.h
index f467f51..6ffc0ee 100644
--- a/monitor/uuid.h
+++ b/monitor/uuid.h
@@ -26,6 +26,4 @@
 
 const char *uuid16_to_str(uint16_t uuid);
 const char *uuid32_to_str(uint32_t uuid);
-const char *uuid128_to_str(const unsigned char *uuid);
-
 const char *uuidstr_to_str(const char *uuid);
-- 
2.7.4


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

* Re: [PATCH BlueZ 1/2] monitor: Fix using uuid128_to_str
  2016-07-14 10:08 [PATCH BlueZ 1/2] monitor: Fix using uuid128_to_str Luiz Augusto von Dentz
  2016-07-14 10:08 ` [PATCH BlueZ 2/2] monitor: Remove uuid128_to_str Luiz Augusto von Dentz
@ 2016-07-15  7:39 ` Luiz Augusto von Dentz
  1 sibling, 0 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2016-07-15  7:39 UTC (permalink / raw)
  To: linux-bluetooth@vger.kernel.org

Hi,

On Thu, Jul 14, 2016 at 1:08 PM, Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
>
> This function always return "Unknown" regardless of the input, instead
> uuidstr_to_str shall be used for UUID 128 bit format since it can return
> proper friendly names:
>
>> ACL Data RX: Handle 3585 flags 0x02 dlen 26
>       ATT: Read By Group Type Response (0x11) len 21
>         Attribute data length: 20
>         Attribute group list: 1 entry
>         Handle range: 0x0001-0x0015
>         UUID: Eddystone Configuration Service (a3c87500-8ed3-4bdf-8a39-a01bebede295)
> ---
>  monitor/l2cap.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/monitor/l2cap.c b/monitor/l2cap.c
> index 93a1b20..59a3206 100644
> --- a/monitor/l2cap.c
> +++ b/monitor/l2cap.c
> @@ -1999,6 +1999,7 @@ static void print_hex_field(const char *label, const uint8_t *data,
>  static void print_uuid(const char *label, const void *data, uint16_t size)
>  {
>         const char *str;
> +       char uuidstr[36];
>
>         switch (size) {
>         case 2:
> @@ -2010,12 +2011,12 @@ static void print_uuid(const char *label, const void *data, uint16_t size)
>                 print_field("%s: %s (0x%8.8x)", label, str, get_le32(data));
>                 break;
>         case 16:
> -               str = uuid128_to_str(data);
> -               print_field("%s: %s (%8.8x-%4.4x-%4.4x-%4.4x-%8.8x%4.4x)",
> -                               label, str,
> +               sprintf(uuidstr, "%8.8x-%4.4x-%4.4x-%4.4x-%8.8x%4.4x",
>                                 get_le32(data + 12), get_le16(data + 10),
>                                 get_le16(data + 8), get_le16(data + 6),
>                                 get_le32(data + 2), get_le16(data + 0));
> +               str = uuidstr_to_str(uuidstr);
> +               print_field("%s: %s (%s)", label, str, uuidstr);
>                 break;
>         default:
>                 packet_hexdump(data, size);
> --
> 2.7.4

Applied.


-- 
Luiz Augusto von Dentz

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

end of thread, other threads:[~2016-07-15  7:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-14 10:08 [PATCH BlueZ 1/2] monitor: Fix using uuid128_to_str Luiz Augusto von Dentz
2016-07-14 10:08 ` [PATCH BlueZ 2/2] monitor: Remove uuid128_to_str Luiz Augusto von Dentz
2016-07-15  7:39 ` [PATCH BlueZ 1/2] monitor: Fix using uuid128_to_str Luiz Augusto von Dentz

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).