linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Hedberg <johan.hedberg@gmail.com>
To: Claudio Takahasi <claudio.takahasi@openbossa.org>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH BlueZ v4 05/20] shared: Add put_le128()
Date: Fri, 14 Mar 2014 15:54:53 +0200	[thread overview]
Message-ID: <20140314135453.GA21071@localhost.P-661HNU-F1> (raw)
In-Reply-To: <1394802800-8424-6-git-send-email-claudio.takahasi@openbossa.org>

Hi Claudio,

On Fri, Mar 14, 2014, Claudio Takahasi wrote:
> Add helper to put uint128 values to the given pointer using little-endian
> representation. This helper is only a wrapper of cpu_to_le128().
> ---
>  src/shared/util.h | 23 +++++++++++++++++++++++
>  1 file changed, 23 insertions(+)

I've applied patches 1-4, but had to stop with this one.

> diff --git a/src/shared/util.h b/src/shared/util.h
> index cc2dbcd..f3db8fb 100644
> --- a/src/shared/util.h
> +++ b/src/shared/util.h
> @@ -26,6 +26,8 @@
>  #include <alloca.h>
>  #include <byteswap.h>
>  
> +#include <bluetooth/bluetooth.h>

I don't think we want shared/util.h (an LGPL header) depending on
lib/bluetooth.h (a GPL header).

> +static inline void cpu_to_le128(const uint128_t *src, uint128_t *dst)
> +{
> +	int i;
> +
> +	for (i = 0; i < 16; i++)
> +		dst->data[15 - i] = src->data[i];
> +}
> +
> +#else
> +
> +static inline void cpu_to_le128(const uint128_t *src, uint128_t *dst)
> +{
> +	*dst = *src;
> +}

What would probably work is to completely avoid the uint128_t type and
instead do something like:

static inline void cpu_to_le128(const void *src, void *dst)
{
	const uint8_t *src_data = src;
	uint8_t *dst_data = dst;

	for (...)
	...
}

That way you could still pass uint128_t pointers to the function and it
would still work (and it would also work with any other 128-bit type we
come up with).

This all said, are you sure this is the correct way of converting a UUID
from host endianness to LE? Looking at the UUID specification[1], mainly
section 12.1, it seems the various components should be converted
independently. So basically what you have is a generic 128-bit byte
order converter, but it's not necessarily usable for UUIDs (which seems
to be the only/main thing you're using it for).

Johan

[1] http://www.itu.int/ITU-T/studygroups/com17/oid/X.667-E.pdf

  reply	other threads:[~2014-03-14 13:54 UTC|newest]

Thread overview: 153+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-10 18:50 [PATCH BlueZ v0 00/16] Add basic GATT characteristics Claudio Takahasi
2014-03-10 18:50 ` [PATCH BlueZ v0 01/16] gatt: Add function to create constant attributes Claudio Takahasi
2014-03-10 18:50 ` [PATCH BlueZ v0 02/16] gatt: Add helper for creating GATT characteristics Claudio Takahasi
2014-03-10 18:50 ` [PATCH BlueZ v0 03/16] gatt: Add characteristic to the database Claudio Takahasi
2014-03-10 18:50 ` [PATCH BlueZ v0 04/16] gatt: Add hash table of GDBusProxy objects Claudio Takahasi
2014-03-10 18:50 ` [PATCH BlueZ v0 05/16] gatt: Add read callback to btd_gatt_add_char helper Claudio Takahasi
2014-03-10 18:50 ` [PATCH BlueZ v0 06/16] gatt: Assign read callback for external services Claudio Takahasi
2014-03-10 18:50 ` [PATCH BlueZ v0 07/16] gatt: Add helper for reading characteristics Claudio Takahasi
2014-03-10 18:50 ` [PATCH BlueZ v0 08/16] gatt: Add write callback to btd_gatt_add_char helper Claudio Takahasi
2014-03-10 18:50 ` [PATCH BlueZ v0 09/16] gdbus: Add g_dbus_proxy_set_property_array Claudio Takahasi
2014-03-10 18:50 ` [PATCH BlueZ v0 10/16] gatt: Assign write callback for external services Claudio Takahasi
2014-03-10 18:50 ` [PATCH BlueZ v0 11/16] gatt: Add result callback for Write Request Claudio Takahasi
2014-03-10 18:50 ` [PATCH BlueZ v0 12/16] gatt: Add Write Request handling for GDBusProxy Claudio Takahasi
2014-03-10 18:50 ` [PATCH BlueZ v0 13/16] tools: Add Alert Level characteristic to gatt-service Claudio Takahasi
2014-03-10 18:50 ` [PATCH BlueZ v0 14/16] tools: Add reading Value property of gatt-service Claudio Takahasi
2014-03-10 18:50 ` [PATCH BlueZ v0 15/16] tools: Add setting " Claudio Takahasi
2014-03-10 18:50 ` [PATCH BlueZ v0 16/16] tools: Emit property changed when Value changes Claudio Takahasi
2014-03-12 16:26 ` [PATCH BlueZ v1 00/15] Add basic GATT characteristics Claudio Takahasi
2014-03-12 16:26   ` [PATCH BlueZ v1 01/15] gatt: Add function to create constant attributes Claudio Takahasi
2014-03-13  8:30     ` Johan Hedberg
2014-03-13 13:10       ` Claudio Takahasi
2014-03-12 16:26   ` [PATCH BlueZ v1 02/15] gatt: Add helper for creating GATT characteristics Claudio Takahasi
2014-03-13  8:32     ` Johan Hedberg
2014-03-12 16:26   ` [PATCH BlueZ v1 03/15] gatt: Add characteristic to the database Claudio Takahasi
2014-03-12 16:27   ` [PATCH BlueZ v1 04/15] gatt: Add hash table of GDBusProxy objects Claudio Takahasi
2014-03-12 16:27   ` [PATCH BlueZ v1 05/15] gatt: Add read callback to btd_gatt_add_char helper Claudio Takahasi
2014-03-12 16:27   ` [PATCH BlueZ v1 06/15] gatt: Assign read callback for external services Claudio Takahasi
2014-03-12 16:27   ` [PATCH BlueZ v1 07/15] gatt: Add write callback to btd_gatt_add_char helper Claudio Takahasi
2014-03-12 16:27   ` [PATCH BlueZ v1 08/15] gdbus: Add g_dbus_proxy_set_property_array Claudio Takahasi
2014-03-12 16:27   ` [PATCH BlueZ v1 09/15] gatt: Assign write callback for external services Claudio Takahasi
2014-03-12 16:27   ` [PATCH BlueZ v1 10/15] gatt: Add result callback for Write Request Claudio Takahasi
2014-03-12 16:27   ` [PATCH BlueZ v1 11/15] gatt: Add Write Request handling for GDBusProxy Claudio Takahasi
2014-03-12 16:27   ` [PATCH BlueZ v1 12/15] tools: Add Alert Level characteristic to gatt-service Claudio Takahasi
2014-03-12 16:27   ` [PATCH BlueZ v1 13/15] tools: Add reading Value property of gatt-service Claudio Takahasi
2014-03-12 16:27   ` [PATCH BlueZ v1 14/15] tools: Add setting " Claudio Takahasi
2014-03-12 16:27   ` [PATCH BlueZ v1 15/15] tools: Emit property changed when Value changes Claudio Takahasi
2014-03-13 14:38   ` [PATCH BlueZ v2 00/17] Add basic GATT characteristics Claudio Takahasi
2014-03-13 14:38     ` [PATCH BlueZ v2 01/17] shared: Add put_uuid() Claudio Takahasi
2014-03-13 14:38     ` [PATCH BlueZ v2 02/17] gatt: Add function to create constant attributes Claudio Takahasi
2014-03-13 14:38     ` [PATCH BlueZ v2 03/17] shared: Add put_le16() Claudio Takahasi
2014-03-13 14:38     ` [PATCH BlueZ v2 04/17] gatt: Add helper for creating GATT characteristics Claudio Takahasi
2014-03-13 14:38     ` [PATCH BlueZ v2 05/17] gatt: Add characteristic to the database Claudio Takahasi
2014-03-13 14:38     ` [PATCH BlueZ v2 06/17] gatt: Add hash table of GDBusProxy objects Claudio Takahasi
2014-03-13 14:38     ` [PATCH BlueZ v2 07/17] gatt: Add read callback to btd_gatt_add_char helper Claudio Takahasi
2014-03-13 14:38     ` [PATCH BlueZ v2 08/17] gatt: Assign read callback for external services Claudio Takahasi
2014-03-13 14:38     ` [PATCH BlueZ v2 09/17] gatt: Add write callback to btd_gatt_add_char helper Claudio Takahasi
2014-03-13 14:38     ` [PATCH BlueZ v2 10/17] gdbus: Add g_dbus_proxy_set_property_array Claudio Takahasi
2014-03-13 14:38     ` [PATCH BlueZ v2 11/17] gatt: Assign write callback for external services Claudio Takahasi
2014-03-13 14:38     ` [PATCH BlueZ v2 12/17] gatt: Add result callback for Write Request Claudio Takahasi
2014-03-13 14:38     ` [PATCH BlueZ v2 13/17] gatt: Add Write Request handling for GDBusProxy Claudio Takahasi
2014-03-13 14:38     ` [PATCH BlueZ v2 14/17] tools: Add Alert Level characteristic to gatt-service Claudio Takahasi
2014-03-13 14:38     ` [PATCH BlueZ v2 15/17] tools: Add reading Value property of gatt-service Claudio Takahasi
2014-03-13 14:38     ` [PATCH BlueZ v2 16/17] tools: Add setting " Claudio Takahasi
2014-03-13 14:38     ` [PATCH BlueZ v2 17/17] tools: Emit property changed when Value changes Claudio Takahasi
2014-03-13 20:22     ` [PATCH BlueZ v3 00/20] Add basic GATT characteristics Claudio Takahasi
2014-03-13 20:22       ` [PATCH BlueZ v3 01/20] shared: Add put_le16() Claudio Takahasi
2014-03-13 20:22       ` [PATCH BlueZ v3 02/20] lib: Remove bt_put_le16() Claudio Takahasi
2014-03-14 10:23         ` Johan Hedberg
2014-03-13 20:22       ` [PATCH BlueZ v3 03/20] shared: Add put_le32() Claudio Takahasi
2014-03-13 20:22       ` [PATCH BlueZ v3 04/20] lib: Remove bt_put_le32() Claudio Takahasi
2014-03-13 20:22       ` [PATCH BlueZ v3 05/20] shared: Add put_le128() Claudio Takahasi
2014-03-13 20:22       ` [PATCH BlueZ v3 06/20] gatt: Add function to create constant attributes Claudio Takahasi
2014-03-13 20:22       ` [PATCH BlueZ v3 07/20] gatt: Add helper for creating GATT characteristics Claudio Takahasi
2014-03-13 20:22       ` [PATCH BlueZ v3 08/20] gatt: Add characteristic to the database Claudio Takahasi
2014-03-13 20:22       ` [PATCH BlueZ v3 09/20] gatt: Add hash table of GDBusProxy objects Claudio Takahasi
2014-03-13 20:22       ` [PATCH BlueZ v3 10/20] gatt: Add read callback to btd_gatt_add_char helper Claudio Takahasi
2014-03-13 20:22       ` [PATCH BlueZ v3 11/20] gatt: Assign read callback for external services Claudio Takahasi
2014-03-13 20:22       ` [PATCH BlueZ v3 12/20] gatt: Add write callback to btd_gatt_add_char helper Claudio Takahasi
2014-03-13 20:22       ` [PATCH BlueZ v3 13/20] gdbus: Add g_dbus_proxy_set_property_array Claudio Takahasi
2014-03-13 20:22       ` [PATCH BlueZ v3 14/20] gatt: Assign write callback for external services Claudio Takahasi
2014-03-13 20:22       ` [PATCH BlueZ v3 15/20] gatt: Add result callback for Write Request Claudio Takahasi
2014-03-13 20:22       ` [PATCH BlueZ v3 16/20] gatt: Add Write Request handling for GDBusProxy Claudio Takahasi
2014-03-13 20:22       ` [PATCH BlueZ v3 17/20] tools: Add Alert Level characteristic to gatt-service Claudio Takahasi
2014-03-13 20:22       ` [PATCH BlueZ v3 18/20] tools: Add reading Value property of gatt-service Claudio Takahasi
2014-03-13 20:22       ` [PATCH BlueZ v3 19/20] tools: Add setting " Claudio Takahasi
2014-03-13 20:22       ` [PATCH BlueZ v3 20/20] tools: Emit property changed when Value changes Claudio Takahasi
2014-03-14 13:13       ` [PATCH BlueZ v4 00/20] Add basic GATT characteristics Claudio Takahasi
2014-03-14 13:13         ` [PATCH BlueZ v4 01/20] shared: Add put_le16() Claudio Takahasi
2014-03-14 13:13         ` [PATCH BlueZ v4 02/20] Replace bt_put_le16() by put_le16() Claudio Takahasi
2014-03-14 13:13         ` [PATCH BlueZ v4 03/20] shared: Add put_le32() Claudio Takahasi
2014-03-14 13:13         ` [PATCH BlueZ v4 04/20] Replace bt_put_le32() by put_le32() Claudio Takahasi
2014-03-14 13:13         ` [PATCH BlueZ v4 05/20] shared: Add put_le128() Claudio Takahasi
2014-03-14 13:54           ` Johan Hedberg [this message]
2014-03-14 13:13         ` [PATCH BlueZ v4 06/20] gatt: Add function to create constant attributes Claudio Takahasi
2014-03-14 13:13         ` [PATCH BlueZ v4 07/20] gatt: Add helper for creating GATT characteristics Claudio Takahasi
2014-03-14 13:13         ` [PATCH BlueZ v4 08/20] gatt: Add characteristic to the database Claudio Takahasi
2014-03-14 13:13         ` [PATCH BlueZ v4 09/20] gatt: Add hash table of GDBusProxy objects Claudio Takahasi
2014-03-14 13:13         ` [PATCH BlueZ v4 10/20] gatt: Add read callback to btd_gatt_add_char helper Claudio Takahasi
2014-03-14 13:13         ` [PATCH BlueZ v4 11/20] gatt: Assign read callback for external services Claudio Takahasi
2014-03-14 13:13         ` [PATCH BlueZ v4 12/20] gatt: Add write callback to btd_gatt_add_char helper Claudio Takahasi
2014-03-14 13:13         ` [PATCH BlueZ v4 13/20] gdbus: Add g_dbus_proxy_set_property_array Claudio Takahasi
2014-03-14 13:13         ` [PATCH BlueZ v4 14/20] gatt: Assign write callback for external services Claudio Takahasi
2014-03-14 13:13         ` [PATCH BlueZ v4 15/20] gatt: Add result callback for Write Request Claudio Takahasi
2014-03-14 13:13         ` [PATCH BlueZ v4 16/20] gatt: Add Write Request handling for GDBusProxy Claudio Takahasi
2014-03-14 13:13         ` [PATCH BlueZ v4 17/20] tools: Add Alert Level characteristic to gatt-service Claudio Takahasi
2014-03-14 13:13         ` [PATCH BlueZ v4 18/20] tools: Add reading Value property of gatt-service Claudio Takahasi
2014-03-14 13:13         ` [PATCH BlueZ v4 19/20] tools: Add setting " Claudio Takahasi
2014-03-14 13:13         ` [PATCH BlueZ v4 20/20] tools: Emit property changed when Value changes Claudio Takahasi
2014-03-18 20:26         ` [PATCH BlueZ v5 00/16] Add basic GATT characteristics Claudio Takahasi
2014-03-18 20:26           ` [PATCH BlueZ v5 01/16] shared: Add bswap_128() Claudio Takahasi
2014-03-18 20:26           ` [PATCH BlueZ v5 02/16] gatt: Add function to create constant attributes Claudio Takahasi
2014-03-18 20:26           ` [PATCH BlueZ v5 03/16] gatt: Add helper for creating GATT characteristics Claudio Takahasi
2014-03-18 20:26           ` [PATCH BlueZ v5 04/16] gatt: Add characteristic to the database Claudio Takahasi
2014-03-18 20:26           ` [PATCH BlueZ v5 05/16] gatt: Add hash table of GDBusProxy objects Claudio Takahasi
2014-03-18 20:26           ` [PATCH BlueZ v5 06/16] gatt: Add read callback to btd_gatt_add_char helper Claudio Takahasi
2014-03-18 20:26           ` [PATCH BlueZ v5 07/16] gatt: Assign read callback for external services Claudio Takahasi
2014-03-20 17:41             ` Johan Hedberg
2014-03-18 20:26           ` [PATCH BlueZ v5 08/16] gatt: Add write callback to btd_gatt_add_char helper Claudio Takahasi
2014-03-18 20:26           ` [PATCH BlueZ v5 09/16] gdbus: Add g_dbus_proxy_set_property_array Claudio Takahasi
2014-03-21  8:49             ` Johan Hedberg
2014-03-21 14:29               ` Claudio Takahasi
2014-03-18 20:26           ` [PATCH BlueZ v5 10/16] gatt: Assign write callback for external services Claudio Takahasi
2014-03-18 20:26           ` [PATCH BlueZ v5 11/16] gatt: Add result callback for Write Request Claudio Takahasi
2014-03-18 20:26           ` [PATCH BlueZ v5 12/16] gatt: Add Write Request handling for GDBusProxy Claudio Takahasi
2014-03-18 20:26           ` [PATCH BlueZ v5 13/16] tools: Add Alert Level characteristic to gatt-service Claudio Takahasi
2014-03-18 20:26           ` [PATCH BlueZ v5 14/16] tools: Add reading Value property of gatt-service Claudio Takahasi
2014-03-18 20:26           ` [PATCH BlueZ v5 15/16] tools: Add setting " Claudio Takahasi
2014-03-18 20:26           ` [PATCH BlueZ v5 16/16] tools: Emit property changed when Value changes Claudio Takahasi
2014-03-21 14:58           ` [PATCH BlueZ v6 00/10] Add basic GATT characteristics Claudio Takahasi
2014-03-21 14:58             ` [PATCH BlueZ v6 01/10] gatt: Assign read callback for external services Claudio Takahasi
2014-03-21 14:58             ` [PATCH BlueZ v6 02/10] gatt: Add write callback to btd_gatt_add_char helper Claudio Takahasi
2014-03-21 14:58             ` [PATCH BlueZ v6 03/10] gdbus: Add g_dbus_proxy_set_property_array Claudio Takahasi
2014-03-21 14:58             ` [PATCH BlueZ v6 04/10] gatt: Assign write callback for external services Claudio Takahasi
2014-03-21 14:58             ` [PATCH BlueZ v6 05/10] gatt: Add result callback for Write Request Claudio Takahasi
2014-03-21 14:58             ` [PATCH BlueZ v6 06/10] gatt: Add Write Request handling for GDBusProxy Claudio Takahasi
2014-03-21 14:58             ` [PATCH BlueZ v6 07/10] tools: Add Alert Level characteristic to gatt-service Claudio Takahasi
2014-03-21 14:58             ` [PATCH BlueZ v6 08/10] tools: Add reading Value property of gatt-service Claudio Takahasi
2014-03-21 14:58             ` [PATCH BlueZ v6 09/10] tools: Add setting " Claudio Takahasi
2014-03-21 14:58             ` [PATCH BlueZ v6 10/10] tools: Emit property changed when Value changes Claudio Takahasi
2014-03-21 19:16             ` [PATCH BlueZ v7 00/10] Add basic GATT characteristics Claudio Takahasi
2014-03-21 19:16               ` [PATCH BlueZ v7 01/10] gatt: Assign read callback for external services Claudio Takahasi
2014-03-21 19:16               ` [PATCH BlueZ v7 02/10] gatt: Add write callback to btd_gatt_add_char helper Claudio Takahasi
2014-03-24  8:58                 ` Johan Hedberg
2014-03-24 11:52                   ` Claudio Takahasi
2014-03-21 19:16               ` [PATCH BlueZ v7 03/10] gdbus: Add g_dbus_proxy_set_property_array Claudio Takahasi
2014-03-24  9:02                 ` Johan Hedberg
2014-03-21 19:16               ` [PATCH BlueZ v7 04/10] gatt: Assign write callback for external services Claudio Takahasi
2014-03-21 19:16               ` [PATCH BlueZ v7 05/10] gatt: Add result callback for Write Request Claudio Takahasi
2014-03-21 19:16               ` [PATCH BlueZ v7 06/10] gatt: Add Write Request handling for GDBusProxy Claudio Takahasi
2014-03-21 19:16               ` [PATCH BlueZ v7 07/10] tools: Add Alert Level characteristic to gatt-service Claudio Takahasi
2014-03-21 19:16               ` [PATCH BlueZ v7 08/10] tools: Add reading Value property of gatt-service Claudio Takahasi
2014-03-21 19:16               ` [PATCH BlueZ v7 09/10] tools: Add setting " Claudio Takahasi
2014-03-21 19:16               ` [PATCH BlueZ v7 10/10] tools: Emit property changed when Value changes Claudio Takahasi
2014-03-24 13:30               ` [PATCH BlueZ v8 0/8] Add basic GATT characteristics Claudio Takahasi
2014-03-24 13:30                 ` [PATCH BlueZ v8 1/8] gatt: Add write callback to btd_gatt_add_char helper Claudio Takahasi
2014-03-24 13:30                 ` [PATCH BlueZ v8 2/8] gatt: Assign write callback for external services Claudio Takahasi
2014-03-24 13:30                 ` [PATCH BlueZ v8 3/8] gatt: Add result callback for Write Request Claudio Takahasi
2014-03-24 13:30                 ` [PATCH BlueZ v8 4/8] gatt: Add Write Request handling for GDBusProxy Claudio Takahasi
2014-03-24 13:30                 ` [PATCH BlueZ v8 5/8] tools: Add Alert Level characteristic to gatt-service Claudio Takahasi
2014-03-24 13:30                 ` [PATCH BlueZ v8 6/8] tools: Add reading Value property of gatt-service Claudio Takahasi
2014-03-24 13:30                 ` [PATCH BlueZ v8 7/8] tools: Add setting " Claudio Takahasi
2014-03-24 13:30                 ` [PATCH BlueZ v8 8/8] tools: Emit property changed when Value changes Claudio Takahasi
2014-03-24 13:43                 ` [PATCH BlueZ v8 0/8] Add basic GATT characteristics Johan Hedberg

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=20140314135453.GA21071@localhost.P-661HNU-F1 \
    --to=johan.hedberg@gmail.com \
    --cc=claudio.takahasi@openbossa.org \
    --cc=linux-bluetooth@vger.kernel.org \
    /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 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).