summaryrefslogtreecommitdiff
path: root/profiles
diff options
context:
space:
mode:
authorAndrzej Kaczmarek <andrzej.kaczmarek@tieto.com>2014-05-26 15:16:38 +0200
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2014-05-27 17:56:36 +0300
commit73f55340288d8c7368376c2c95ef9726fd525c4e (patch)
tree311e34658977aac9af4882a6ea37e1f59faa408c /profiles
parent3c5413c3dd519ebbe385f480db0e3780d16d6b54 (diff)
downloadbluez-73f55340288d8c7368376c2c95ef9726fd525c4e.tar.gz
audio: Fix a2dp_vendor_codec_t declaration
As per A2DP spec, both Vendor ID (4.7.2.1) and Codec ID (4.7.2.2) are defined as 32-bit and 16-bit values respectively rather that array of bytes. Also changing to uint types will make using these values in code much easier.
Diffstat (limited to 'profiles')
-rw-r--r--profiles/audio/a2dp-codecs.h4
-rw-r--r--profiles/audio/a2dp.c12
2 files changed, 6 insertions, 10 deletions
diff --git a/profiles/audio/a2dp-codecs.h b/profiles/audio/a2dp-codecs.h
index 3dc31cbf9..0f44b103f 100644
--- a/profiles/audio/a2dp-codecs.h
+++ b/profiles/audio/a2dp-codecs.h
@@ -134,6 +134,6 @@ typedef struct {
#endif
typedef struct {
- uint8_t vendor_id[4];
- uint8_t codec_id[2];
+ uint32_t vendor_id;
+ uint16_t codec_id;
} __attribute__ ((packed)) a2dp_vendor_codec_t;
diff --git a/profiles/audio/a2dp.c b/profiles/audio/a2dp.c
index cabdd666e..c9dac9a08 100644
--- a/profiles/audio/a2dp.c
+++ b/profiles/audio/a2dp.c
@@ -1390,18 +1390,14 @@ static gboolean check_vendor_codec(struct a2dp_sep *sep, uint8_t *cap,
local_codec = (a2dp_vendor_codec_t *) capabilities;
- if (memcmp(remote_codec->vendor_id, local_codec->vendor_id,
- sizeof(local_codec->vendor_id)))
+ if (btohl(remote_codec->vendor_id) != btohl(local_codec->vendor_id))
return FALSE;
- if (memcmp(remote_codec->codec_id, local_codec->codec_id,
- sizeof(local_codec->codec_id)))
+ if (btohs(remote_codec->codec_id) != btohs(local_codec->codec_id))
return FALSE;
- DBG("vendor 0x%02x%02x%02x%02x codec 0x%02x%02x",
- remote_codec->vendor_id[0], remote_codec->vendor_id[1],
- remote_codec->vendor_id[2], remote_codec->vendor_id[3],
- remote_codec->codec_id[0], remote_codec->codec_id[1]);
+ DBG("vendor 0x%08x codec 0x%04x", btohl(remote_codec->vendor_id),
+ btohs(remote_codec->codec_id));
return TRUE;
}