[PATCH 02/10] add flow control escape characters

From: Mark P . Mendelsohn
Date: Thu Aug 11 2011 - 13:55:02 EST


---
drivers/bluetooth/hci_h5.c | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c
index e2a1f69..a2a97cc 100644
--- a/drivers/bluetooth/hci_h5.c
+++ b/drivers/bluetooth/hci_h5.c
@@ -434,9 +434,10 @@ static void h5_handle_le_pkt(struct hci_uart *hu)
}
}

+
static inline void h5_unslip_one_byte(struct h5_struct *h5, unsigned char byte)
{
- const u8 c0 = 0xc0, db = 0xdb;
+ const u8 c0 = 0xc0, db = 0xdb, oneone = 0x11, onethree = 0x13;

switch (h5->rx_esc_state) {
case H5_ESCSTATE_NOESC:
@@ -473,20 +474,20 @@ static inline void h5_unslip_one_byte(struct h5_struct *h5, unsigned char byte)
h5->rx_count--;
break;

- case 0xdf:
- memcpy(skb_put(h5->rx_skb, 1), &db, 1);
+ case 0xde:
+ memcpy(skb_put(h5->rx_skb, 1), &oneone, 1);
if ((h5->rx_skb-> data[0] & 0x40) != 0 &&
h5->rx_state != H5_W4_CRC)
- h5_crc_update(&h5-> message_crc, 0x13);
+ h5_crc_update(&h5-> message_crc, 0x11);
h5->rx_esc_state = H5_ESCSTATE_NOESC;
h5->rx_count--;
break;

- case 0xde:
- memcpy(skb_put(h5->rx_skb, 1), &db, 1);
+ case 0xdf:
+ memcpy(skb_put(h5->rx_skb, 1), &onethree, 1);
if ((h5->rx_skb-> data[0] & 0x40) != 0 &&
h5->rx_state != H5_W4_CRC)
- h5_crc_update(&h5-> message_crc, 0x11);
+ h5_crc_update(&h5-> message_crc, 0x13);
h5->rx_esc_state = H5_ESCSTATE_NOESC;
h5->rx_count--;
break;
@@ -577,7 +578,7 @@ static void h5_complete_rx_pkt(struct hci_uart *hu)

static u16 h5_get_crc(struct h5_struct *h5)
{
- return get_unaligned_be16(&h5->rx_skb->data[h5->rx_skb->len - 2]);
+ return(get_unaligned_be16(&h5->rx_skb->data[h5->rx_skb->len - 2]));
}

/* Recv data */
@@ -668,7 +669,6 @@ static int h5_recv(struct hci_uart *hu, void *data, int count)
h5->rx_count = 0;
continue;
}
-
skb_trim(h5->rx_skb, h5->rx_skb->len - 2);
h5_complete_rx_pkt(hu);
h5->rx_state = H5_W4_PKT_DELIMITER;
--
1.7.1