* Re: [PATCH v2 1/4] Fix constness of att_get_u{8,16,32}() functions
From: Johan Hedberg @ 2010-10-04 19:17 UTC (permalink / raw)
To: Anderson Lizardo; +Cc: linux-bluetooth
In-Reply-To: <1286219584-8199-1-git-send-email-anderson.lizardo@openbossa.org>
Hi Anderson,
All four patches have been pushed upstream. Thanks.
Johan
^ permalink raw reply
* [PATCH v2 4/4] Modify dec_read_req() to get PDU length as parameter
From: Anderson Lizardo @ 2010-10-04 19:13 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Anderson Lizardo
In-Reply-To: <1286219584-8199-1-git-send-email-anderson.lizardo@openbossa.org>
This is consistent with other att.h functions, and allows length checks.
---
attrib/att.c | 5 ++++-
attrib/att.h | 2 +-
src/attrib-server.c | 2 +-
3 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/attrib/att.c b/attrib/att.c
index b18e1d6..2ffa8ce 100644
--- a/attrib/att.c
+++ b/attrib/att.c
@@ -379,7 +379,7 @@ uint16_t enc_read_req(uint16_t handle, uint8_t *pdu, int len)
return min_len;
}
-uint16_t dec_read_req(const uint8_t *pdu, uint16_t *handle)
+uint16_t dec_read_req(const uint8_t *pdu, int len, uint16_t *handle)
{
const uint16_t min_len = sizeof(pdu[0]) + sizeof(*handle);
@@ -389,6 +389,9 @@ uint16_t dec_read_req(const uint8_t *pdu, uint16_t *handle)
if (handle == NULL)
return 0;
+ if (len < min_len)
+ return 0;
+
if (pdu[0] != ATT_OP_READ_REQ)
return 0;
diff --git a/attrib/att.h b/attrib/att.h
index 3f1e239..e63c58e 100644
--- a/attrib/att.h
+++ b/attrib/att.h
@@ -179,7 +179,7 @@ uint16_t dec_write_cmd(const uint8_t *pdu, int len, uint16_t *handle,
uint8_t *value, int *vlen);
struct att_data_list *dec_read_by_type_resp(const uint8_t *pdu, int len);
uint16_t enc_read_req(uint16_t handle, uint8_t *pdu, int len);
-uint16_t dec_read_req(const uint8_t *pdu, uint16_t *handle);
+uint16_t dec_read_req(const uint8_t *pdu, int len, uint16_t *handle);
uint16_t enc_read_resp(uint8_t *value, int vlen, uint8_t *pdu, int len);
uint16_t dec_read_resp(const uint8_t *pdu, int len, uint8_t *value, int *vlen);
uint16_t enc_error_resp(uint8_t opcode, uint16_t handle, uint8_t status,
diff --git a/src/attrib-server.c b/src/attrib-server.c
index 475b68b..b45f300 100644
--- a/src/attrib-server.c
+++ b/src/attrib-server.c
@@ -478,7 +478,7 @@ static void channel_handler(const uint8_t *ipdu, uint16_t len,
length = read_by_type(start, end, &uuid, opdu, channel->mtu);
break;
case ATT_OP_READ_REQ:
- length = dec_read_req(ipdu, &start);
+ length = dec_read_req(ipdu, len, &start);
if (length == 0) {
status = ATT_ECODE_INVALID_PDU;
goto done;
--
1.7.0.4
^ permalink raw reply related
* [PATCH v2 3/4] Replace hardcoded minimum length values with constants
From: Anderson Lizardo @ 2010-10-04 19:13 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Anderson Lizardo
In-Reply-To: <1286219584-8199-1-git-send-email-anderson.lizardo@openbossa.org>
---
attrib/att.c | 128 ++++++++++++++++++++++++++++++++++++++--------------------
1 files changed, 84 insertions(+), 44 deletions(-)
diff --git a/attrib/att.c b/attrib/att.c
index 21659f0..b18e1d6 100644
--- a/attrib/att.c
+++ b/attrib/att.c
@@ -90,6 +90,7 @@ void att_data_list_free(struct att_data_list *list)
uint16_t enc_read_by_grp_req(uint16_t start, uint16_t end, uuid_t *uuid,
uint8_t *pdu, int len)
{
+ const uint16_t min_len = sizeof(pdu[0]) + sizeof(start) + sizeof(end);
uint16_t length;
if (!uuid)
@@ -102,7 +103,7 @@ uint16_t enc_read_by_grp_req(uint16_t start, uint16_t end, uuid_t *uuid,
else
return 0;
- if (len < 5 + length)
+ if (len < min_len + length)
return 0;
pdu[0] = ATT_OP_READ_BY_GROUP_REQ;
@@ -114,12 +115,14 @@ uint16_t enc_read_by_grp_req(uint16_t start, uint16_t end, uuid_t *uuid,
else
memcpy(&pdu[5], &uuid->value.uuid128, length);
- return 5 + length;
+ return min_len + length;
}
uint16_t dec_read_by_grp_req(const uint8_t *pdu, int len, uint16_t *start,
uint16_t *end, uuid_t *uuid)
{
+ const uint16_t min_len = sizeof(pdu[0]) + sizeof(*start) + sizeof(*end);
+
if (pdu == NULL)
return 0;
@@ -129,12 +132,12 @@ uint16_t dec_read_by_grp_req(const uint8_t *pdu, int len, uint16_t *start,
if (pdu[0] != ATT_OP_READ_BY_GROUP_REQ)
return 0;
- if (len < 7)
+ if (len < min_len + 2)
return 0;
*start = att_get_u16(&pdu[1]);
*end = att_get_u16(&pdu[3]);
- if (len == 7)
+ if (len == min_len + 2)
sdp_uuid16_create(uuid, att_get_u16(&pdu[5]));
else
sdp_uuid128_create(uuid, &pdu[5]);
@@ -203,6 +206,7 @@ uint16_t enc_find_by_type_req(uint16_t start, uint16_t end, uuid_t *uuid,
uint16_t enc_read_by_type_req(uint16_t start, uint16_t end, uuid_t *uuid,
uint8_t *pdu, int len)
{
+ const uint16_t min_len = sizeof(pdu[0]) + sizeof(start) + sizeof(end);
uint16_t length;
if (!uuid)
@@ -215,7 +219,7 @@ uint16_t enc_read_by_type_req(uint16_t start, uint16_t end, uuid_t *uuid,
else
return 0;
- if (len < 5 + length)
+ if (len < min_len + length)
return 0;
pdu[0] = ATT_OP_READ_BY_TYPE_REQ;
@@ -227,19 +231,21 @@ uint16_t enc_read_by_type_req(uint16_t start, uint16_t end, uuid_t *uuid,
else
memcpy(&pdu[5], &uuid->value.uuid128, length);
- return 5 + length;
+ return min_len + length;
}
uint16_t dec_read_by_type_req(const uint8_t *pdu, int len, uint16_t *start,
uint16_t *end, uuid_t *uuid)
{
+ const uint16_t min_len = sizeof(pdu[0]) + sizeof(*start) + sizeof(*end);
+
if (pdu == NULL)
return 0;
if (start == NULL || end == NULL || uuid == NULL)
return 0;
- if (len < 7)
+ if (len < min_len + 2)
return 0;
if (pdu[0] != ATT_OP_READ_BY_TYPE_REQ)
@@ -248,7 +254,7 @@ uint16_t dec_read_by_type_req(const uint8_t *pdu, int len, uint16_t *start,
*start = att_get_u16(&pdu[1]);
*end = att_get_u16(&pdu[3]);
- if (len == 7)
+ if (len == min_len + 2)
sdp_uuid16_create(uuid, att_get_u16(&pdu[5]));
else
sdp_uuid128_create(uuid, &pdu[5]);
@@ -311,64 +317,72 @@ struct att_data_list *dec_read_by_type_resp(const uint8_t *pdu, int len)
uint16_t enc_write_cmd(uint16_t handle, const uint8_t *value, int vlen,
uint8_t *pdu, int len)
{
+ const uint16_t min_len = sizeof(pdu[0]) + sizeof(handle);
+
if (pdu == NULL)
return 0;
- if (len < 3)
+ if (len < min_len)
return 0;
- if (vlen > len - 3)
- vlen = len - 3;
+ if (vlen > len - min_len)
+ vlen = len - min_len;
pdu[0] = ATT_OP_WRITE_CMD;
att_put_u16(handle, &pdu[1]);
if (vlen > 0) {
- memcpy(pdu + 3, value, vlen);
- return 3 + vlen;
+ memcpy(&pdu[3], value, vlen);
+ return min_len + vlen;
}
- return 3;
+ return min_len;
}
uint16_t dec_write_cmd(const uint8_t *pdu, int len, uint16_t *handle,
uint8_t *value, int *vlen)
{
+ const uint16_t min_len = sizeof(pdu[0]) + sizeof(*handle);
+
if (pdu == NULL)
return 0;
if (value == NULL || vlen == NULL || handle == NULL)
return 0;
- if (len < 3)
+ if (len < min_len)
return 0;
if (pdu[0] != ATT_OP_WRITE_CMD)
return 0;
*handle = att_get_u16(&pdu[1]);
- memcpy(value, pdu + 3, len - 3);
- *vlen = len - 3;
+ memcpy(value, pdu + min_len, len - min_len);
+ *vlen = len - min_len;
return len;
}
uint16_t enc_read_req(uint16_t handle, uint8_t *pdu, int len)
{
+ const uint16_t min_len = sizeof(pdu[0]) + sizeof(handle);
+
if (pdu == NULL)
return 0;
- if (len < 3)
+ if (len < min_len)
return 0;
pdu[0] = ATT_OP_READ_REQ;
att_put_u16(handle, &pdu[1]);
- return 3;
+ return min_len;
}
uint16_t dec_read_req(const uint8_t *pdu, uint16_t *handle)
{
+ const uint16_t min_len = sizeof(pdu[0]) + sizeof(*handle);
+
if (pdu == NULL)
return 0;
@@ -380,7 +394,7 @@ uint16_t dec_read_req(const uint8_t *pdu, uint16_t *handle)
*handle = att_get_u16(&pdu[1]);
- return 3;
+ return min_len;
}
uint16_t enc_read_resp(uint8_t *value, int vlen, uint8_t *pdu, int len)
@@ -422,9 +436,11 @@ uint16_t dec_read_resp(const uint8_t *pdu, int len, uint8_t *value, int *vlen)
uint16_t enc_error_resp(uint8_t opcode, uint16_t handle, uint8_t status,
uint8_t *pdu, int len)
{
+ const uint16_t min_len = sizeof(pdu[0]) + sizeof(opcode) +
+ sizeof(handle) + sizeof(status);
uint16_t u16;
- if (len < 5)
+ if (len < min_len)
return 0;
u16 = htobs(handle);
@@ -433,31 +449,35 @@ uint16_t enc_error_resp(uint8_t opcode, uint16_t handle, uint8_t status,
memcpy(&pdu[2], &u16, sizeof(u16));
pdu[4] = status;
- return 5;
+ return min_len;
}
uint16_t enc_find_info_req(uint16_t start, uint16_t end, uint8_t *pdu, int len)
{
+ const uint16_t min_len = sizeof(pdu[0]) + sizeof(start) + sizeof(end);
+
if (pdu == NULL)
return 0;
- if (len < 5)
+ if (len < min_len)
return 0;
pdu[0] = ATT_OP_FIND_INFO_REQ;
att_put_u16(start, &pdu[1]);
att_put_u16(end, &pdu[3]);
- return 5;
+ return min_len;
}
uint16_t dec_find_info_req(const uint8_t *pdu, int len, uint16_t *start,
uint16_t *end)
{
+ const uint16_t min_len = sizeof(pdu[0]) + sizeof(*start) + sizeof(*end);
+
if (pdu == NULL)
return 0;
- if (len < 5)
+ if (len < min_len)
return 0;
if (start == NULL || end == NULL)
@@ -469,7 +489,7 @@ uint16_t dec_find_info_req(const uint8_t *pdu, int len, uint16_t *start,
*start = att_get_u16(&pdu[1]);
*end = att_get_u16(&pdu[3]);
- return 5;
+ return min_len;
}
uint16_t enc_find_info_resp(uint8_t format, struct att_data_list *list,
@@ -520,10 +540,11 @@ struct att_data_list *dec_find_info_resp(const uint8_t *pdu, int len,
list = malloc(sizeof(struct att_data_list));
+ list->len = sizeof(pdu[0]) + sizeof(*format);
if (*format == 0x01)
- list->len = 4;
+ list->len += 2;
else if (*format == 0x02)
- list->len = 18;
+ list->len += 16;
list->num = (len - 2) / list->len;
list->data = malloc(sizeof(uint8_t *) * list->num);
@@ -541,36 +562,42 @@ struct att_data_list *dec_find_info_resp(const uint8_t *pdu, int len,
uint16_t enc_notification(struct attribute *a, uint8_t *pdu, int len)
{
+ const uint16_t min_len = sizeof(pdu[0]) + sizeof(uint16_t);
+
if (pdu == NULL)
return 0;
- if (len < (a->len + 3))
+ if (len < (a->len + min_len))
return 0;
pdu[0] = ATT_OP_HANDLE_NOTIFY;
att_put_u16(a->handle, &pdu[1]);
memcpy(&pdu[3], a->data, a->len);
- return a->len + 3;
+ return a->len + min_len;
}
uint16_t enc_indication(struct attribute *a, uint8_t *pdu, int len)
{
+ const uint16_t min_len = sizeof(pdu[0]) + sizeof(uint16_t);
+
if (pdu == NULL)
return 0;
- if (len < (a->len + 3))
+ if (len < (a->len + min_len))
return 0;
pdu[0] = ATT_OP_HANDLE_IND;
att_put_u16(a->handle, &pdu[1]);
memcpy(&pdu[3], a->data, a->len);
- return a->len + 3;
+ return a->len + min_len;
}
struct attribute *dec_indication(const uint8_t *pdu, int len)
{
+ const uint16_t min_len = sizeof(pdu[0]) + sizeof(uint16_t);
+
struct attribute *a;
if (pdu == NULL)
@@ -579,11 +606,14 @@ struct attribute *dec_indication(const uint8_t *pdu, int len)
if (pdu[0] != ATT_OP_HANDLE_IND)
return NULL;
- a = malloc(sizeof(struct attribute) + len - 3);
+ if (len < min_len)
+ return NULL;
+
+ a = malloc(sizeof(struct attribute) + len - min_len);
if (a == NULL)
return NULL;
- a->len = len - 3;
+ a->len = len - min_len;
a->handle = att_get_u16(&pdu[1]);
memcpy(a->data, &pdu[3], a->len);
@@ -593,40 +623,46 @@ struct attribute *dec_indication(const uint8_t *pdu, int len)
uint16_t enc_confirmation(uint8_t *pdu, int len)
{
+ const uint16_t min_len = sizeof(pdu[0]);
+
if (pdu == NULL)
return 0;
- if (len < 1)
+ if (len < min_len)
return 0;
pdu[0] = ATT_OP_HANDLE_CNF;
- return 1;
+ return min_len;
}
uint16_t enc_mtu_req(uint16_t mtu, uint8_t *pdu, int len)
{
+ const uint16_t min_len = sizeof(pdu[0]) + sizeof(mtu);
+
if (pdu == NULL)
return 0;
- if (len < 3)
+ if (len < min_len)
return 0;
pdu[0] = ATT_OP_MTU_REQ;
att_put_u16(mtu, &pdu[1]);
- return 3;
+ return min_len;
}
uint16_t dec_mtu_req(const uint8_t *pdu, int len, uint16_t *mtu)
{
+ const uint16_t min_len = sizeof(pdu[0]) + sizeof(*mtu);
+
if (pdu == NULL)
return 0;
if (mtu == NULL)
return 0;
- if (len < 3)
+ if (len < min_len)
return 0;
if (pdu[0] != ATT_OP_MTU_REQ)
@@ -634,32 +670,36 @@ uint16_t dec_mtu_req(const uint8_t *pdu, int len, uint16_t *mtu)
*mtu = att_get_u16(&pdu[1]);
- return 3;
+ return min_len;
}
uint16_t enc_mtu_resp(uint16_t mtu, uint8_t *pdu, int len)
{
+ const uint16_t min_len = sizeof(pdu[0]) + sizeof(mtu);
+
if (pdu == NULL)
return 0;
- if (len < 3)
+ if (len < min_len)
return 0;
pdu[0] = ATT_OP_MTU_RESP;
att_put_u16(mtu, &pdu[1]);
- return 3;
+ return min_len;
}
uint16_t dec_mtu_resp(const uint8_t *pdu, int len, uint16_t *mtu)
{
+ const uint16_t min_len = sizeof(pdu[0]) + sizeof(*mtu);
+
if (pdu == NULL)
return 0;
if (mtu == NULL)
return 0;
- if (len < 3)
+ if (len < min_len)
return 0;
if (pdu[0] != ATT_OP_MTU_RESP)
@@ -667,5 +707,5 @@ uint16_t dec_mtu_resp(const uint8_t *pdu, int len, uint16_t *mtu)
*mtu = att_get_u16(&pdu[1]);
- return 3;
+ return min_len;
}
--
1.7.0.4
^ permalink raw reply related
* [PATCH v2 2/4] Remove typecast from att_get_u16() calls
From: Anderson Lizardo @ 2010-10-04 19:13 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Anderson Lizardo
In-Reply-To: <1286219584-8199-1-git-send-email-anderson.lizardo@openbossa.org>
att_get_u16() already does a cast of the void* parameter to uint16_t*.
---
attrib/att.c | 26 +++++++++++++-------------
attrib/client.c | 19 +++++++++----------
attrib/gatttool.c | 21 +++++++++------------
3 files changed, 31 insertions(+), 35 deletions(-)
diff --git a/attrib/att.c b/attrib/att.c
index 6c697f8..21659f0 100644
--- a/attrib/att.c
+++ b/attrib/att.c
@@ -132,10 +132,10 @@ uint16_t dec_read_by_grp_req(const uint8_t *pdu, int len, uint16_t *start,
if (len < 7)
return 0;
- *start = att_get_u16((uint16_t *) &pdu[1]);
- *end = att_get_u16((uint16_t *) &pdu[3]);
+ *start = att_get_u16(&pdu[1]);
+ *end = att_get_u16(&pdu[3]);
if (len == 7)
- sdp_uuid16_create(uuid, att_get_u16((uint16_t *) &pdu[5]));
+ sdp_uuid16_create(uuid, att_get_u16(&pdu[5]));
else
sdp_uuid128_create(uuid, &pdu[5]);
@@ -245,11 +245,11 @@ uint16_t dec_read_by_type_req(const uint8_t *pdu, int len, uint16_t *start,
if (pdu[0] != ATT_OP_READ_BY_TYPE_REQ)
return 0;
- *start = att_get_u16((uint16_t *) &pdu[1]);
- *end = att_get_u16((uint16_t *) &pdu[3]);
+ *start = att_get_u16(&pdu[1]);
+ *end = att_get_u16(&pdu[3]);
if (len == 7)
- sdp_uuid16_create(uuid, att_get_u16((uint16_t *) &pdu[5]));
+ sdp_uuid16_create(uuid, att_get_u16(&pdu[5]));
else
sdp_uuid128_create(uuid, &pdu[5]);
@@ -346,7 +346,7 @@ uint16_t dec_write_cmd(const uint8_t *pdu, int len, uint16_t *handle,
if (pdu[0] != ATT_OP_WRITE_CMD)
return 0;
- *handle = att_get_u16((uint16_t *) &pdu[1]);
+ *handle = att_get_u16(&pdu[1]);
memcpy(value, pdu + 3, len - 3);
*vlen = len - 3;
@@ -378,7 +378,7 @@ uint16_t dec_read_req(const uint8_t *pdu, uint16_t *handle)
if (pdu[0] != ATT_OP_READ_REQ)
return 0;
- *handle = att_get_u16((uint16_t *) &pdu[1]);
+ *handle = att_get_u16(&pdu[1]);
return 3;
}
@@ -466,8 +466,8 @@ uint16_t dec_find_info_req(const uint8_t *pdu, int len, uint16_t *start,
if (pdu[0] != ATT_OP_FIND_INFO_REQ)
return 0;
- *start = att_get_u16((uint16_t *) &pdu[1]);
- *end = att_get_u16((uint16_t *) &pdu[3]);
+ *start = att_get_u16(&pdu[1]);
+ *end = att_get_u16(&pdu[3]);
return 5;
}
@@ -585,7 +585,7 @@ struct attribute *dec_indication(const uint8_t *pdu, int len)
a->len = len - 3;
- a->handle = att_get_u16((uint16_t *) &pdu[1]);
+ a->handle = att_get_u16(&pdu[1]);
memcpy(a->data, &pdu[3], a->len);
return a;
@@ -632,7 +632,7 @@ uint16_t dec_mtu_req(const uint8_t *pdu, int len, uint16_t *mtu)
if (pdu[0] != ATT_OP_MTU_REQ)
return 0;
- *mtu = att_get_u16((uint16_t *) &pdu[1]);
+ *mtu = att_get_u16(&pdu[1]);
return 3;
}
@@ -665,7 +665,7 @@ uint16_t dec_mtu_resp(const uint8_t *pdu, int len, uint16_t *mtu)
if (pdu[0] != ATT_OP_MTU_RESP)
return 0;
- *mtu = att_get_u16((uint16_t *) &pdu[1]);
+ *mtu = att_get_u16(&pdu[1]);
return 3;
}
diff --git a/attrib/client.c b/attrib/client.c
index db84b78..cd720e6 100644
--- a/attrib/client.c
+++ b/attrib/client.c
@@ -286,7 +286,7 @@ static void events_handler(const uint8_t *pdu, uint16_t len,
struct primary *prim;
GSList *lprim, *lchr;
uint8_t opdu[ATT_MAX_MTU];
- guint handle = att_get_u16((uint16_t *) &pdu[1]);
+ guint handle = att_get_u16(&pdu[1]);
uint16_t olen;
for (lprim = gatt->primary, prim = NULL, chr = NULL; lprim;
@@ -872,11 +872,10 @@ static void descriptor_cb(guint8 status, const guint8 *pdu, guint16 plen,
uint8_t *info = list->data[i];
struct query_data *qfmt;
- handle = att_get_u16((uint16_t *) info);
+ handle = att_get_u16(info);
if (format == 0x01) {
- sdp_uuid16_create(&uuid, att_get_u16((uint16_t *)
- &info[2]));
+ sdp_uuid16_create(&uuid, att_get_u16(&info[2]));
} else {
/* Currently, only "user description" and "presentation
* format" descriptors are used, and both have 16-bit
@@ -963,17 +962,17 @@ static void char_discovered_cb(guint8 status, const guint8 *pdu, guint16 plen,
chr = g_new0(struct characteristic, 1);
chr->prim = prim;
chr->perm = decl[2];
- chr->handle = att_get_u16((uint16_t *) &decl[3]);
+ chr->handle = att_get_u16(&decl[3]);
chr->path = g_strdup_printf("%s/characteristic%04x",
prim->path, chr->handle);
if (list->len == 7) {
sdp_uuid16_create(&chr->type,
- att_get_u16((uint16_t *) &decl[5]));
+ att_get_u16(&decl[5]));
} else
sdp_uuid128_create(&chr->type, &decl[5]);
if (previous_end) {
- *previous_end = att_get_u16((uint16_t *) decl);
+ *previous_end = att_get_u16(decl);
}
last = chr->handle;
@@ -1270,8 +1269,8 @@ static void primary_cb(guint8 status, const guint8 *pdu, guint16 plen,
/* Each element contains: attribute handle, end group handle
* and attribute value */
- start = att_get_u16((uint16_t *) info);
- end = att_get_u16((uint16_t *) &info[2]);
+ start = att_get_u16(info);
+ end = att_get_u16(&info[2]);
prim = g_new0(struct primary, 1);
prim->gatt = gatt;
@@ -1280,7 +1279,7 @@ static void primary_cb(guint8 status, const guint8 *pdu, guint16 plen,
if (list->len == 6) {
sdp_uuid16_create(&prim->uuid,
- att_get_u16((uint16_t *) &info[4]));
+ att_get_u16(&info[4]));
} else if (list->len == 20) {
/* FIXME: endianness */
diff --git a/attrib/gatttool.c b/attrib/gatttool.c
index 18f32a2..4a66340 100644
--- a/attrib/gatttool.c
+++ b/attrib/gatttool.c
@@ -167,14 +167,13 @@ static void primary_cb(guint8 status, const guint8 *pdu, guint16 plen,
/* Each element contains: attribute handle, end group handle
* and attribute value */
length = list->len - 2 * sizeof(uint16_t);
- start = att_get_u16((uint16_t *) value);
- end = att_get_u16((uint16_t *) &value[2]);
+ start = att_get_u16(value);
+ end = att_get_u16(&value[2]);
g_print("attr handle = 0x%04x, end grp handle = 0x%04x, ",
start, end);
if (length == 2)
- sdp_uuid16_create(&uuid, att_get_u16((uint16_t *)
- &value[4]));
+ sdp_uuid16_create(&uuid, att_get_u16(&value[4]));
else
sdp_uuid128_create(&uuid, value + 4);
@@ -204,7 +203,7 @@ static void events_handler(const uint8_t *pdu, uint16_t len, gpointer user_data)
uint8_t opdu[ATT_MAX_MTU];
uint16_t handle, i, olen = 0;
- handle = att_get_u16((uint16_t *) &pdu[1]);
+ handle = att_get_u16(&pdu[1]);
switch (pdu[0]) {
case ATT_OP_HANDLE_NOTIFY:
@@ -279,15 +278,14 @@ static void char_discovered_cb(guint8 status, const guint8 *pdu, guint16 plen,
char uuidstr[MAX_LEN_UUID_STR];
uuid_t uuid;
- last = att_get_u16((uint16_t *) value);
+ last = att_get_u16(value);
g_print("handle = 0x%04x, char properties = 0x%02x, "
"char value handle = 0x%04x, ", last, value[2],
- att_get_u16((uint16_t *) &value[3]));
+ att_get_u16(&value[3]));
if (list->len == 7)
- sdp_uuid16_create(&uuid, att_get_u16((uint16_t *)
- &value[5]));
+ sdp_uuid16_create(&uuid, att_get_u16(&value[5]));
else
sdp_uuid128_create(&uuid, value + 5);
@@ -447,11 +445,10 @@ static void char_desc_cb(guint8 status, const guint8 *pdu, guint16 plen,
uuid_t uuid;
value = list->data[i];
- handle = att_get_u16((uint16_t *) value);
+ handle = att_get_u16(value);
if (format == 0x01)
- sdp_uuid16_create(&uuid, att_get_u16((uint16_t *)
- &value[2]));
+ sdp_uuid16_create(&uuid, att_get_u16(&value[2]));
else
sdp_uuid128_create(&uuid, &value[2]);
--
1.7.0.4
^ permalink raw reply related
* [PATCH v2 1/4] Fix constness of att_get_u{8,16,32}() functions
From: Anderson Lizardo @ 2010-10-04 19:13 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Anderson Lizardo
---
attrib/att.h | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/attrib/att.h b/attrib/att.h
index 69071b4..3f1e239 100644
--- a/attrib/att.h
+++ b/attrib/att.h
@@ -123,21 +123,21 @@ struct att_data_list {
};
/* These functions do byte conversion */
-static inline uint8_t att_get_u8(void *ptr)
+static inline uint8_t att_get_u8(const void *ptr)
{
- uint8_t *u8_ptr = ptr;
+ const uint8_t *u8_ptr = ptr;
return bt_get_unaligned(u8_ptr);
}
-static inline uint16_t att_get_u16(void *ptr)
+static inline uint16_t att_get_u16(const void *ptr)
{
- uint16_t *u16_ptr = ptr;
+ const uint16_t *u16_ptr = ptr;
return btohs(bt_get_unaligned(u16_ptr));
}
-static inline uint32_t att_get_u32(void *ptr)
+static inline uint32_t att_get_u32(const void *ptr)
{
- uint32_t *u32_ptr = ptr;
+ const uint32_t *u32_ptr = ptr;
return btohl(bt_get_unaligned(u32_ptr));
}
--
1.7.0.4
^ permalink raw reply related
* Re: 2.6.36-rc6-git2: Reported regressions from 2.6.35
From: Justin P. Mattock @ 2010-10-04 18:57 UTC (permalink / raw)
To: Luis R. Rodriguez
Cc: Rafael J. Wysocki, linux-wireless, linux-bluetooth, Bob Copeland,
Pavel Machek, linux
In-Reply-To: <AANLkTimUdaUkpXmNt5mPkCdWmHvBbXWA6smAP4U80yc4@mail.gmail.com>
On 10/04/2010 11:35 AM, Luis R. Rodriguez wrote:
> Below are the 802.11 and Bluetooth ones:
>
> On Sun, Oct 3, 2010 at 2:15 PM, Rafael J. Wysocki<rjw@sisk.pl> wrote:
>> Unresolved regressions
>> ----------------------
>
>> Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=19392
>> Subject : WARNING: at drivers/net/wireless/ath/ath5k/base.c:3475 ath5k_bss_info_changed+0x44/0x168 [ath5k]()
>> Submitter : Justin Mattock<justinmattock@gmail.com>
>> Date : 2010-09-28 22:30 (6 days old)
>> Message-ID :<AANLkTim5WCGKPvEkOkO_YnMF9pg8mvLfQoFBNUFpfa_k@mail.gmail.com>
>> References : http://marc.info/?l=linux-kernel&m=128571307018635&w=2
>
> WTF -- this ended up in a bisect pointing to some PCMCIA patch! Justin:
>
> * does this happen with wireless-testing.git ?
no this is the current Linus tree(have not tried any other tree).
as for the unresolved regression, this just was filed a few days ago..
> * Did you do the bisect on the entire kernel? What git tree are you
> using to bisect?
>
the bisect had to be between 2.6.34 and 2.6.32 due to pcmcia breaking
after 2.6.34(there is a bug report for that, but got resolved)
> Did you simply bring up the interface and then suspsend? Did you not
> add a new interface in between this? ath5k's add_interace has:
>
> if (sc->vif) {
> ret = 0;
> goto end;
> }
>
> But why does it just allow this to go through without complaining if
> multiple vifs are not supported?
>
>
the system is opensuse 11.2, I just simply start the machine boot up,
after nm connects I open a terminal then suspend in the terminal, upon
wakeup this message appears.
>>
>> Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=17061
>> Subject : 2.6.36-rc1 on zaurus: bluetooth regression
>> Submitter : Pavel Machek<pavel@ucw.cz>
>> Date : 2010-08-21 15:24 (44 days old)
>> Message-ID :<20100821152445.GA1536@ucw.cz>
>> References : http://marc.info/?l=linux-kernel&m=128240433828087&w=2
>
> I see no updates to this since August. There are boat load of PCMCIA
> changes recently, is bisect possible here?
>
>
yeah the first pcmcia bug I hit with this machine was back in may/june
ended up doing a bisect for that(which was painful due to a slow
machine)which ended up getting fixed.(never thought to check s2ram after
that)
as for bluetooth the only issue I have with that is for my other
machines which is hitting this: http://lkml.org/lkml/2010/9/1/61
(but have not had a chance to follow through due to doing the update
broken web addresses in the kernel)
>> Regressions with patches
>> ------------------------
>
>
>> Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=17722
>> Subject : 2.6.36-rc3: WARNING: at net/mac80211/scan.c:269 ieee80211_scan_completed
>> Submitter : Thomas Meyer<thomas@m3y3r.de>
>> Date : 2010-08-31 20:14 (34 days old)
>> Message-ID :<201008312214.52473.thomas@m3y3r.de>
>> References : http://marc.info/?l=linux-kernel&m=128328580504227&w=2
>> http://www.spinics.net/lists/netdev/msg140769.html
>> Handled-By : Florian Mickler<florian@mickler.org>
>> Patch : https://bugzilla.kernel.org/attachment.cgi?id=31671
>
> This seems fixed.
>
> Luis
>
alright if this is with the latest wireless tree, then I can throw that
in to verify that it is indeed fixed..
Justin P. Mattock
^ permalink raw reply
* [PATCH 3/3] Modify dec_read_req() to get PDU length as parameter
From: Anderson Lizardo @ 2010-10-04 18:54 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Anderson Lizardo
In-Reply-To: <1286218482-972-1-git-send-email-anderson.lizardo@openbossa.org>
This is consistent with other att.h functions, and allows length checks.
---
attrib/att.c | 5 ++++-
attrib/att.h | 2 +-
src/attrib-server.c | 2 +-
3 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/attrib/att.c b/attrib/att.c
index a795ddd..fc87d98 100644
--- a/attrib/att.c
+++ b/attrib/att.c
@@ -379,7 +379,7 @@ uint16_t enc_read_req(uint16_t handle, uint8_t *pdu, int len)
return min_len;
}
-uint16_t dec_read_req(const uint8_t *pdu, uint16_t *handle)
+uint16_t dec_read_req(const uint8_t *pdu, int len, uint16_t *handle)
{
const uint16_t min_len = sizeof(pdu[0]) + sizeof(*handle);
@@ -389,6 +389,9 @@ uint16_t dec_read_req(const uint8_t *pdu, uint16_t *handle)
if (handle == NULL)
return 0;
+ if (len < min_len)
+ return 0;
+
if (pdu[0] != ATT_OP_READ_REQ)
return 0;
diff --git a/attrib/att.h b/attrib/att.h
index 69071b4..89fc52d 100644
--- a/attrib/att.h
+++ b/attrib/att.h
@@ -179,7 +179,7 @@ uint16_t dec_write_cmd(const uint8_t *pdu, int len, uint16_t *handle,
uint8_t *value, int *vlen);
struct att_data_list *dec_read_by_type_resp(const uint8_t *pdu, int len);
uint16_t enc_read_req(uint16_t handle, uint8_t *pdu, int len);
-uint16_t dec_read_req(const uint8_t *pdu, uint16_t *handle);
+uint16_t dec_read_req(const uint8_t *pdu, int len, uint16_t *handle);
uint16_t enc_read_resp(uint8_t *value, int vlen, uint8_t *pdu, int len);
uint16_t dec_read_resp(const uint8_t *pdu, int len, uint8_t *value, int *vlen);
uint16_t enc_error_resp(uint8_t opcode, uint16_t handle, uint8_t status,
diff --git a/src/attrib-server.c b/src/attrib-server.c
index 475b68b..b45f300 100644
--- a/src/attrib-server.c
+++ b/src/attrib-server.c
@@ -478,7 +478,7 @@ static void channel_handler(const uint8_t *ipdu, uint16_t len,
length = read_by_type(start, end, &uuid, opdu, channel->mtu);
break;
case ATT_OP_READ_REQ:
- length = dec_read_req(ipdu, &start);
+ length = dec_read_req(ipdu, len, &start);
if (length == 0) {
status = ATT_ECODE_INVALID_PDU;
goto done;
--
1.7.0.4
^ permalink raw reply related
* [PATCH 2/3] Replace hardcoded minimum length values with constants
From: Anderson Lizardo @ 2010-10-04 18:54 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Anderson Lizardo
In-Reply-To: <1286218482-972-1-git-send-email-anderson.lizardo@openbossa.org>
---
attrib/att.c | 126 +++++++++++++++++++++++++++++++++++++--------------------
1 files changed, 82 insertions(+), 44 deletions(-)
diff --git a/attrib/att.c b/attrib/att.c
index 21659f0..a795ddd 100644
--- a/attrib/att.c
+++ b/attrib/att.c
@@ -90,6 +90,7 @@ void att_data_list_free(struct att_data_list *list)
uint16_t enc_read_by_grp_req(uint16_t start, uint16_t end, uuid_t *uuid,
uint8_t *pdu, int len)
{
+ const uint16_t min_len = sizeof(pdu[0]) + sizeof(start) + sizeof(end);
uint16_t length;
if (!uuid)
@@ -102,7 +103,7 @@ uint16_t enc_read_by_grp_req(uint16_t start, uint16_t end, uuid_t *uuid,
else
return 0;
- if (len < 5 + length)
+ if (len < min_len + length)
return 0;
pdu[0] = ATT_OP_READ_BY_GROUP_REQ;
@@ -114,12 +115,14 @@ uint16_t enc_read_by_grp_req(uint16_t start, uint16_t end, uuid_t *uuid,
else
memcpy(&pdu[5], &uuid->value.uuid128, length);
- return 5 + length;
+ return min_len + length;
}
uint16_t dec_read_by_grp_req(const uint8_t *pdu, int len, uint16_t *start,
uint16_t *end, uuid_t *uuid)
{
+ const uint16_t min_len = sizeof(pdu[0]) + sizeof(*start) + sizeof(*end);
+
if (pdu == NULL)
return 0;
@@ -129,12 +132,12 @@ uint16_t dec_read_by_grp_req(const uint8_t *pdu, int len, uint16_t *start,
if (pdu[0] != ATT_OP_READ_BY_GROUP_REQ)
return 0;
- if (len < 7)
+ if (len < min_len + 2)
return 0;
*start = att_get_u16(&pdu[1]);
*end = att_get_u16(&pdu[3]);
- if (len == 7)
+ if (len == min_len + 2)
sdp_uuid16_create(uuid, att_get_u16(&pdu[5]));
else
sdp_uuid128_create(uuid, &pdu[5]);
@@ -203,6 +206,7 @@ uint16_t enc_find_by_type_req(uint16_t start, uint16_t end, uuid_t *uuid,
uint16_t enc_read_by_type_req(uint16_t start, uint16_t end, uuid_t *uuid,
uint8_t *pdu, int len)
{
+ const uint16_t min_len = sizeof(pdu[0]) + sizeof(start) + sizeof(end);
uint16_t length;
if (!uuid)
@@ -215,7 +219,7 @@ uint16_t enc_read_by_type_req(uint16_t start, uint16_t end, uuid_t *uuid,
else
return 0;
- if (len < 5 + length)
+ if (len < min_len + length)
return 0;
pdu[0] = ATT_OP_READ_BY_TYPE_REQ;
@@ -227,19 +231,21 @@ uint16_t enc_read_by_type_req(uint16_t start, uint16_t end, uuid_t *uuid,
else
memcpy(&pdu[5], &uuid->value.uuid128, length);
- return 5 + length;
+ return min_len + length;
}
uint16_t dec_read_by_type_req(const uint8_t *pdu, int len, uint16_t *start,
uint16_t *end, uuid_t *uuid)
{
+ const uint16_t min_len = sizeof(pdu[0]) + sizeof(*start) + sizeof(*end);
+
if (pdu == NULL)
return 0;
if (start == NULL || end == NULL || uuid == NULL)
return 0;
- if (len < 7)
+ if (len < min_len + 2)
return 0;
if (pdu[0] != ATT_OP_READ_BY_TYPE_REQ)
@@ -248,7 +254,7 @@ uint16_t dec_read_by_type_req(const uint8_t *pdu, int len, uint16_t *start,
*start = att_get_u16(&pdu[1]);
*end = att_get_u16(&pdu[3]);
- if (len == 7)
+ if (len == min_len + 2)
sdp_uuid16_create(uuid, att_get_u16(&pdu[5]));
else
sdp_uuid128_create(uuid, &pdu[5]);
@@ -311,64 +317,72 @@ struct att_data_list *dec_read_by_type_resp(const uint8_t *pdu, int len)
uint16_t enc_write_cmd(uint16_t handle, const uint8_t *value, int vlen,
uint8_t *pdu, int len)
{
+ const uint16_t min_len = sizeof(pdu[0]) + sizeof(handle);
+
if (pdu == NULL)
return 0;
- if (len < 3)
+ if (len < min_len)
return 0;
- if (vlen > len - 3)
- vlen = len - 3;
+ if (vlen > len - min_len)
+ vlen = len - min_len;
pdu[0] = ATT_OP_WRITE_CMD;
att_put_u16(handle, &pdu[1]);
if (vlen > 0) {
- memcpy(pdu + 3, value, vlen);
- return 3 + vlen;
+ memcpy(&pdu[3], value, vlen);
+ return min_len + vlen;
}
- return 3;
+ return min_len;
}
uint16_t dec_write_cmd(const uint8_t *pdu, int len, uint16_t *handle,
uint8_t *value, int *vlen)
{
+ const uint16_t min_len = sizeof(pdu[0]) + sizeof(*handle);
+
if (pdu == NULL)
return 0;
if (value == NULL || vlen == NULL || handle == NULL)
return 0;
- if (len < 3)
+ if (len < min_len)
return 0;
if (pdu[0] != ATT_OP_WRITE_CMD)
return 0;
*handle = att_get_u16(&pdu[1]);
- memcpy(value, pdu + 3, len - 3);
- *vlen = len - 3;
+ memcpy(value, pdu + min_len, len - min_len);
+ *vlen = len - min_len;
return len;
}
uint16_t enc_read_req(uint16_t handle, uint8_t *pdu, int len)
{
+ const uint16_t min_len = sizeof(pdu[0]) + sizeof(handle);
+
if (pdu == NULL)
return 0;
- if (len < 3)
+ if (len < min_len)
return 0;
pdu[0] = ATT_OP_READ_REQ;
att_put_u16(handle, &pdu[1]);
- return 3;
+ return min_len;
}
uint16_t dec_read_req(const uint8_t *pdu, uint16_t *handle)
{
+ const uint16_t min_len = sizeof(pdu[0]) + sizeof(*handle);
+
if (pdu == NULL)
return 0;
@@ -380,7 +394,7 @@ uint16_t dec_read_req(const uint8_t *pdu, uint16_t *handle)
*handle = att_get_u16(&pdu[1]);
- return 3;
+ return min_len;
}
uint16_t enc_read_resp(uint8_t *value, int vlen, uint8_t *pdu, int len)
@@ -422,9 +436,11 @@ uint16_t dec_read_resp(const uint8_t *pdu, int len, uint8_t *value, int *vlen)
uint16_t enc_error_resp(uint8_t opcode, uint16_t handle, uint8_t status,
uint8_t *pdu, int len)
{
+ const uint16_t min_len = sizeof(pdu[0]) + sizeof(opcode) +
+ sizeof(handle) + sizeof(status);
uint16_t u16;
- if (len < 5)
+ if (len < min_len)
return 0;
u16 = htobs(handle);
@@ -433,31 +449,35 @@ uint16_t enc_error_resp(uint8_t opcode, uint16_t handle, uint8_t status,
memcpy(&pdu[2], &u16, sizeof(u16));
pdu[4] = status;
- return 5;
+ return min_len;
}
uint16_t enc_find_info_req(uint16_t start, uint16_t end, uint8_t *pdu, int len)
{
+ const uint16_t min_len = sizeof(pdu[0]) + sizeof(start) + sizeof(end);
+
if (pdu == NULL)
return 0;
- if (len < 5)
+ if (len < min_len)
return 0;
pdu[0] = ATT_OP_FIND_INFO_REQ;
att_put_u16(start, &pdu[1]);
att_put_u16(end, &pdu[3]);
- return 5;
+ return min_len;
}
uint16_t dec_find_info_req(const uint8_t *pdu, int len, uint16_t *start,
uint16_t *end)
{
+ const uint16_t min_len = sizeof(pdu[0]) + sizeof(*start) + sizeof(*end);
+
if (pdu == NULL)
return 0;
- if (len < 5)
+ if (len < min_len)
return 0;
if (start == NULL || end == NULL)
@@ -469,7 +489,7 @@ uint16_t dec_find_info_req(const uint8_t *pdu, int len, uint16_t *start,
*start = att_get_u16(&pdu[1]);
*end = att_get_u16(&pdu[3]);
- return 5;
+ return min_len;
}
uint16_t enc_find_info_resp(uint8_t format, struct att_data_list *list,
@@ -520,10 +540,11 @@ struct att_data_list *dec_find_info_resp(const uint8_t *pdu, int len,
list = malloc(sizeof(struct att_data_list));
+ list->len = sizeof(pdu[0]) + sizeof(*format);
if (*format == 0x01)
- list->len = 4;
+ list->len += 2;
else if (*format == 0x02)
- list->len = 18;
+ list->len += 16;
list->num = (len - 2) / list->len;
list->data = malloc(sizeof(uint8_t *) * list->num);
@@ -541,36 +562,42 @@ struct att_data_list *dec_find_info_resp(const uint8_t *pdu, int len,
uint16_t enc_notification(struct attribute *a, uint8_t *pdu, int len)
{
+ const uint16_t min_len = sizeof(pdu[0]) + sizeof(uint16_t);
+
if (pdu == NULL)
return 0;
- if (len < (a->len + 3))
+ if (len < (a->len + min_len))
return 0;
pdu[0] = ATT_OP_HANDLE_NOTIFY;
att_put_u16(a->handle, &pdu[1]);
memcpy(&pdu[3], a->data, a->len);
- return a->len + 3;
+ return a->len + min_len;
}
uint16_t enc_indication(struct attribute *a, uint8_t *pdu, int len)
{
+ const uint16_t min_len = sizeof(pdu[0]) + sizeof(uint16_t);
+
if (pdu == NULL)
return 0;
- if (len < (a->len + 3))
+ if (len < (a->len + min_len))
return 0;
pdu[0] = ATT_OP_HANDLE_IND;
att_put_u16(a->handle, &pdu[1]);
memcpy(&pdu[3], a->data, a->len);
- return a->len + 3;
+ return a->len + min_len;
}
struct attribute *dec_indication(const uint8_t *pdu, int len)
{
+ const uint16_t min_len = sizeof(pdu[0]) + sizeof(uint16_t);
+
struct attribute *a;
if (pdu == NULL)
@@ -579,11 +606,14 @@ struct attribute *dec_indication(const uint8_t *pdu, int len)
if (pdu[0] != ATT_OP_HANDLE_IND)
return NULL;
- a = malloc(sizeof(struct attribute) + len - 3);
+ if (len < min_len)
+ return NULL;
+
+ a = malloc(sizeof(struct attribute) + len - min_len);
if (a == NULL)
return NULL;
- a->len = len - 3;
+ a->len = len - min_len;
a->handle = att_get_u16(&pdu[1]);
memcpy(a->data, &pdu[3], a->len);
@@ -596,37 +626,41 @@ uint16_t enc_confirmation(uint8_t *pdu, int len)
if (pdu == NULL)
return 0;
- if (len < 1)
+ if (len < sizeof(pdu[0]))
return 0;
pdu[0] = ATT_OP_HANDLE_CNF;
- return 1;
+ return sizeof(pdu[0]);
}
uint16_t enc_mtu_req(uint16_t mtu, uint8_t *pdu, int len)
{
+ const uint16_t min_len = sizeof(pdu[0]) + sizeof(mtu);
+
if (pdu == NULL)
return 0;
- if (len < 3)
+ if (len < min_len)
return 0;
pdu[0] = ATT_OP_MTU_REQ;
att_put_u16(mtu, &pdu[1]);
- return 3;
+ return min_len;
}
uint16_t dec_mtu_req(const uint8_t *pdu, int len, uint16_t *mtu)
{
+ const uint16_t min_len = sizeof(pdu[0]) + sizeof(*mtu);
+
if (pdu == NULL)
return 0;
if (mtu == NULL)
return 0;
- if (len < 3)
+ if (len < min_len)
return 0;
if (pdu[0] != ATT_OP_MTU_REQ)
@@ -634,32 +668,36 @@ uint16_t dec_mtu_req(const uint8_t *pdu, int len, uint16_t *mtu)
*mtu = att_get_u16(&pdu[1]);
- return 3;
+ return min_len;
}
uint16_t enc_mtu_resp(uint16_t mtu, uint8_t *pdu, int len)
{
+ const uint16_t min_len = sizeof(pdu[0]) + sizeof(mtu);
+
if (pdu == NULL)
return 0;
- if (len < 3)
+ if (len < min_len)
return 0;
pdu[0] = ATT_OP_MTU_RESP;
att_put_u16(mtu, &pdu[1]);
- return 3;
+ return min_len;
}
uint16_t dec_mtu_resp(const uint8_t *pdu, int len, uint16_t *mtu)
{
+ const uint16_t min_len = sizeof(pdu[0]) + sizeof(*mtu);
+
if (pdu == NULL)
return 0;
if (mtu == NULL)
return 0;
- if (len < 3)
+ if (len < min_len)
return 0;
if (pdu[0] != ATT_OP_MTU_RESP)
@@ -667,5 +705,5 @@ uint16_t dec_mtu_resp(const uint8_t *pdu, int len, uint16_t *mtu)
*mtu = att_get_u16(&pdu[1]);
- return 3;
+ return min_len;
}
--
1.7.0.4
^ permalink raw reply related
* [PATCH 1/3] Remove typecast from att_get_u16() calls
From: Anderson Lizardo @ 2010-10-04 18:54 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Anderson Lizardo
att_get_u16() already does a cast of the void* parameter to uint16_t*.
---
attrib/att.c | 26 +++++++++++++-------------
attrib/client.c | 19 +++++++++----------
attrib/gatttool.c | 21 +++++++++------------
3 files changed, 31 insertions(+), 35 deletions(-)
diff --git a/attrib/att.c b/attrib/att.c
index 6c697f8..21659f0 100644
--- a/attrib/att.c
+++ b/attrib/att.c
@@ -132,10 +132,10 @@ uint16_t dec_read_by_grp_req(const uint8_t *pdu, int len, uint16_t *start,
if (len < 7)
return 0;
- *start = att_get_u16((uint16_t *) &pdu[1]);
- *end = att_get_u16((uint16_t *) &pdu[3]);
+ *start = att_get_u16(&pdu[1]);
+ *end = att_get_u16(&pdu[3]);
if (len == 7)
- sdp_uuid16_create(uuid, att_get_u16((uint16_t *) &pdu[5]));
+ sdp_uuid16_create(uuid, att_get_u16(&pdu[5]));
else
sdp_uuid128_create(uuid, &pdu[5]);
@@ -245,11 +245,11 @@ uint16_t dec_read_by_type_req(const uint8_t *pdu, int len, uint16_t *start,
if (pdu[0] != ATT_OP_READ_BY_TYPE_REQ)
return 0;
- *start = att_get_u16((uint16_t *) &pdu[1]);
- *end = att_get_u16((uint16_t *) &pdu[3]);
+ *start = att_get_u16(&pdu[1]);
+ *end = att_get_u16(&pdu[3]);
if (len == 7)
- sdp_uuid16_create(uuid, att_get_u16((uint16_t *) &pdu[5]));
+ sdp_uuid16_create(uuid, att_get_u16(&pdu[5]));
else
sdp_uuid128_create(uuid, &pdu[5]);
@@ -346,7 +346,7 @@ uint16_t dec_write_cmd(const uint8_t *pdu, int len, uint16_t *handle,
if (pdu[0] != ATT_OP_WRITE_CMD)
return 0;
- *handle = att_get_u16((uint16_t *) &pdu[1]);
+ *handle = att_get_u16(&pdu[1]);
memcpy(value, pdu + 3, len - 3);
*vlen = len - 3;
@@ -378,7 +378,7 @@ uint16_t dec_read_req(const uint8_t *pdu, uint16_t *handle)
if (pdu[0] != ATT_OP_READ_REQ)
return 0;
- *handle = att_get_u16((uint16_t *) &pdu[1]);
+ *handle = att_get_u16(&pdu[1]);
return 3;
}
@@ -466,8 +466,8 @@ uint16_t dec_find_info_req(const uint8_t *pdu, int len, uint16_t *start,
if (pdu[0] != ATT_OP_FIND_INFO_REQ)
return 0;
- *start = att_get_u16((uint16_t *) &pdu[1]);
- *end = att_get_u16((uint16_t *) &pdu[3]);
+ *start = att_get_u16(&pdu[1]);
+ *end = att_get_u16(&pdu[3]);
return 5;
}
@@ -585,7 +585,7 @@ struct attribute *dec_indication(const uint8_t *pdu, int len)
a->len = len - 3;
- a->handle = att_get_u16((uint16_t *) &pdu[1]);
+ a->handle = att_get_u16(&pdu[1]);
memcpy(a->data, &pdu[3], a->len);
return a;
@@ -632,7 +632,7 @@ uint16_t dec_mtu_req(const uint8_t *pdu, int len, uint16_t *mtu)
if (pdu[0] != ATT_OP_MTU_REQ)
return 0;
- *mtu = att_get_u16((uint16_t *) &pdu[1]);
+ *mtu = att_get_u16(&pdu[1]);
return 3;
}
@@ -665,7 +665,7 @@ uint16_t dec_mtu_resp(const uint8_t *pdu, int len, uint16_t *mtu)
if (pdu[0] != ATT_OP_MTU_RESP)
return 0;
- *mtu = att_get_u16((uint16_t *) &pdu[1]);
+ *mtu = att_get_u16(&pdu[1]);
return 3;
}
diff --git a/attrib/client.c b/attrib/client.c
index db84b78..cd720e6 100644
--- a/attrib/client.c
+++ b/attrib/client.c
@@ -286,7 +286,7 @@ static void events_handler(const uint8_t *pdu, uint16_t len,
struct primary *prim;
GSList *lprim, *lchr;
uint8_t opdu[ATT_MAX_MTU];
- guint handle = att_get_u16((uint16_t *) &pdu[1]);
+ guint handle = att_get_u16(&pdu[1]);
uint16_t olen;
for (lprim = gatt->primary, prim = NULL, chr = NULL; lprim;
@@ -872,11 +872,10 @@ static void descriptor_cb(guint8 status, const guint8 *pdu, guint16 plen,
uint8_t *info = list->data[i];
struct query_data *qfmt;
- handle = att_get_u16((uint16_t *) info);
+ handle = att_get_u16(info);
if (format == 0x01) {
- sdp_uuid16_create(&uuid, att_get_u16((uint16_t *)
- &info[2]));
+ sdp_uuid16_create(&uuid, att_get_u16(&info[2]));
} else {
/* Currently, only "user description" and "presentation
* format" descriptors are used, and both have 16-bit
@@ -963,17 +962,17 @@ static void char_discovered_cb(guint8 status, const guint8 *pdu, guint16 plen,
chr = g_new0(struct characteristic, 1);
chr->prim = prim;
chr->perm = decl[2];
- chr->handle = att_get_u16((uint16_t *) &decl[3]);
+ chr->handle = att_get_u16(&decl[3]);
chr->path = g_strdup_printf("%s/characteristic%04x",
prim->path, chr->handle);
if (list->len == 7) {
sdp_uuid16_create(&chr->type,
- att_get_u16((uint16_t *) &decl[5]));
+ att_get_u16(&decl[5]));
} else
sdp_uuid128_create(&chr->type, &decl[5]);
if (previous_end) {
- *previous_end = att_get_u16((uint16_t *) decl);
+ *previous_end = att_get_u16(decl);
}
last = chr->handle;
@@ -1270,8 +1269,8 @@ static void primary_cb(guint8 status, const guint8 *pdu, guint16 plen,
/* Each element contains: attribute handle, end group handle
* and attribute value */
- start = att_get_u16((uint16_t *) info);
- end = att_get_u16((uint16_t *) &info[2]);
+ start = att_get_u16(info);
+ end = att_get_u16(&info[2]);
prim = g_new0(struct primary, 1);
prim->gatt = gatt;
@@ -1280,7 +1279,7 @@ static void primary_cb(guint8 status, const guint8 *pdu, guint16 plen,
if (list->len == 6) {
sdp_uuid16_create(&prim->uuid,
- att_get_u16((uint16_t *) &info[4]));
+ att_get_u16(&info[4]));
} else if (list->len == 20) {
/* FIXME: endianness */
diff --git a/attrib/gatttool.c b/attrib/gatttool.c
index 18f32a2..4a66340 100644
--- a/attrib/gatttool.c
+++ b/attrib/gatttool.c
@@ -167,14 +167,13 @@ static void primary_cb(guint8 status, const guint8 *pdu, guint16 plen,
/* Each element contains: attribute handle, end group handle
* and attribute value */
length = list->len - 2 * sizeof(uint16_t);
- start = att_get_u16((uint16_t *) value);
- end = att_get_u16((uint16_t *) &value[2]);
+ start = att_get_u16(value);
+ end = att_get_u16(&value[2]);
g_print("attr handle = 0x%04x, end grp handle = 0x%04x, ",
start, end);
if (length == 2)
- sdp_uuid16_create(&uuid, att_get_u16((uint16_t *)
- &value[4]));
+ sdp_uuid16_create(&uuid, att_get_u16(&value[4]));
else
sdp_uuid128_create(&uuid, value + 4);
@@ -204,7 +203,7 @@ static void events_handler(const uint8_t *pdu, uint16_t len, gpointer user_data)
uint8_t opdu[ATT_MAX_MTU];
uint16_t handle, i, olen = 0;
- handle = att_get_u16((uint16_t *) &pdu[1]);
+ handle = att_get_u16(&pdu[1]);
switch (pdu[0]) {
case ATT_OP_HANDLE_NOTIFY:
@@ -279,15 +278,14 @@ static void char_discovered_cb(guint8 status, const guint8 *pdu, guint16 plen,
char uuidstr[MAX_LEN_UUID_STR];
uuid_t uuid;
- last = att_get_u16((uint16_t *) value);
+ last = att_get_u16(value);
g_print("handle = 0x%04x, char properties = 0x%02x, "
"char value handle = 0x%04x, ", last, value[2],
- att_get_u16((uint16_t *) &value[3]));
+ att_get_u16(&value[3]));
if (list->len == 7)
- sdp_uuid16_create(&uuid, att_get_u16((uint16_t *)
- &value[5]));
+ sdp_uuid16_create(&uuid, att_get_u16(&value[5]));
else
sdp_uuid128_create(&uuid, value + 5);
@@ -447,11 +445,10 @@ static void char_desc_cb(guint8 status, const guint8 *pdu, guint16 plen,
uuid_t uuid;
value = list->data[i];
- handle = att_get_u16((uint16_t *) value);
+ handle = att_get_u16(value);
if (format == 0x01)
- sdp_uuid16_create(&uuid, att_get_u16((uint16_t *)
- &value[2]));
+ sdp_uuid16_create(&uuid, att_get_u16(&value[2]));
else
sdp_uuid128_create(&uuid, &value[2]);
--
1.7.0.4
^ permalink raw reply related
* Re: 2.6.36-rc6-git2: Reported regressions from 2.6.35
From: Dominik Brodowski @ 2010-10-04 18:44 UTC (permalink / raw)
To: Luis R. Rodriguez
Cc: Rafael J. Wysocki, linux-wireless, linux-bluetooth, justinmattock,
Bob Copeland, Pavel Machek
In-Reply-To: <AANLkTimUdaUkpXmNt5mPkCdWmHvBbXWA6smAP4U80yc4@mail.gmail.com>
Hey,
On Mon, Oct 04, 2010 at 11:35:25AM -0700, Luis R. Rodriguez wrote:
> > Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=17061
> > Subject : 2.6.36-rc1 on zaurus: bluetooth regression
> > Submitter : Pavel Machek <pavel@ucw.cz>
> > Date : 2010-08-21 15:24 (44 days old)
> > Message-ID : <20100821152445.GA1536@ucw.cz>
> > References : http://marc.info/?l=linux-kernel&m=128240433828087&w=2
>
> I see no updates to this since August. There are boat load of PCMCIA
> changes recently, is bisect possible here?
Pavel already verified the PCMCIA-bigdiff since 2.6.35 does work, so it is
_not_ a PCMCIA issue.
http://www.mail-archive.com/linux-pcmcia@lists.infradead.org/msg03460.html
Best,
Dominik
^ permalink raw reply
* Re: 2.6.36-rc6-git2: Reported regressions from 2.6.35
From: Luis R. Rodriguez @ 2010-10-04 18:35 UTC (permalink / raw)
To: Rafael J. Wysocki, linux-wireless, linux-bluetooth
Cc: justinmattock, Bob Copeland, Pavel Machek, linux
In-Reply-To: <-jYMINoCtaK.A.F5.8CPqMB@chimera>
Below are the 802.11 and Bluetooth ones:
On Sun, Oct 3, 2010 at 2:15 PM, Rafael J. Wysocki <rjw@sisk.pl> wrote:
> Unresolved regressions
> ----------------------
> Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=19392
> Subject : WARNING: at drivers/net/wireless/ath/ath5k/base.c:3475 ath5k_bss_info_changed+0x44/0x168 [ath5k]()
> Submitter : Justin Mattock <justinmattock@gmail.com>
> Date : 2010-09-28 22:30 (6 days old)
> Message-ID : <AANLkTim5WCGKPvEkOkO_YnMF9pg8mvLfQoFBNUFpfa_k@mail.gmail.com>
> References : http://marc.info/?l=linux-kernel&m=128571307018635&w=2
WTF -- this ended up in a bisect pointing to some PCMCIA patch! Justin:
* does this happen with wireless-testing.git ?
* Did you do the bisect on the entire kernel? What git tree are you
using to bisect?
Did you simply bring up the interface and then suspsend? Did you not
add a new interface in between this? ath5k's add_interace has:
if (sc->vif) {
ret = 0;
goto end;
}
But why does it just allow this to go through without complaining if
multiple vifs are not supported?
>
> Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=17061
> Subject : 2.6.36-rc1 on zaurus: bluetooth regression
> Submitter : Pavel Machek <pavel@ucw.cz>
> Date : 2010-08-21 15:24 (44 days old)
> Message-ID : <20100821152445.GA1536@ucw.cz>
> References : http://marc.info/?l=linux-kernel&m=128240433828087&w=2
I see no updates to this since August. There are boat load of PCMCIA
changes recently, is bisect possible here?
> Regressions with patches
> ------------------------
> Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=17722
> Subject : 2.6.36-rc3: WARNING: at net/mac80211/scan.c:269 ieee80211_scan_completed
> Submitter : Thomas Meyer <thomas@m3y3r.de>
> Date : 2010-08-31 20:14 (34 days old)
> Message-ID : <201008312214.52473.thomas@m3y3r.de>
> References : http://marc.info/?l=linux-kernel&m=128328580504227&w=2
> http://www.spinics.net/lists/netdev/msg140769.html
> Handled-By : Florian Mickler <florian@mickler.org>
> Patch : https://bugzilla.kernel.org/attachment.cgi?id=31671
This seems fixed.
Luis
^ permalink raw reply
* Re: 2.6.36-rc6-git2: Reported regressions 2.6.34 -> 2.6.35
From: Luis R. Rodriguez @ 2010-10-04 18:17 UTC (permalink / raw)
To: Rafael J. Wysocki, linux-wireless, linux-bluetooth
Cc: Guy, Wey-Yi W, dtonator, florian, oliver
In-Reply-To: <OjxVjYbf_EJ.A.ReC.pTPqMB@chimera>
Here are the 802.11 and Bluetooth ones:
On Sun, Oct 3, 2010 at 2:36 PM, Rafael J. Wysocki <rjw@sisk.pl> wrote:
> Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=16691
> Subject : IPW5100: iwlagn broken with 2.6.34.x to 2.6.35.2 update
> Submitter : Can Celasun <dcelasun@gmail.com>
> Date : 2010-08-21 08:28 (44 days old)
This is awaiting some new uCode code drop by Intel.
> Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=16458
> Subject : Bluetooth disabled after resume
> Submitter : AttilaN <attila123456@gmail.com>
> Date : 2010-07-25 09:33 (71 days old)
No followup on this one.
> Regressions with patches
> ------------------------
>
> Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=16462
> Subject : unable to connect to hidden SSID AP on legal channel 13
> Submitter : Daniel J Blueman <daniel.blueman@gmail.com>
> Date : 2010-07-25 17:06 (71 days old)
> Handled-By : Johannes Berg <johannes.berg@intel.com>
> Patch : https://bugzilla.kernel.org/attachment.cgi?id=31862
Fixed by Johannes, this was an Intel specific issue. Reviewed the
possibility of this also affecting mac80211 but since we lift the
passive scan on a beacon for the AP this should not affect mac80211 in
the future.
Luis
^ permalink raw reply
* Re: [PATCH 1/2] Bluetooth: hci open callback for hci UART transport driver
From: Suraj Sumangala @ 2010-10-04 17:29 UTC (permalink / raw)
To: Suraj Sumangala; +Cc: linux-bluetooth@vger.kernel.org, Jothikumar Mothilal
In-Reply-To: <4CA44AF2.7050908@Atheros.com>
Hi,
On 9/30/2010 2:01 PM, Suraj Sumangala wrote:
> *ping*
>
> On 9/21/2010 7:03 PM, Suraj Sumangala wrote:
>> This patch provides option for hci transport driver protocol implementation
>> to have a callback for hci open.
>>
>> Signed-off-by: Suraj Sumangala<suraj@atheros.com>
>> ---
>> drivers/bluetooth/hci_ldisc.c | 5 ++++-
>> drivers/bluetooth/hci_uart.h | 1 +
>> 2 files changed, 5 insertions(+), 1 deletions(-)
>>
>
> Regards
> Suraj
Is there any comments on this patch?
Regards
Suraj
^ permalink raw reply
* Re: Pull request: git://git.infradead.org/users/cktakahasi/bluez.git for-upstream
From: Claudio Takahasi @ 2010-10-04 17:27 UTC (permalink / raw)
To: Claudio Takahasi, BlueZ development
In-Reply-To: <AANLkTin5RWCfX07xRUfVvkq+C47AOJXCCRpMVa-vqrRA@mail.gmail.com>
On Thu, Sep 30, 2010 at 6:51 PM, Claudio Takahasi
<claudio.takahasi@openbossa.org> wrote:
> On Thu, Sep 30, 2010 at 11:28 AM, Claudio Takahasi
> <claudio.takahasi@openbossa.org> wrote:
>> On Thu, Sep 30, 2010 at 4:39 AM, Johan Hedberg <johan.hedberg@gmail.com> wrote:
>>> Hi Claudio,
>>>
>>> On Wed, Sep 29, 2010, Claudio Takahasi wrote:
>>>> StartDiscovery() triggers all the process. The adapter type: BR/EDR
>>>> only/LE only or dual mode is hidden from the higher layers.
>>>> So, your suggestion it try to hide all discovery details inside the
>>>> hciops as much as possible?
>>>
>>> That was the idea yes, but I'm not 100% sure that it's the best
>>> approach. Another question is also how do we want to represent this with
>>> the new management interface. Should the kernel do it "all" through a
>>> single request from userspace or should userspace control the separate
>>> BR/EDR and LE discoveries. If it's the former, then having a single
>>> adapter_ops callback makes sense. If it's the later then we should
>>> probably have two separate ones. Either way I now realize that to
>>> implement this with a single callback we'd need to have the HCI event
>>> processing moved over to hciops and that's not something that will
>>> happen very quickly. So maybe it's better to have these as two separate
>>> adapter_ops callbacks for now.
>>>
>>> Johan
>>>
>>
>> Another point is: scanning needs to be disabled "actively", it is not
>> possible to inform a scanning length like inquiry, it is necessary to
>> create a timeout to disable the scanning. Joining inquiry and scanning
>> inside a single adapter_ops callback will be hard to control the
>> discovery procedure "states". So for now, I prefer two separate
>> callbacks due the scanning timeout and HCI events processing.
>>
>> However, for the new management interface, one single request seems to
>> be more appropriate but extra requests will be necessary to setup the
>> scan and inquiry parameters.
>>
>> Claudio
>>
>
> New pull request! Patches rebased and a new hciops callback function
> has been added to export the write LE host supported command.
>
> The following changes since commit 3a8386d428e385d97b95a890623362321a7e3a19:
>
> Fix left open socket warning for attribute server (2010-09-30 17:26:55 -0300)
>
> are available in the git repository at:
> git://git.infradead.org/users/cktakahasi/bluez.git for-upstream
>
> Claudio Takahasi (23):
> Add LE start and stop scanning
> Remove RSSI field from the advertising report event
> Decoding the RSSI parameter from the advertising report event
> Send Discovering property "FALSE" when the interleave finishes
> Add length argument on hciops start discovery function
> Stop inquiry using the length parameter
> Fix remote name resolution for interleave discovery
> Add Write LE host supported function
> Set the LE host supported and disable simultaneous LE and BR/EDR flags
> Add extended feature mask constants definition
> Read the local extended features
> Stop LE scanning when discovery is suspended
> Rename hciops {start, stop}_discovery to {start, stop}_inquiry
> Don't enter on interleave mode if there isn't active sessions
> Code cleanup: improving inquiry logic
> Clear the remote device found list in the state transition
> Fix periodic inquiry signals
> Fixing DeviceDisappeared signal
> Postpone discovery if still resolving names
> Add adapter discovery type function
> Do not send another Discovering TRUE signal if still resolving names
> Forcing periodic inquiry exit
> Fix interleave scanning
>
> Vinicius Costa Gomes (1):
> Add BR/EDR LE interleaved discovery
>
> lib/hci.c | 29 +++++
> lib/hci.h | 17 +++-
> lib/hci_lib.h | 1 +
> plugins/hciops.c | 69 +++++++++++-
> src/adapter.c | 301 +++++++++++++++++++++++++++++++++++++-----------------
> src/adapter.h | 38 ++++---
> src/dbus-hci.c | 45 +++++++--
> src/dbus-hci.h | 1 +
> src/security.c | 131 ++++++++++++++----------
> 9 files changed, 449 insertions(+), 183 deletions(-)
>
The following changes since commit 19c8e310329bb6b369f11501afec9ff4223c2971:
Allow errors to propagate from connection callback (2010-10-04 17:06:49 +0200)
are available in the git repository at:
git://git.infradead.org/users/cktakahasi/bluez.git for-upstream
Claudio Takahasi (23):
Add LE start and stop scanning
Remove RSSI field from the advertising report event
Decoding the RSSI parameter from the advertising report event
Send Discovering property "FALSE" when the interleave finishes
Add length argument on hciops start discovery function
Stop inquiry using the length parameter
Fix remote name resolution for interleave discovery
Add Write LE host supported function
Set the LE host supported and disable simultaneous LE and BR/EDR flags
Add extended feature mask constants definition
Read the local extended features
Stop LE scanning when discovery is suspended
Rename hciops {start, stop}_discovery to {start, stop}_inquiry
Don't enter on interleave mode if there isn't active sessions
Code cleanup: improving inquiry logic
Clear the remote device found list in the state transition
Fix periodic inquiry signals
Fixing DeviceDisappeared signal
Postpone discovery if still resolving names
Add adapter discovery type function
Do not send another Discovering TRUE signal if still resolving names
Forcing periodic inquiry exit
Fix interleave scanning
Vinicius Costa Gomes (1):
Add BR/EDR LE interleaved discovery
lib/hci.c | 29 +++++
lib/hci.h | 17 +++-
lib/hci_lib.h | 1 +
plugins/hciops.c | 69 +++++++++++-
src/adapter.c | 301 +++++++++++++++++++++++++++++++++++++-----------------
src/adapter.h | 38 ++++---
src/dbus-hci.c | 45 +++++++--
src/dbus-hci.h | 1 +
src/security.c | 131 ++++++++++++++----------
9 files changed, 449 insertions(+), 183 deletions(-)
^ permalink raw reply
* Re: How add support of LLMNR for PAN
From: Arun Kumar @ 2010-10-04 15:35 UTC (permalink / raw)
To: Chetankumar Manjegowda; +Cc: linux-bluetooth
In-Reply-To: <52A922E83075C847A59D7DF98C66017501871E@MTW02MBX03.mindtree.com>
Shouldn't this support come from linux ip stack rather than bluez?
Best Regards,
Arun Kumar Singh
www.crazydaks.com
On Mon, Oct 4, 2010 at 6:15 PM, Chetankumar Manjegowda
<Chetankumar_Manjegowda@mindtree.com> wrote:
>
> Hi All,
>
> I want to know how to enable/Integrate LLMNR for PAN profile.
>
> Can anyone give some suggestions or link where I can refer the same ??
>
> Rgds
> Chetan
>
> ________________________________
>
> http://www.mindtree.com/email/disclaimer.html
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
^ permalink raw reply
* Re: Pull request: git://gitorious.org/~lizardo/bluez/lizardo-bluez.git for-upstream
From: Johan Hedberg @ 2010-10-04 15:16 UTC (permalink / raw)
To: Anderson Lizardo; +Cc: linux-bluetooth
In-Reply-To: <AANLkTimfiie4L6CBm_oTiyFRmB92dt6bugvBREY6vuzN@mail.gmail.com>
Hi,
On Mon, Oct 04, 2010, Anderson Lizardo wrote:
> The following changes since commit bb061d925ad661836d5279b543a07d17683d9b6e:
> Marcel Holtmann (1):
> Update list of company identifiers
>
> are available in the git repository at:
>
> git://gitorious.org/~lizardo/bluez/lizardo-bluez.git for-upstream
>
> Anderson Lizardo (7):
> Remove unnecessary check for watcher path
> Rename global "handle" variable to "sdp_handle"
> Add test/test-attrib for testing Attribute API
> Add org.bluez.Watcher interface to default policy
> Fix and refactor characteristic value update code
> Add Write Characteristic Value support to attribute server
> Allow errors to propagate from connection callback
>
> Bruna Moreira (8):
> Add encoders/decoders for the Write command
> Implement Write command in GATT API
> Move connection common code to l2cap_connect()
> Write new value for characteristic value
> Use g_slist_foreach() instead of a for loop
> Make handle parameter mandatory in gatttool
> Add new option for char value write in gatttool
> Implement characteristic_write callback in gatttool
>
> attrib/att.c | 45 ++++++++++++++++
> attrib/att.h | 4 ++
> attrib/client.c | 145 ++++++++++++++++++++++++---------------------------
> attrib/gatt.c | 11 ++++
> attrib/gatt.h | 3 +
> attrib/gatttool.c | 120 ++++++++++++++++++++++++++++++++++++------
> src/attrib-server.c | 32 ++++++++++--
> src/bluetooth.conf | 1 +
> test/test-attrib | 120 ++++++++++++++++++++++++++++++++++++++++++
> 9 files changed, 381 insertions(+), 100 deletions(-)
> create mode 100755 test/test-attrib
Thanks, all patches have been pushed upstream.
Johan
^ permalink raw reply
* Inquiry_with_RSSI compatible dongles
From: Giedo Mak @ 2010-10-04 14:48 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <AANLkTinbYqYrFrJDCEm3U0Mto8fYJyQLDa8s0KB6T3qi@mail.gmail.com>
Hello,
I'm working on a bluetooth program with some sort of distance sensing/tracking.
To make this easier I came across a feature called inquiry_with_RSSI.
Could somebody tell me what kind of dongles support this feature. I
mean, does every 2.1 BT dongle support it, or can you only find out
once you get one in your hands?
Kind regards,
Giedo
^ permalink raw reply
* Pull request: git://gitorious.org/~lizardo/bluez/lizardo-bluez.git for-upstream
From: Anderson Lizardo @ 2010-10-04 14:11 UTC (permalink / raw)
To: linux-bluetooth
The following changes since commit bb061d925ad661836d5279b543a07d17683d9b6e:
Marcel Holtmann (1):
Update list of company identifiers
are available in the git repository at:
git://gitorious.org/~lizardo/bluez/lizardo-bluez.git for-upstream
Anderson Lizardo (7):
Remove unnecessary check for watcher path
Rename global "handle" variable to "sdp_handle"
Add test/test-attrib for testing Attribute API
Add org.bluez.Watcher interface to default policy
Fix and refactor characteristic value update code
Add Write Characteristic Value support to attribute server
Allow errors to propagate from connection callback
Bruna Moreira (8):
Add encoders/decoders for the Write command
Implement Write command in GATT API
Move connection common code to l2cap_connect()
Write new value for characteristic value
Use g_slist_foreach() instead of a for loop
Make handle parameter mandatory in gatttool
Add new option for char value write in gatttool
Implement characteristic_write callback in gatttool
attrib/att.c | 45 ++++++++++++++++
attrib/att.h | 4 ++
attrib/client.c | 145 ++++++++++++++++++++++++---------------------------
attrib/gatt.c | 11 ++++
attrib/gatt.h | 3 +
attrib/gatttool.c | 120 ++++++++++++++++++++++++++++++++++++------
src/attrib-server.c | 32 ++++++++++--
src/bluetooth.conf | 1 +
test/test-attrib | 120 ++++++++++++++++++++++++++++++++++++++++++
9 files changed, 381 insertions(+), 100 deletions(-)
create mode 100755 test/test-attrib
--
Anderson Lizardo
OpenBossa Labs - INdT
Manaus - Brazil
^ permalink raw reply
* How add support of LLMNR for PAN
From: Chetankumar Manjegowda @ 2010-10-04 12:45 UTC (permalink / raw)
To: linux-bluetooth@vger.kernel.org
In-Reply-To: <20101004123552.GC11737@pengutronix.de>
Hi All,
I want to know how to enable/Integrate LLMNR for PAN profile.
Can anyone give some suggestions or link where I can refer the same ??
Rgds
Chetan
________________________________
http://www.mindtree.com/email/disclaimer.html
^ permalink raw reply
* Re: >net-wireless/bluez-4.63 unable to connect audio streams due commit
From: Uwe Kleine-König @ 2010-10-04 12:35 UTC (permalink / raw)
To: Pacho Ramos; +Cc: Luiz Augusto von Dentz, Johan Hedberg, linux-bluetooth
In-Reply-To: <1286187946.7898.0.camel@localhost.localdomain>
Hello Pacho,
On Mon, Oct 04, 2010 at 12:25:46PM +0200, Pacho Ramos wrote:
> > I would say this was because of double authentication request, but it
> > seems it is not the case, actually ssp doesn't seems to be used at all
> > here so this must be something else, maybe you should try this:
> >
> > http://thread.gmane.org/gmane.linux.bluez.kernel/7256
> >
>
> Thanks but, how should I try to apply that patch? Looks like
> net/bluetooth/rfcomm/core.c is not present on bluez-4.72 sources
I guess this is a patch to apply to your kernel, not bluez.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
^ permalink raw reply
* Re: >net-wireless/bluez-4.63 unable to connect audio streams due commit
From: Pacho Ramos @ 2010-10-04 10:25 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: Johan Hedberg, linux-bluetooth
In-Reply-To: <AANLkTikFrvyeoXV0uLYcvD4GCj2s3ML2-q8f5GhXMxAK@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1916 bytes --]
El lun, 04-10-2010 a las 13:00 +0300, Luiz Augusto von Dentz escribió:
> Hi,
>
> On Sat, Oct 2, 2010 at 4:58 PM, Pacho Ramos
> <pacho@condmat1.ciencias.uniovi.es> wrote:
> > El lun, 20-09-2010 a las 21:49 +0300, Johan Hedberg escribió:
> >> Hi,
> >>
> >> On Mon, Sep 20, 2010, Pacho Ramos wrote:
> >> > Reporter found that the problem with his dongle was introduced in commit
> >> > aee26b30bbc24cde464ba1a557c2b258ddec6432 "Make BtIO default security
> >> > level MEDIUM", he asked here, on upstream mailing list, but didn't get
> >> > any reply clarifying this:
> >> > http://marc.info/?l=linux-bluetooth&m=127893935109510&w=2
> >>
> >> The important piece of info missing here is an HCI trace of the failure
> >> (i.e. output of hcidump). There was a similar issue reported on IRC a
> >> few days back and the hcidump there revealed a LMP response timeout
> >> after BlueZ issues a HCI_Set_Connection_Encryption command. This would
> >> seem to indicate a bug either in the local adapter or the remote device
> >> (headset). Only an airtrace would really reveal what's going on.
> >> However, I suspect it might be possible to work around this by looking
> >> into possibilities of changing the ordering and timing of when the
> >> kernel sends the encryption request.
> >>
> >> Johan
> >>
> >
> > Sorry for the delay but downstream reporter wasn't able to provide the
> > information sooner.
> >
> > Attached is hcidump output, I hope it helps :-)
>
> I would say this was because of double authentication request, but it
> seems it is not the case, actually ssp doesn't seems to be used at all
> here so this must be something else, maybe you should try this:
>
> http://thread.gmane.org/gmane.linux.bluez.kernel/7256
>
Thanks but, how should I try to apply that patch? Looks like
net/bluetooth/rfcomm/core.c is not present on bluez-4.72 sources
Best regards
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply
* Re: >net-wireless/bluez-4.63 unable to connect audio streams due commit
From: Luiz Augusto von Dentz @ 2010-10-04 10:00 UTC (permalink / raw)
To: pacho; +Cc: Johan Hedberg, linux-bluetooth
In-Reply-To: <1286027890.12944.1.camel@localhost.localdomain>
Hi,
On Sat, Oct 2, 2010 at 4:58 PM, Pacho Ramos
<pacho@condmat1.ciencias.uniovi.es> wrote:
> El lun, 20-09-2010 a las 21:49 +0300, Johan Hedberg escribió:
>> Hi,
>>
>> On Mon, Sep 20, 2010, Pacho Ramos wrote:
>> > Reporter found that the problem with his dongle was introduced in commit
>> > aee26b30bbc24cde464ba1a557c2b258ddec6432 "Make BtIO default security
>> > level MEDIUM", he asked here, on upstream mailing list, but didn't get
>> > any reply clarifying this:
>> > http://marc.info/?l=linux-bluetooth&m=127893935109510&w=2
>>
>> The important piece of info missing here is an HCI trace of the failure
>> (i.e. output of hcidump). There was a similar issue reported on IRC a
>> few days back and the hcidump there revealed a LMP response timeout
>> after BlueZ issues a HCI_Set_Connection_Encryption command. This would
>> seem to indicate a bug either in the local adapter or the remote device
>> (headset). Only an airtrace would really reveal what's going on.
>> However, I suspect it might be possible to work around this by looking
>> into possibilities of changing the ordering and timing of when the
>> kernel sends the encryption request.
>>
>> Johan
>>
>
> Sorry for the delay but downstream reporter wasn't able to provide the
> information sooner.
>
> Attached is hcidump output, I hope it helps :-)
I would say this was because of double authentication request, but it
seems it is not the case, actually ssp doesn't seems to be used at all
here so this must be something else, maybe you should try this:
http://thread.gmane.org/gmane.linux.bluez.kernel/7256
--
Luiz Augusto von Dentz
Computer Engineer
^ permalink raw reply
* [PATCH] Bluetooth: Add support to specify patch download location
From: Suraj Sumangala @ 2010-10-04 7:06 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Jothikumar.Mothilal, Suraj Sumangala
This patch add support for specifying patch download address for
AR300x patch download logic.
---
tools/hciattach_ath3k.c | 52 +++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 50 insertions(+), 2 deletions(-)
diff --git a/tools/hciattach_ath3k.c b/tools/hciattach_ath3k.c
index 5589254..e27cc4b 100644
--- a/tools/hciattach_ath3k.c
+++ b/tools/hciattach_ath3k.c
@@ -461,20 +461,68 @@ struct patch_entry {
uint8_t data[MAX_PATCH_CMD];
};
+#define SET_PATCH_RAM_ID 0x0D
+#define SET_PATCH_RAM_CMD_SIZE 11
+#define ADDRESS_LEN 4
+static int set_patch_ram(int dev, char *patch_loc, int len)
+{
+ int err;
+ uint8_t cmd[20];
+ int i, j;
+ char loc_byte[3];
+ uint8_t *event;
+ uint8_t *loc_ptr = (uint8_t *)&cmd[7];
+
+ if (!patch_loc)
+ return -1;
+
+ loc_byte[2] = '\0';
+
+ load_hci_ps_hdr(cmd, SET_PATCH_RAM_ID, ADDRESS_LEN, 0);
+
+ for (i = 0, j = 3; i < 4; i++, j--) {
+ loc_byte[0] = patch_loc[0];
+ loc_byte[1] = patch_loc[1];
+ loc_ptr[j] = strtol(loc_byte, NULL, 16);
+ patch_loc += 2;
+ }
+
+ err = send_hci_cmd_sync(dev, cmd, SET_PATCH_RAM_CMD_SIZE, &event);
+ if (err < 0)
+ return err;
+
+ err = read_ps_event(event, HCI_PS_CMD_OCF);
+
+ if (event)
+ free(event);
+
+ return err;
+}
+
+#define PATCH_LOC_KEY "DA:"
+#define PATCH_LOC_STRING_LEN 8
static int ps_patch_download(int fd, FILE *stream)
{
char byte[3];
char ptr[MAX_PATCH_CMD + 1];
int byte_cnt;
int patch_count = 0;
+ char patch_loc[PATCH_LOC_STRING_LEN + 1];
byte[2] = '\0';
while (fgets(ptr, MAX_PATCH_CMD, stream)) {
- if (strlen(ptr) <= 1 || !isxdigit(ptr[0]))
+ if (strlen(ptr) <= 1)
continue;
- else
+ else if (strstr(ptr, PATCH_LOC_KEY) == ptr) {
+ strncpy(patch_loc, &ptr[sizeof(PATCH_LOC_KEY) - 1],
+ PATCH_LOC_STRING_LEN);
+ if (set_patch_ram(fd, patch_loc, sizeof(patch_loc)) < 0)
+ return -1;
+ } else if (isxdigit(ptr[0]))
break;
+ else
+ return -1;
}
byte_cnt = strtol(ptr, NULL, 16);
--
1.7.0.4
^ permalink raw reply related
* can not connect to Headset after pairing, please suggest
From: Yedire, Sandeep @ 2010-10-04 4:32 UTC (permalink / raw)
To: linux-bluetooth
Hello All,
I have been trying to connect to Bluetooth headset from the target.
I am able to see the connection status from pairing mode to paired
mode when I do ./agent 0000 <bdaddr>. Here Red-Blue blink will respond
to the agent(executable) and change to blue-blue blink.
Later Thru a2play or avtest, l2test (part of btsco, bluez) I get
connection refused-146. I tried hcidump running in back ground and
found connection refused -Security Block. Also the headset enters into
a mode where it does not take any pass-key.
I do find that pairing was successful but why do I get this error
message. Am I missing any step in between? Is there any place where
some pairing information is stored some where so that this remains in
connected state and do not ask for pass -key again.
Can some one take time to suggest me how pairing is to be done with
headset detailing in each step so that I don't miss any ?
Regards,
Sandeep.Yedire
----------------------------------------------------------
T.Jefferson, 'Victory and defeat are each of the same price"
^ permalink raw reply
* Re: [PATCH] Added firmware load patch to crap directory.
From: Julian Calaby @ 2010-10-03 22:13 UTC (permalink / raw)
To: Bala Shanmugam; +Cc: linux-wireless, marcel, linux-bluetooth, linux-kernel
In-Reply-To: <1286118002-2354-1-git-send-email-sbalashanmugam@atheros.com>
On Mon, Oct 4, 2010 at 02:00, Bala Shanmugam <sbalashanmugam@atheros.com> wrote:
> +Reason for not yet publishing: Marcel feels that Atheros sflash based BT device
> +doesn't follow bluetooth H:2 specification and HCI commands should be supported
> +in firmware if it is detected as bluetooth device. Using HCI command, firmware
> +should be loaded.
> +
> +In sflash based device there is not enough memory to support HCI commands in firmware.
> +So load firmware from btusb when the device comes up.
Stupid question: What's to stop you from producing a driver that
connects to this device when unflashed, loads the firmware, then hands
it over to the proper HCI bluetooth driver? (other than it being an
ugly hack)
You could post such a driver to Linux-usb and "solve" the problem in a
way that (should) make everyone happy.
Thanks,
--
Julian Calaby
Email: julian.calaby@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/
.Plan: http://sites.google.com/site/juliancalaby/
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox