Hi all.

Johannes Hölzl wrote :
Hi Nathael,

        To solve this the new_id is added under the serial driver directory at:

        /sys/bus/usb-serial/drivers/<driver>/new_id

OK, I do not have this new_id file as I must use 2.6.19.2 (stable kernel) for my client and do not want to backport all the USB from 2.6.20.

But then, your solution is in fact allright.

I got two other points though, both in drivers/usb/serial/usb-serial.c :

- get_iface_id() can be written without the goto statement (I have been told to avoid them as much as possible)


- usb_serial_probe() is not laid out in a way wich pleases me, and this may be useful for others:
           the call to type->calc_num_ports(serial); is done before the
                serial->num_bulk_in = num_bulk_in;
                serial->num_bulk_out = num_bulk_out;
                serial->num_interrupt_in = num_interrupt_in;
                serial->num_interrupt_out = num_interrupt_out;
           so we did calculations to find them, and do not pass them to
           calc_num_ports(), which has to compute again if it needs any
           of them.
           (my new driver is based on the generic one, and I must keep the
                num_ports = num_bulk_out; )
           And then, if calc_num_ports() wants to modify any of serial->num_*_*
           it cannot because they are overidden just after.


Let me know about this.

I may come with more stuff, as my driver is a WIP.


Have fun :)
++++



--- old/drivers/usb/serial/usb-serial.c	2007-01-24 13:59:37.368589820 +0100
+++ new/drivers/usb/serial/usb-serial.c	2007-01-24 14:41:41.956457883 +0100
@@ -636,12 +636,12 @@
 	id = usb_match_id(intf, drv->id_table);
 	if (id) {
 		dbg("static descriptor matches");
-		goto exit;
+	} else {
+		id = match_dynamic_id(intf, drv);
+		if (id)
+			dbg("dynamic descriptor matches");
 	}
-	id = match_dynamic_id(intf, drv);
-	if (id)
-		dbg("dynamic descriptor matches");
-exit:
+	
 	return id;
 }
 
@@ -810,6 +810,12 @@
 		}
 	}
 #endif
+
+	serial->num_bulk_in = num_bulk_in;
+	serial->num_bulk_out = num_bulk_out;
+	serial->num_interrupt_in = num_interrupt_in;
+	serial->num_interrupt_out = num_interrupt_out;
+
 	if (!num_ports) {
 		/* if this device type has a calc_num_ports function, call it */
 		if (type->calc_num_ports) {
@@ -828,10 +834,6 @@
 
 	serial->minor = minor;
 	serial->num_ports = num_ports;
-	serial->num_bulk_in = num_bulk_in;
-	serial->num_bulk_out = num_bulk_out;
-	serial->num_interrupt_in = num_interrupt_in;
-	serial->num_interrupt_out = num_interrupt_out;
 
 	/* create our ports, we need as many as the max endpoints */
 	/* we don't use num_ports here cauz some devices have more endpoint pairs than ports */
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to