Hello,

While going through the USB Code (usb.c) the function used to select the
driver reads

        for (tmp = usb_driver_list.next; tmp != &usb_driver_list;) {
                driver = list_entry(tmp, struct usb_driver, driver_list);
                tmp = tmp->next;

                id = driver->id_table;
                /* new style driver? */
                if (id) {
                        for (i = 0; i < interface->num_altsetting; i++) {
                                interface->act_altsetting = i;
                                id = usb_match_id(dev, interface, id);
                                if (id) {
                                        down(&driver->serialize);
                                        private = driver->probe(dev,ifnum,id);
                                        up(&driver->serialize);
                                        if (private != NULL)
                                                break;
                                }
                        }

                        /* if driver not bound, leave defaults unchanged */
                        if (private == NULL)
                                interface->act_altsetting = 0;
                } else { /* "old style" driver */
            ........

Here the code intializes id to start of id_table only at the beginning. The
first alternate setting would be checked against all drivers, but in this
process the id pointer is used to iterate through the id_table. And hence if
none matches, id_pointer would become NULL (last entry in id_table) and
therefore the remaining alternate settings would not be checked for match.
So while checking against next alternate settings the id pointer should be
re-initialized to start of id_table.

        for (tmp = usb_driver_list.next; tmp != &usb_driver_list;) {
            ......
                if (id) {
                        for (i = 0; i < interface->num_altsetting; i++) {
                                interface->act_altsetting = i;

                            /**FIX**/ id = driver->id_table; /**FIX**/
                                id = usb_match_id(dev, interface, id);
                        .......
                        }
                  ........


I don't know if this bug is already caught and fixed in subsequent versions.
Forgive me if already reported and please provide me the details of the
version from which the fix is available.

-Sp.Raja


-----Original Message-----
From: Sp.Raja [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 9 January 2003 1:00 PM
To: [EMAIL PROTECTED]
Subject: Alternate setting order dependency


Hello,

I want my device to support both ACM(Vendor specific protocol) and ECM
sub-classes of CDC.  I decided to use alternate settings in Interface to
achieve this.  When I use Alternate setting 0 for ECM and 1 for ACM(vendor
specific protocol) Linux recognizes the device and uses ECM as expected, but
When I change the alternate setting, 1 for ECM and 0 for ACM(vendor specific
protocol) Linux does not recognizes the device. Why this dependency coming
in ?

What is preferred in this case ? Either two configurations or interface with
two alternate settings ?

/proc/bus/usb/devices [ECM in alternateSetting 0 and ACM in alternateSetting
1]

T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  7 Spd=12  MxCh= 0
D:  Ver= 1.10 Cls=02(comm.) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor=1110 ProdID=6489 Rev= 0.00
C:* #Ifs= 2 Cfg#= 1 Atr=40 MxPwr=200mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=06 Prot=00 Driver=CDCEther
E:  Ad=81(I) Atr=03(Int.) MxPS=   8 Ivl=1ms
I:  If#= 0 Alt= 1 #EPs= 1 Cls=02(comm.) Sub=02 Prot=ff Driver=CDCEther
E:  Ad=81(I) Atr=03(Int.) MxPS=   8 Ivl=1ms
I:  If#= 1 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=CDCEther
E:  Ad=82(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=03(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms

/proc/bus/usb/devices [ACM in alternateSetting 1 and ECM in alternateSetting
0]

T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  7 Spd=12  MxCh= 0
D:  Ver= 1.10 Cls=02(comm.) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor=1110 ProdID=6489 Rev= 0.00
C:* #Ifs= 2 Cfg#= 1 Atr=40 MxPwr=200mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=02 Prot=ff Driver=none
E:  Ad=81(I) Atr=03(Int.) MxPS=   8 Ivl=1ms
I:  If#= 0 Alt= 1 #EPs= 1 Cls=02(comm.) Sub=06 Prot=00 Driver=none
E:  Ad=81(I) Atr=03(Int.) MxPS=   8 Ivl=1ms
I:  If#= 1 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=none
E:  Ad=82(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=03(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms

Thanks
Sp.Raja



-------------------------------------------------------
This SF.NET email is sponsored by: FREE  SSL Guide from Thawte
are you planning your Web Server Security? Click here to get a FREE
Thawte SSL guide and find the answers to all your  SSL security issues.
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0026en
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-users

Reply via email to