Linux kernel patch for CDC problems

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
biggerbabou

Thanks!

Post by biggerbabou » Thu Oct 30, 2008 10:33 pm

Hello,

until I found this page I was trying night and day to get the f...... AVR-USB working...

After I applied the "Kernel-Patch" the AVR-USB-Thing is working perfect and I have a lot of fun playing around with it.

Right now I'm using the Vanilla Kernel 2.6.27.

Here's a little Overview of the two steps i did to get it running:

Code: Select all

1. in /usr/src/linux/drivers/usb/host/uhci-q.c:
[Column ~1050]

static int uhci_submit_bulk(struct uhci_hcd *uhci, struct urb *urb, struct uhci_qh *qh)
{
   int ret;

   /* Can't have low-speed bulk transfers */
//   if (urb->dev->speed == USB_SPEED_LOW)
//      return -EINVAL;

   if (qh->state != QH_STATE_ACTIVE)
//      qh->skel = SKEL_BULK;
      qh->skel = (urb->dev->speed == USB_SPEED_LOW ? SKEL_LS_CONTROL : SKEL_BULK);
   ret = uhci_submit_common(uhci, urb, qh);
//   if (ret == 0)
   if (ret == 0 && urb->dev->speed != USB_SPEED_LOW)
      uhci_add_fsbr(uhci, urb);
   return ret;
}

2. in /usr/src/linux/drivers/usb/core/config.c in der Funktion usb_parse_endpoint(...):
[Column ~140]

   /* Some buggy low-speed devices have Bulk endpoints, which is
    * explicitly forbidden by the USB spec.  In an attempt to make
    * them usable, we will try treating them as Interrupt endpoints.
    */
   if (to_usb_device(ddev)->speed == USB_SPEED_LOW &&
         usb_endpoint_xfer_bulk(d)) {
             dev_warn(ddev, "config %d interface %d altsetting %d "
                      "endpoint 0x%X is Bulk; this violates USB spec for "
                      "low speed devices.\n",
                      cfgno, inum, asnum, d->bEndpointAddress);
//               dev_warn(ddev, "config %d interface %d altsetting %d "
//                  "endpoint 0x%X is Bulk; changing to Interrupt\n",
//                  cfgno, inum, asnum, d->bEndpointAddress);
//               endpoint->desc.bmAttributes = USB_ENDPOINT_XFER_INT;
//               endpoint->desc.bInterval = 1;
//               if (le16_to_cpu(endpoint->desc.wMaxPacketSize) > 8)
//                       endpoint->desc.wMaxPacketSize = cpu_to_le16(8);
   }

avion23
Posts: 3
Joined: Tue Feb 14, 2012 6:40 pm

Re: Linux kernel patch for CDC problems

Post by avion23 » Thu Feb 16, 2012 11:42 pm

Are there any news with this?

My kernel version is 3.2.2. It still doesn't work, and i suspect that i've run into the same problem.
debug messages are:

Code: Select all

1d: 80 06 00 01 00 00 40 00 dd 94
20: 4b 12 01 10 01 02 00 00 08 10 cf
20: c3 c0 16 e1 05 00 01 01 02 ce 45
20: 4b 00 01 3f 8f
ff:
1d: 00 05 41 00 00 00 00 00 e5 e5
20: 4b 00 00
1d: 80 06 00 01 00 00 12 00 e0 f4
20: 4b 12 01 10 01 02 00 00 08 10 cf
20: c3 c0 16 e1 05 00 01 01 02 ce 45
20: 4b 00 01 3f 8f
1d: 80 06 00 02 00 00 09 00 ae 04
20: 4b 09 02 43 00 02 01 00 80 03 75
20: c3 fa c0 fc
1d: 80 06 00 02 00 00 43 00 99 64
20: 4b 09 02 43 00 02 01 00 80 03 75
20: c3 fa 09 04 00 00 01 02 02 79 2a
20: 4b 01 00 05 24 00 10 01 04 0f fc
20: c3 24 02 02 05 24 06 00 01 79 0c
20: 4b 05 24 01 03 01 07 05 83 ac d4
20: c3 03 08 00 ff 09 04 01 00 21 f8
20: 4b 02 0a 00 00 00 07 05 01 e7 7c
20: c3 02 08 00 00 07 05 81 02 47 09
20: 4b 08 00 00 0f fd
1d: 80 06 00 03 00 00 ff 00 d4 64
20: 4b 04 03 09 04 09 78
1d: 80 06 02 03 09 04 ff 00 97 db
20: 4b 10 03 55 00 53 00 42 00 a0 19
20: c3 2d 00 50 00 49 00 4f 00 52 49
20: 4b 00 00
1d: 80 06 01 03 09 04 ff 00 97 e8
20: 4b 22 03 77 00 77 00 77 00 39 f6
20: c3 2e 00 72 00 65 00 63 00 00 8e
20: 4b 75 00 72 00 73 00 69 00 46 e9
20: c3 6f 00 6e 00 2e 00 6a 00 d6 9a
20: 4b 70 00 db 8f
1d: 00 09 01 00 00 00 00 00 27 25
20: 4b 00 00
1d: 21 22 00 00 00 00 00 00 7e 22
20: 4b 00 00
1d: 21 20 00 00 00 00 07 00 5f d2
11: 80 25 00 00 00 00 08 63 c4
20: 4b 00 00
1d: 21 22 03 00 00 00 00 00 7e 11
20: 4b 00 00
1d: 21 22 00 00 00 00 00 00 7e 22
20: 4b 00 00
1d: 21 22 03 00 00 00 00 00 7e 11
20: 4b 00 00
1d: 21 22 00 00 00 00 00 00 7e 22
20: 4b 00 00


The last ones from sending '@' to the device.

Post Reply