The SDDR-09 driver is, well, not one of our finest works.  :)

    We call usb_set_configuration() to change to a specific alternate
    configuration for this device.  Is there some sort of problem with
    calling that function?

It is almost the opposite, there is some sort of problem with
not calling that function.

I do not know enough yet to change these things, so I am only
muttering about the things I don't like or don't understand,
and about the things that cause the kernel to malfunction.

Ugly part number one is the special ad-hoc
CONFIG_USB_STORAGE_SDDR09 code in storage/usb.c:storage_probe().
USB storage must do general things, and if special device things
are required there should be a flag for that special action in
the unusual device table.

Question number two is the code that selects the endpoint:

        for (i = 0; i < altsetting->bNumEndpoints; i++) {
                /* is it an BULK endpoint? */
                if ((altsetting->endpoint[i].bmAttributes &
                     USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_BULK) {
                        /* BULK in or out? */
                        if (altsetting->endpoint[i].bEndpointAddress &
                            USB_DIR_IN)
                                ep_in = &altsetting->endpoint[i];
                        else
                                ep_out = &altsetting->endpoint[i];
                }

                /* is it an interrupt endpoint? */
                if ((altsetting->endpoint[i].bmAttributes &
                     USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_INT) {
                        ep_int = &altsetting->endpoint[i];
                }
        }

Thus, among all endpoints, one will get the last endpoints that are
bulk-in, bulk-out and interrupt, respectively.
To me that sounds fairly random.
But maybe there is some ordering among the endpoints, so that it
is appropriate to take the last ones in the list?

Problem number three is that the above code in storage_probe()
is called in a loop over all interfaces (in scsiglue.c I suppose)
but that usb_set_configuration() is not called, so that the endpoint
sizes will be undefined if the interface is not interface 0.

Probably there should be an unconditional call to usb_set_configuration()
in storage_probe().

Andries


P.S. Let me repeat the /proc/bus/usb/devices output for the device
that prompted this discussion.

T:  Bus=01 Lev=02 Prnt=02 Port=02 Cnt=02 Dev#=  4 Spd=12  MxCh= 0
D:  Ver= 1.00 Cls=ff(vend.) Sub=ff Prot=ff MxPS=64 #Cfgs=  1
P:  Vendor=07cc ProdID=0003 Rev= 0.00
C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=100mA
I:  If#= 0 Alt= 0 #EPs= 0 Cls=ff(vend.) Sub=ff Prot=ff Driver=usb-storage
I:  If#= 0 Alt= 1 #EPs=13 Cls=ff(vend.) Sub=ff Prot=ff Driver=usb-storage
E:  Ad=81(I) Atr=03(Int.) MxPS=  16 Ivl=10ms
E:  Ad=82(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=84(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=04(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=86(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=06(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=88(I) Atr=01(Isoc) MxPS=  16 Ivl=1ms
E:  Ad=08(O) Atr=01(Isoc) MxPS=  16 Ivl=1ms
E:  Ad=89(I) Atr=01(Isoc) MxPS=  16 Ivl=1ms
E:  Ad=09(O) Atr=01(Isoc) MxPS=  16 Ivl=1ms
E:  Ad=8a(I) Atr=01(Isoc) MxPS=  16 Ivl=1ms
E:  Ad=0a(O) Atr=01(Isoc) MxPS=  16 Ivl=1ms
I:  If#= 0 Alt= 2 #EPs=13 Cls=ff(vend.) Sub=ff Prot=ff Driver=usb-storage
E:  Ad=81(I) Atr=03(Int.) MxPS=  64 Ivl=10ms
E:  Ad=82(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=84(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=04(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=86(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=06(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=88(I) Atr=01(Isoc) MxPS= 256 Ivl=1ms
E:  Ad=08(O) Atr=01(Isoc) MxPS= 256 Ivl=1ms
E:  Ad=89(I) Atr=01(Isoc) MxPS=  16 Ivl=1ms
E:  Ad=09(O) Atr=01(Isoc) MxPS=  16 Ivl=1ms
E:  Ad=8a(I) Atr=01(Isoc) MxPS=  16 Ivl=1ms
E:  Ad=0a(O) Atr=01(Isoc) MxPS=  16 Ivl=1ms


_______________________________________________________________

Have big pipes? SourceForge.net is looking for download mirrors. We supply
the hardware. You get the recognition. Email Us: [EMAIL PROTECTED]
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to