Re: USB low-speed bulk transfers

"Steinar H. Gunderson" <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
On Thu, Jun 07, 2007 at 01:14:45PM +0200, Clemens Ladisch wrote:
> Try the attached patch.

It seems to work well, at least in my limited tests. I've been using it
together with this patch to make usbaudio.c understand low-speed devices:

diff -ur linux-2.6.22-rc4/sound/usb/usbaudio.c linux-2.6.22-rc4.patched/sound/usb/usbaudio.c
--- linux-2.6.22-rc4/sound/usb/usbaudio.c       2007-06-05 02:57:25.000000000 +0200
+++ linux-2.6.22-rc4.patched/sound/usb/usbaudio.c       2007-06-07 13:56:08.000000000 +0200
@@ -1012,10 +1012,10 @@
        unsigned int npacks[MAX_URBS], urb_packs, total_packs, packs_per_ms;
        
        /* calculate the frequency in 16.16 format */
-       if (snd_usb_get_speed(subs->dev) == USB_SPEED_FULL)
-               subs->freqn = get_usb_full_speed_rate(rate);
-       else        
+       if (snd_usb_get_speed(subs->dev) == USB_SPEED_HIGH)
                subs->freqn = get_usb_high_speed_rate(rate);
+       else    
+               subs->freqn = get_usb_full_speed_rate(rate);
        subs->freqm = subs->freqn;
        /* calculate max. frequency */
        if (subs->maxpacksize) {
@@ -1379,7 +1379,7 @@
                    get_endpoint(alts, 1)->bRefresh >= 1 &&
                    get_endpoint(alts, 1)->bRefresh <= 9)
                        subs->syncinterval = get_endpoint(alts, 1)->bRefresh;
-               else if (snd_usb_get_speed(subs->dev) == USB_SPEED_FULL)
+               else if (snd_usb_get_speed(subs->dev) != USB_SPEED_HIGH)
                        subs->syncinterval = 1;
                else if (get_endpoint(alts, 1)->bInterval >= 1 &&
                         get_endpoint(alts, 1)->bInterval <= 16)
@@ -2207,10 +2207,10 @@
        subs->stream = as;
        subs->direction = stream;
        subs->dev = as->chip->dev;
-       if (snd_usb_get_speed(subs->dev) == USB_SPEED_FULL)
-               subs->ops = audio_urb_ops[stream];
-       else
+       if (snd_usb_get_speed(subs->dev) == USB_SPEED_HIGH)
                subs->ops = audio_urb_ops_high_speed[stream];
+       else
+               subs->ops = audio_urb_ops[stream];
        snd_pcm_set_ops(as->pcm, stream,
                        stream == SNDRV_PCM_STREAM_PLAYBACK ?
                        &snd_usb_playback_ops : &snd_usb_capture_ops);
@@ -3381,7 +3381,8 @@
        
        *rchip = NULL;
        
-       if (snd_usb_get_speed(dev) != USB_SPEED_FULL &&
+       if (snd_usb_get_speed(dev) != USB_SPEED_LOW &&
+           snd_usb_get_speed(dev) != USB_SPEED_FULL &&
            snd_usb_get_speed(dev) != USB_SPEED_HIGH) {
                snd_printk(KERN_ERR "unknown device speed %d\n", snd_usb_get_speed(dev));
                return -ENXIO;

Is this reasonably sane, or is a more thorough fix (differentiating better
between low- and full-speed devices) needed for a final patch?

/* Steinar */
-- 
Homepage: http://www.sesse.net/

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.