hicattach: fix return length after reading the patch file |
|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- Subject: hicattach: fix return length after reading the patch file
- From: Tedd Ho-Jeong An <tedd.an@xxxxxxxxx>
- Date: Mon, 02 Jul 2012 09:52:17 -0700
- Cc: "tedd.an" <tedd.an@xxxxxxxxx>
- Organization: Intel Corporation
- User-agent: KMail/4.8.3 (Linux/3.2.0-26-generic-pae; KDE/4.8.3; i686; ; )
From: Tedd Ho-Jeong AN <tedd.an@xxxxxxxxx>
This patch fixes the issue that returns alwasy 0 after reading the patch line.
---
tools/hciattach_intel.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/tools/hciattach_intel.c b/tools/hciattach_intel.c
index 9129993..749098e 100644
--- a/tools/hciattach_intel.c
+++ b/tools/hciattach_intel.c
@@ -148,14 +148,13 @@ static int validate_events(struct patch_entry *event,
*/
static int get_next_patch_entry(int fd, struct patch_entry *entry)
{
- int len, size;
+ int size;
char rb;
if (read(fd, &rb, 1) <= 0)
return 0;
entry->type = rb;
- len = 0;
switch (entry->type) {
case PATCH_TYPE_CMD:
@@ -176,7 +175,7 @@ static int get_next_patch_entry(int fd, struct patch_entry *entry)
case PATCH_TYPE_EVT:
entry->data[0] = HCI_EVENT_PKT;
- if (read(fd, &entry->data[len], 2) < 0)
+ if (read(fd, &entry->data[1], 2) < 0)
return -1;
size = (int)entry->data[2];
@@ -193,7 +192,7 @@ static int get_next_patch_entry(int fd, struct patch_entry *entry)
return -1;
}
- return len;
+ return entry->len;
}
/**
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
[Bluez Devel]
[Linux USB Devel]
[Linux Media Drivers]
[Linux Audio Users]
[Yosemite News]
[Yosemite Photos]
[Free Online Dating]
[Bluez Devel]
[Linux Kernel]
[Linux SCSI]
[XFree86]
[Big List of Linux Books]