diff mbox series

[BlueZ,1/3] shared/util: Add bt_uuid128_to_str

Message ID 20210518183937.786605-1-luiz.dentz@gmail.com
State New
Headers show
Series [BlueZ,1/3] shared/util: Add bt_uuid128_to_str | expand

Commit Message

Luiz Augusto von Dentz May 18, 2021, 6:39 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This adds bt_uuid128_to_str which can be used to convert UUID 128 bit
binary format into string.
---
 src/shared/util.c | 12 ++++++++++++
 src/shared/util.h |  1 +
 2 files changed, 13 insertions(+)

Comments

Luiz Augusto von Dentz May 19, 2021, 6:01 p.m. UTC | #1
Hi,

On Tue, May 18, 2021 at 12:04 PM <bluez.test.bot@gmail.com> wrote:
>

> This is automated email and please do not reply to this email!

>

> Dear submitter,

>

> Thank you for submitting the patches to the linux bluetooth mailing list.

> This is a CI test results with your patch series:

> PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=484525

>

> ---Test result---

>

> Test Summary:

> CheckPatch                    PASS      1.16 seconds

> GitLint                       PASS      0.40 seconds

> Prep - Setup ELL              PASS      51.17 seconds

> Build - Prep                  PASS      0.11 seconds

> Build - Configure             PASS      9.04 seconds

> Build - Make                  PASS      217.20 seconds

> Make Check                    PASS      9.63 seconds

> Make Distcheck                PASS      256.57 seconds

> Build w/ext ELL - Configure   PASS      9.17 seconds

> Build w/ext ELL - Make        PASS      204.36 seconds

>

> Details

> ##############################

> Test: CheckPatch - PASS

> Desc: Run checkpatch.pl script with rule in .checkpatch.conf

>

> ##############################

> Test: GitLint - PASS

> Desc: Run gitlint with rule in .gitlint

>

> ##############################

> Test: Prep - Setup ELL - PASS

> Desc: Clone, build, and install ELL

>

> ##############################

> Test: Build - Prep - PASS

> Desc: Prepare environment for build

>

> ##############################

> Test: Build - Configure - PASS

> Desc: Configure the BlueZ source tree

>

> ##############################

> Test: Build - Make - PASS

> Desc: Build the BlueZ source tree

>

> ##############################

> Test: Make Check - PASS

> Desc: Run 'make check'

>

> ##############################

> Test: Make Distcheck - PASS

> Desc: Run distcheck to check the distribution

>

> ##############################

> Test: Build w/ext ELL - Configure - PASS

> Desc: Configure BlueZ source with '--enable-external-ell' configuration

>

> ##############################

> Test: Build w/ext ELL - Make - PASS

> Desc: Build BlueZ source with '--enable-external-ell' configuration

>

>

>

> ---

> Regards,

> Linux Bluetooth


Pushed.

-- 
Luiz Augusto von Dentz
diff mbox series

Patch

diff --git a/src/shared/util.c b/src/shared/util.c
index 9c2054211..7fb1c01dc 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -1042,6 +1042,18 @@  const char *bt_uuid32_to_str(uint32_t uuid)
 	return "Unknown";
 }
 
+const char *bt_uuid128_to_str(const uint8_t uuid[16])
+{
+	char uuidstr[37];
+
+	sprintf(uuidstr, "%8.8x-%4.4x-%4.4x-%4.4x-%8.8x%4.4x",
+				get_le32(&uuid[12]), get_le16(&uuid[10]),
+				get_le16(&uuid[8]), get_le16(&uuid[6]),
+				get_le32(&uuid[2]), get_le16(&uuid[0]));
+
+	return bt_uuidstr_to_str(uuidstr);
+}
+
 const char *bt_uuidstr_to_str(const char *uuid)
 {
 	uint32_t val;
diff --git a/src/shared/util.h b/src/shared/util.h
index d6de55885..9920b7f76 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -107,6 +107,7 @@  void util_clear_uid(unsigned int *bitmap, uint8_t id);
 
 const char *bt_uuid16_to_str(uint16_t uuid);
 const char *bt_uuid32_to_str(uint32_t uuid);
+const char *bt_uuid128_to_str(const uint8_t uuid[16]);
 const char *bt_uuidstr_to_str(const char *uuid);
 const char *bt_appear_to_str(uint16_t appearance);