@ -0,0 +1,54 @@ |
|||||
|
# --- SDE-COPYRIGHT-NOTE-BEGIN --- |
||||
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch. |
||||
|
# |
||||
|
# Filename: package/.../bluez-hcidump/0001-Fix-time-intervals-dumping-of-LE-commands.patch |
||||
|
# Copyright (C) 2011 The OpenSDE Project |
||||
|
# |
||||
|
# More information can be found in the files COPYING and README. |
||||
|
# |
||||
|
# This patch file is dual-licensed. It is available under the license the |
||||
|
# patched project is licensed under, as long as it is an OpenSource license |
||||
|
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms |
||||
|
# of the GNU General Public License as published by the Free Software |
||||
|
# Foundation; either version 2 of the License, or (at your option) any later |
||||
|
# version. |
||||
|
# --- SDE-COPYRIGHT-NOTE-END --- |
||||
|
|
||||
|
From 4299bde37959993cdc81a6e55a2969c8542391e1 Mon Sep 17 00:00:00 2001 |
||||
|
From: =?UTF-8?q?Andr=C3=A9=20Dieb=20Martins?= <andre.dieb@signove.com> |
||||
|
Date: Mon, 24 Jan 2011 16:32:38 -0300 |
||||
|
Subject: [PATCH 1/6] Fix time intervals dumping of LE commands. |
||||
|
|
||||
|
Add missing btohs() convertions and spec. constants for converting time |
||||
|
intervals for LE Set Scan Parameters and LE Set Advertising Parameters. |
||||
|
---
|
||||
|
parser/hci.c | 6 ++++-- |
||||
|
1 files changed, 4 insertions(+), 2 deletions(-) |
||||
|
|
||||
|
diff --git a/parser/hci.c b/parser/hci.c
|
||||
|
index f9f01c9..8299403 100644
|
||||
|
--- a/parser/hci.c
|
||||
|
+++ b/parser/hci.c
|
||||
|
@@ -1582,7 +1582,8 @@ static inline void le_set_advertising_parameters_dump(int level, struct frame *f
|
||||
|
le_set_advertising_parameters_cp *cp = frm->ptr; |
||||
|
|
||||
|
p_indent(level, frm); |
||||
|
- printf("min 0x%04xms max 0x%04xms\n", cp->min_interval, cp->max_interval);
|
||||
|
+ printf("min %.3fms, max %.3fms\n", btohs(cp->min_interval) * 0.625,
|
||||
|
+ btohs(cp->max_interval) * 0.625);
|
||||
|
|
||||
|
p_indent(level, frm); |
||||
|
printf("type 0x%02x (%s) ownbdaddr 0x%02x (%s)\n", cp->advtype, |
||||
|
@@ -1608,7 +1609,8 @@ static inline void le_set_scan_parameters_dump(int level, struct frame *frm)
|
||||
|
cp->type == 0x00 ? "passive" : "active"); |
||||
|
|
||||
|
p_indent(level, frm); |
||||
|
- printf("interval %04xms window %04xms\n", cp->interval, cp->window);
|
||||
|
+ printf("interval %.3fms window %.3fms\n", btohs(cp->interval) * 0.625,
|
||||
|
+ btohs(cp->window) * 0.625);
|
||||
|
|
||||
|
p_indent(level, frm); |
||||
|
printf("own address: 0x%02x (%s) policy: %s\n", cp->own_bdaddr_type, |
||||
|
--
|
||||
|
1.7.2.3 |
||||
|
|
@ -0,0 +1,50 @@ |
|||||
|
# --- SDE-COPYRIGHT-NOTE-BEGIN --- |
||||
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch. |
||||
|
# |
||||
|
# Filename: package/.../bluez-hcidump/0002-Add-missing-const-to-utility-functions.patch |
||||
|
# Copyright (C) 2011 The OpenSDE Project |
||||
|
# |
||||
|
# More information can be found in the files COPYING and README. |
||||
|
# |
||||
|
# This patch file is dual-licensed. It is available under the license the |
||||
|
# patched project is licensed under, as long as it is an OpenSource license |
||||
|
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms |
||||
|
# of the GNU General Public License as published by the Free Software |
||||
|
# Foundation; either version 2 of the License, or (at your option) any later |
||||
|
# version. |
||||
|
# --- SDE-COPYRIGHT-NOTE-END --- |
||||
|
|
||||
|
From 54e0c6f46b2a13a66083a98831d515395fb43757 Mon Sep 17 00:00:00 2001 |
||||
|
From: =?UTF-8?q?Andr=C3=A9=20Dieb=20Martins?= <andre.dieb@signove.com> |
||||
|
Date: Mon, 31 Jan 2011 16:09:32 -0300 |
||||
|
Subject: [PATCH 2/6] Add missing const to utility functions |
||||
|
|
||||
|
---
|
||||
|
parser/hci.c | 4 ++-- |
||||
|
1 files changed, 2 insertions(+), 2 deletions(-) |
||||
|
|
||||
|
diff --git a/parser/hci.c b/parser/hci.c
|
||||
|
index 8299403..fbbebde 100644
|
||||
|
--- a/parser/hci.c
|
||||
|
+++ b/parser/hci.c
|
||||
|
@@ -704,7 +704,7 @@ static char *authentication2str(uint8_t authentication)
|
||||
|
} |
||||
|
} |
||||
|
|
||||
|
-static char *eventmask2str(uint8_t mask[8])
|
||||
|
+static char *eventmask2str(const uint8_t mask[8])
|
||||
|
{ |
||||
|
int i; |
||||
|
|
||||
|
@@ -733,7 +733,7 @@ static char *eventmask2str(uint8_t mask[8])
|
||||
|
} |
||||
|
} |
||||
|
|
||||
|
-static char *lefeatures2str(uint8_t features[8])
|
||||
|
+static char *lefeatures2str(const uint8_t features[8])
|
||||
|
{ |
||||
|
if (features[0] & 0x01) |
||||
|
return "Link Layer supports LE Encryption"; |
||||
|
--
|
||||
|
1.7.2.3 |
||||
|
|
@ -0,0 +1,49 @@ |
|||||
|
# --- SDE-COPYRIGHT-NOTE-BEGIN --- |
||||
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch. |
||||
|
# |
||||
|
# Filename: package/.../bluez-hcidump/0003-Add-check-for-ACL_START_NO_FLUSH.patch |
||||
|
# Copyright (C) 2011 The OpenSDE Project |
||||
|
# |
||||
|
# More information can be found in the files COPYING and README. |
||||
|
# |
||||
|
# This patch file is dual-licensed. It is available under the license the |
||||
|
# patched project is licensed under, as long as it is an OpenSource license |
||||
|
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms |
||||
|
# of the GNU General Public License as published by the Free Software |
||||
|
# Foundation; either version 2 of the License, or (at your option) any later |
||||
|
# version. |
||||
|
# --- SDE-COPYRIGHT-NOTE-END --- |
||||
|
|
||||
|
From 3b1e22fbe09ec0e3cbdbf535b652148a19369c1c Mon Sep 17 00:00:00 2001 |
||||
|
From: Daniel Orstadius <daniel.orstadius@nokia.com> |
||||
|
Date: Thu, 10 Feb 2011 12:34:01 +0200 |
||||
|
Subject: [PATCH 3/6] Add check for ACL_START_NO_FLUSH |
||||
|
|
||||
|
In addition to ACL_START, hcidump should check for the flag |
||||
|
ACL_START_NO_FLUSH to indicate the start of a frame. |
||||
|
|
||||
|
Using '==' instead of '&' for the comparison since |
||||
|
ACL_START_NO_FLUSH is defined to zero. |
||||
|
|
||||
|
The flag was introduced in BlueZ commit |
||||
|
2430512c983cad8c20252f1df8f297399993ca3d |
||||
|
---
|
||||
|
parser/l2cap.c | 2 +- |
||||
|
1 files changed, 1 insertions(+), 1 deletions(-) |
||||
|
|
||||
|
diff --git a/parser/l2cap.c b/parser/l2cap.c
|
||||
|
index 5c5371f..673aed6 100644
|
||||
|
--- a/parser/l2cap.c
|
||||
|
+++ b/parser/l2cap.c
|
||||
|
@@ -934,7 +934,7 @@ void l2cap_dump(int level, struct frame *frm)
|
||||
|
l2cap_hdr *hdr; |
||||
|
uint16_t dlen; |
||||
|
|
||||
|
- if (frm->flags & ACL_START) {
|
||||
|
+ if ((frm->flags & ACL_START) || frm->flags == ACL_START_NO_FLUSH) {
|
||||
|
hdr = frm->ptr; |
||||
|
dlen = btohs(hdr->len); |
||||
|
|
||||
|
--
|
||||
|
1.7.2.3 |
||||
|
|
@ -0,0 +1,231 @@ |
|||||
|
# --- SDE-COPYRIGHT-NOTE-BEGIN --- |
||||
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch. |
||||
|
# |
||||
|
# Filename: package/.../bluez-hcidump/0004-Fix-HCI-LE-advertising-report-dump.patch |
||||
|
# Copyright (C) 2011 The OpenSDE Project |
||||
|
# |
||||
|
# More information can be found in the files COPYING and README. |
||||
|
# |
||||
|
# This patch file is dual-licensed. It is available under the license the |
||||
|
# patched project is licensed under, as long as it is an OpenSource license |
||||
|
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms |
||||
|
# of the GNU General Public License as published by the Free Software |
||||
|
# Foundation; either version 2 of the License, or (at your option) any later |
||||
|
# version. |
||||
|
# --- SDE-COPYRIGHT-NOTE-END --- |
||||
|
|
||||
|
From 70fb86e548eef4d54bb659c76a47c0891ba5f99a Mon Sep 17 00:00:00 2001 |
||||
|
From: Andre Dieb Martins <andre.dieb@signove.com> |
||||
|
Date: Mon, 28 Feb 2011 00:58:22 -0300 |
||||
|
Subject: [PATCH 4/6] Fix HCI LE advertising report dump |
||||
|
|
||||
|
LE advertising report event has only one data block for each report. |
||||
|
Thus, we can't reuse ext_inquiry_response_dump(), which loops over |
||||
|
successive data blocks until reaches a zero-length one. |
||||
|
|
||||
|
This commit introduces ext_inquiry_data_dump(), which dumps a frame |
||||
|
containing data formatted according to [Vol 3] Part C, Section 8. This |
||||
|
function is reused by ext_inquiry_response_dump(). |
||||
|
|
||||
|
Also adds RSSI parsing to each advertising report. |
||||
|
---
|
||||
|
parser/hci.c | 146 +++++++++++++++++++++++++++++++++------------------------ |
||||
|
1 files changed, 84 insertions(+), 62 deletions(-) |
||||
|
|
||||
|
diff --git a/parser/hci.c b/parser/hci.c
|
||||
|
index fbbebde..4d9a315 100644
|
||||
|
--- a/parser/hci.c
|
||||
|
+++ b/parser/hci.c
|
||||
|
@@ -757,67 +757,83 @@ static char *filterpolicy2str(uint8_t policy)
|
||||
|
} |
||||
|
} |
||||
|
|
||||
|
-static inline void ext_inquiry_response_dump(int level, struct frame *frm)
|
||||
|
+static inline void ext_inquiry_data_dump(int level, struct frame *frm,
|
||||
|
+ uint8_t *data)
|
||||
|
{ |
||||
|
- void *ptr = frm->ptr;
|
||||
|
- uint32_t len = frm->len;
|
||||
|
- uint8_t type, length;
|
||||
|
+ uint8_t len = data[0];
|
||||
|
+ uint8_t type;
|
||||
|
char *str; |
||||
|
int i; |
||||
|
|
||||
|
- length = get_u8(frm);
|
||||
|
+ if (len == 0)
|
||||
|
+ return;
|
||||
|
|
||||
|
- while (length > 0) {
|
||||
|
- type = get_u8(frm);
|
||||
|
- length--;
|
||||
|
+ type = data[1];
|
||||
|
+ data += 2;
|
||||
|
+ len -= 1;
|
||||
|
|
||||
|
- switch (type) {
|
||||
|
- case 0x01:
|
||||
|
- p_indent(level, frm);
|
||||
|
- printf("Flags:");
|
||||
|
- for (i = 0; i < length; i++)
|
||||
|
- printf(" 0x%2.2x", *((uint8_t *) (frm->ptr + i)));
|
||||
|
- printf("\n");
|
||||
|
- break;
|
||||
|
+ switch (type) {
|
||||
|
+ case 0x01:
|
||||
|
+ p_indent(level, frm);
|
||||
|
+ printf("Flags:");
|
||||
|
+ for (i = 0; i < len; i++)
|
||||
|
+ printf(" 0x%2.2x", data[i]);
|
||||
|
+ printf("\n");
|
||||
|
+ break;
|
||||
|
|
||||
|
- case 0x02:
|
||||
|
- case 0x03:
|
||||
|
- p_indent(level, frm);
|
||||
|
- printf("%s service classes:",
|
||||
|
- type == 0x02 ? "Shortened" : "Complete");
|
||||
|
- for (i = 0; i < length / 2; i++) {
|
||||
|
- uint16_t val = btohs(bt_get_unaligned((uint16_t *) (frm->ptr + (i * 2))));
|
||||
|
- printf(" 0x%4.4x", val);
|
||||
|
- }
|
||||
|
- printf("\n");
|
||||
|
- break;
|
||||
|
+ case 0x02:
|
||||
|
+ case 0x03:
|
||||
|
+ p_indent(level, frm);
|
||||
|
+ printf("%s service classes:",
|
||||
|
+ type == 0x02 ? "Shortened" : "Complete");
|
||||
|
|
||||
|
- case 0x08:
|
||||
|
- case 0x09:
|
||||
|
- str = malloc(length + 1);
|
||||
|
- if (str) {
|
||||
|
- snprintf(str, length + 1, "%s", (char *) frm->ptr);
|
||||
|
- for (i = 0; i < length; i++)
|
||||
|
- if (!isprint(str[i]))
|
||||
|
- str[i] = '.';
|
||||
|
- p_indent(level, frm);
|
||||
|
- printf("%s local name: \'%s\'\n",
|
||||
|
- type == 0x08 ? "Shortened" : "Complete", str);
|
||||
|
- free(str);
|
||||
|
- }
|
||||
|
- break;
|
||||
|
+ for (i = 0; i < len / 2; i++) {
|
||||
|
+ uint16_t val;
|
||||
|
|
||||
|
- case 0x0a:
|
||||
|
- p_indent(level, frm);
|
||||
|
- printf("TX power level: %d\n", *((uint8_t *) frm->ptr));
|
||||
|
- break;
|
||||
|
+ val = btohs(bt_get_unaligned(((uint16_t *) (data + i * 2))));
|
||||
|
+ printf(" 0x%4.4x", val);
|
||||
|
+ }
|
||||
|
+ printf("\n");
|
||||
|
+ break;
|
||||
|
|
||||
|
- default:
|
||||
|
+ case 0x08:
|
||||
|
+ case 0x09:
|
||||
|
+ str = malloc(len + 1);
|
||||
|
+ if (str) {
|
||||
|
+ snprintf(str, len + 1, "%s", (char *) data);
|
||||
|
+ for (i = 0; i < len; i++)
|
||||
|
+ if (!isprint(str[i]))
|
||||
|
+ str[i] = '.';
|
||||
|
p_indent(level, frm); |
||||
|
- printf("Unknown type 0x%02x with %d bytes data\n",
|
||||
|
- type, length);
|
||||
|
- break;
|
||||
|
+ printf("%s local name: \'%s\'\n",
|
||||
|
+ type == 0x08 ? "Shortened" : "Complete", str);
|
||||
|
+ free(str);
|
||||
|
} |
||||
|
+ break;
|
||||
|
+
|
||||
|
+ case 0x0a:
|
||||
|
+ p_indent(level, frm);
|
||||
|
+ printf("TX power level: %d\n", *((uint8_t *) data));
|
||||
|
+ break;
|
||||
|
+
|
||||
|
+ default:
|
||||
|
+ p_indent(level, frm);
|
||||
|
+ printf("Unknown type 0x%02x with %d bytes data\n",
|
||||
|
+ type, len);
|
||||
|
+ break;
|
||||
|
+ }
|
||||
|
+}
|
||||
|
+
|
||||
|
+static inline void ext_inquiry_response_dump(int level, struct frame *frm)
|
||||
|
+{
|
||||
|
+ void *ptr = frm->ptr;
|
||||
|
+ uint32_t len = frm->len;
|
||||
|
+ uint8_t length;
|
||||
|
+
|
||||
|
+ length = get_u8(frm);
|
||||
|
+
|
||||
|
+ while (length > 0) {
|
||||
|
+ ext_inquiry_data_dump(level, frm, frm->ptr);
|
||||
|
|
||||
|
frm->ptr += length; |
||||
|
frm->len -= length; |
||||
|
@@ -825,8 +841,10 @@ static inline void ext_inquiry_response_dump(int level, struct frame *frm)
|
||||
|
length = get_u8(frm); |
||||
|
} |
||||
|
|
||||
|
- frm->ptr = ptr + (EXTENDED_INQUIRY_INFO_SIZE - INQUIRY_INFO_WITH_RSSI_SIZE);
|
||||
|
- frm->len = len + (EXTENDED_INQUIRY_INFO_SIZE - INQUIRY_INFO_WITH_RSSI_SIZE);
|
||||
|
+ frm->ptr = ptr +
|
||||
|
+ (EXTENDED_INQUIRY_INFO_SIZE - INQUIRY_INFO_WITH_RSSI_SIZE);
|
||||
|
+ frm->len = len +
|
||||
|
+ (EXTENDED_INQUIRY_INFO_SIZE - INQUIRY_INFO_WITH_RSSI_SIZE);
|
||||
|
} |
||||
|
|
||||
|
static inline void bdaddr_command_dump(int level, struct frame *frm) |
||||
|
@@ -3504,14 +3522,12 @@ static inline void evt_le_conn_complete_dump(int level, struct frame *frm)
|
||||
|
|
||||
|
static inline void evt_le_advertising_report_dump(int level, struct frame *frm) |
||||
|
{ |
||||
|
- uint8_t num = get_u8(frm);
|
||||
|
- char addr[18];
|
||||
|
- int i;
|
||||
|
+ uint8_t num_reports = get_u8(frm);
|
||||
|
+ const uint8_t RSSI_SIZE = 1;
|
||||
|
|
||||
|
- for (i = 0; i < num; i++) {
|
||||
|
+ while (num_reports--) {
|
||||
|
+ char addr[18];
|
||||
|
le_advertising_info *info = frm->ptr; |
||||
|
- void *ptr = frm->ptr;
|
||||
|
- uint32_t len = frm->len;
|
||||
|
|
||||
|
p_ba2str(&info->bdaddr, addr); |
||||
|
|
||||
|
@@ -3522,13 +3538,19 @@ static inline void evt_le_advertising_report_dump(int level, struct frame *frm)
|
||||
|
printf("bdaddr %s (%s)\n", addr, |
||||
|
bdaddrtype2str(info->bdaddr_type)); |
||||
|
|
||||
|
- frm->ptr += LE_ADVERTISING_INFO_SIZE;
|
||||
|
- frm->len -= LE_ADVERTISING_INFO_SIZE;
|
||||
|
+ if (info->length > 0) {
|
||||
|
+ ext_inquiry_data_dump(level, frm,
|
||||
|
+ ((uint8_t *) &info->length) + 1);
|
||||
|
+ }
|
||||
|
|
||||
|
- ext_inquiry_response_dump(level, frm);
|
||||
|
+ frm->ptr += LE_ADVERTISING_INFO_SIZE + info->length;
|
||||
|
+ frm->len -= LE_ADVERTISING_INFO_SIZE + info->length;
|
||||
|
+
|
||||
|
+ p_indent(level, frm);
|
||||
|
+ printf("RSSI: %d\n", ((int8_t *) frm->ptr)[frm->len - 1]);
|
||||
|
|
||||
|
- frm->ptr = ptr + 1;
|
||||
|
- frm->len = len - 1;
|
||||
|
+ frm->ptr += RSSI_SIZE;
|
||||
|
+ frm->len -= RSSI_SIZE;
|
||||
|
} |
||||
|
} |
||||
|
|
||||
|
--
|
||||
|
1.7.2.3 |
||||
|
|
@ -0,0 +1,57 @@ |
|||||
|
# --- SDE-COPYRIGHT-NOTE-BEGIN --- |
||||
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch. |
||||
|
# |
||||
|
# Filename: package/.../bluez-hcidump/0005-Fix-compilation-against-latest-BlueZ.patch |
||||
|
# Copyright (C) 2011 The OpenSDE Project |
||||
|
# |
||||
|
# More information can be found in the files COPYING and README. |
||||
|
# |
||||
|
# This patch file is dual-licensed. It is available under the license the |
||||
|
# patched project is licensed under, as long as it is an OpenSource license |
||||
|
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms |
||||
|
# of the GNU General Public License as published by the Free Software |
||||
|
# Foundation; either version 2 of the License, or (at your option) any later |
||||
|
# version. |
||||
|
# --- SDE-COPYRIGHT-NOTE-END --- |
||||
|
|
||||
|
From 79a379cf1d576f7dd02c3c9cc25d418d856bf9ad Mon Sep 17 00:00:00 2001 |
||||
|
From: Anderson Lizardo <anderson.lizardo@openbossa.org> |
||||
|
Date: Fri, 18 Mar 2011 15:10:19 -0400 |
||||
|
Subject: [PATCH 5/6] Fix compilation against latest BlueZ |
||||
|
|
||||
|
BlueZ now has ntoh64()/hton64() functions in bluetooth.h, therefore the |
||||
|
hcidump local copy is not necessary. |
||||
|
---
|
||||
|
src/hcidump.c | 16 ---------------- |
||||
|
1 files changed, 0 insertions(+), 16 deletions(-) |
||||
|
|
||||
|
diff --git a/src/hcidump.c b/src/hcidump.c
|
||||
|
index b344489..2f406db 100644
|
||||
|
--- a/src/hcidump.c
|
||||
|
+++ b/src/hcidump.c
|
||||
|
@@ -50,22 +50,6 @@
|
||||
|
#include "parser/parser.h" |
||||
|
#include "parser/sdp.h" |
||||
|
|
||||
|
-#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
|
-static inline uint64_t ntoh64(uint64_t n)
|
||||
|
-{
|
||||
|
- uint64_t h;
|
||||
|
- uint64_t tmp = ntohl(n & 0x00000000ffffffff);
|
||||
|
- h = ntohl(n >> 32);
|
||||
|
- h |= tmp << 32;
|
||||
|
- return h;
|
||||
|
-}
|
||||
|
-#elif __BYTE_ORDER == __BIG_ENDIAN
|
||||
|
-#define ntoh64(x) (x)
|
||||
|
-#else
|
||||
|
-#error "Unknown byte order"
|
||||
|
-#endif
|
||||
|
-#define hton64(x) ntoh64(x)
|
||||
|
-
|
||||
|
#define SNAP_LEN HCI_MAX_FRAME_SIZE |
||||
|
#define DEFAULT_PORT "10839"; |
||||
|
|
||||
|
--
|
||||
|
1.7.2.3 |
||||
|
|
@ -0,0 +1,48 @@ |
|||||
|
# --- SDE-COPYRIGHT-NOTE-BEGIN --- |
||||
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch. |
||||
|
# |
||||
|
# Filename: package/.../bluez-hcidump/0006-hcidump-use-correct-size-to-copy-direction-value.patch |
||||
|
# Copyright (C) 2011 The OpenSDE Project |
||||
|
# |
||||
|
# More information can be found in the files COPYING and README. |
||||
|
# |
||||
|
# This patch file is dual-licensed. It is available under the license the |
||||
|
# patched project is licensed under, as long as it is an OpenSource license |
||||
|
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms |
||||
|
# of the GNU General Public License as published by the Free Software |
||||
|
# Foundation; either version 2 of the License, or (at your option) any later |
||||
|
# version. |
||||
|
# --- SDE-COPYRIGHT-NOTE-END --- |
||||
|
|
||||
|
From 4c52001490ef09a95d4521967e89a8ce2801fd30 Mon Sep 17 00:00:00 2001 |
||||
|
From: Iain Hibbert <plunky@rya-online.net> |
||||
|
Date: Thu, 14 Apr 2011 10:08:36 +0100 |
||||
|
Subject: [PATCH 6/6] hcidump: use correct size to copy 'direction' value |
||||
|
|
||||
|
frm.in is stored as an uint8_t, so we cannot copy an int there |
||||
|
directly. use an intermediate variable so that it also works |
||||
|
on big-endian systems. |
||||
|
---
|
||||
|
src/hcidump.c | 4 +++- |
||||
|
1 files changed, 3 insertions(+), 1 deletions(-) |
||||
|
|
||||
|
diff --git a/src/hcidump.c b/src/hcidump.c
|
||||
|
index 2f406db..a966ab2 100644
|
||||
|
--- a/src/hcidump.c
|
||||
|
+++ b/src/hcidump.c
|
||||
|
@@ -281,9 +281,11 @@ static int process_frames(int dev, int sock, int fd, unsigned long flags)
|
||||
|
|
||||
|
cmsg = CMSG_FIRSTHDR(&msg); |
||||
|
while (cmsg) { |
||||
|
+ int dir;
|
||||
|
switch (cmsg->cmsg_type) { |
||||
|
case HCI_CMSG_DIR: |
||||
|
- memcpy(&frm.in, CMSG_DATA(cmsg), sizeof(int));
|
||||
|
+ memcpy(&dir, CMSG_DATA(cmsg), sizeof(int));
|
||||
|
+ frm.in = (uint8_t) dir;
|
||||
|
break; |
||||
|
case HCI_CMSG_TSTAMP: |
||||
|
memcpy(&frm.ts, CMSG_DATA(cmsg), |
||||
|
--
|
||||
|
1.7.2.3 |
||||
|
|