Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 225225
b: refs/heads/master
c: 5591c75
h: refs/heads/master
i:
  225223: 6cca1c7
v: v3
  • Loading branch information
Joe Perches committed Dec 21, 2010
1 parent f42a322 commit 2c79cf2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 24 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b6bc765067ece933cc3dc7f5e95665a89100b1d5
refs/heads/master: 5591c75dc345d93d353d2ab2962824648a73efe4
39 changes: 16 additions & 23 deletions trunk/drivers/net/usb/hso.c
Original file line number Diff line number Diff line change
Expand Up @@ -997,6 +997,18 @@ static void packetizeRx(struct hso_net *odev, unsigned char *ip_pkt,
}
}

static void fix_crc_bug(struct urb *urb, __le16 max_packet_size)
{
static const u8 crc_check[4] = { 0xDE, 0xAD, 0xBE, 0xEF };
u32 rest = urb->actual_length % le16_to_cpu(max_packet_size);

if (((rest == 5) || (rest == 6)) &&
!memcmp(((u8 *)urb->transfer_buffer) + urb->actual_length - 4,
crc_check, 4)) {
urb->actual_length -= 4;
}
}

/* Moving data from usb to kernel (in interrupt state) */
static void read_bulk_callback(struct urb *urb)
{
Expand Down Expand Up @@ -1025,17 +1037,8 @@ static void read_bulk_callback(struct urb *urb)
return;
}

if (odev->parent->port_spec & HSO_INFO_CRC_BUG) {
u32 rest;
u8 crc_check[4] = { 0xDE, 0xAD, 0xBE, 0xEF };
rest = urb->actual_length %
le16_to_cpu(odev->in_endp->wMaxPacketSize);
if (((rest == 5) || (rest == 6)) &&
!memcmp(((u8 *) urb->transfer_buffer) +
urb->actual_length - 4, crc_check, 4)) {
urb->actual_length -= 4;
}
}
if (odev->parent->port_spec & HSO_INFO_CRC_BUG)
fix_crc_bug(urb, odev->in_endp->wMaxPacketSize);

/* do we even have a packet? */
if (urb->actual_length) {
Expand Down Expand Up @@ -1227,18 +1230,8 @@ static void hso_std_serial_read_bulk_callback(struct urb *urb)
return;

if (status == 0) {
if (serial->parent->port_spec & HSO_INFO_CRC_BUG) {
u32 rest;
u8 crc_check[4] = { 0xDE, 0xAD, 0xBE, 0xEF };
rest =
urb->actual_length %
le16_to_cpu(serial->in_endp->wMaxPacketSize);
if (((rest == 5) || (rest == 6)) &&
!memcmp(((u8 *) urb->transfer_buffer) +
urb->actual_length - 4, crc_check, 4)) {
urb->actual_length -= 4;
}
}
if (serial->parent->port_spec & HSO_INFO_CRC_BUG)
fix_crc_bug(urb, serial->in_endp->wMaxPacketSize);
/* Valid data, handle RX data */
spin_lock(&serial->serial_lock);
serial->rx_urb_filled[hso_urb_to_index(serial, urb)] = 1;
Expand Down

0 comments on commit 2c79cf2

Please sign in to comment.