Should i test this patch ?

matthieu castet wrote:
Frederick Ros wrote:

Quoting matthieu castet <[EMAIL PROTECTED]>:


Frederick Ros wrote:
Well there are no user for the module so why hotplug or another things
could not unload the modules ?



Yes .. but it leads to inconsistency between non-hotplugged machine and hotplug enabled ones ... For the former we know that the module is not unloaded and
therefore we could have some static (common to all instance of a modem)
information whereas on hotplug-enabled we can't take it for granted ...


What happen if I reboot and the modem have already the firmware...


Yep .. This is a point : in this case the moem is seen as a post-firmware (i.e that is what happened in my box even when it was off, as USB ports were still pwered on ..) .. We have no clue in this case to get the firmware level ...
except for explicitely checking the product id ...

I found some time to finalized my patch with driver info.
It is quite ugly, because i don't to touch much code but :
- eu_instance_t should be allocated in probe and we pass 'ins' to eu_init_*
- the use of CASE_PREFIRM, CASE_POSTFIRM and all macro comaring id should be replaced.


------------------------------------------------------------------------

Index: eagle-usb.h
===================================================================
RCS file: /cvs/eagleusb/eagleusb/driver/eagle-usb.h,v
retrieving revision 1.2
diff -u -u -r1.2 eagle-usb.h
--- eagle-usb.h 9 Oct 2004 11:59:56 -0000       1.2
+++ eagle-usb.h 7 Dec 2004 12:02:36 -0000
@@ -69,6 +69,13 @@
#define IS_EAGLE_III(c) ( EAGLE_III_PID_PREFIRM == (c) ) +#define PREFIRM 0
+#define PSTFIRM (1<<7)
+enum {
+EAGLE_I=1,
+EAGLE_II,
+EAGLE_III
+};
#ifdef __KERNEL__ Index: eu_main.c
===================================================================
RCS file: /cvs/eagleusb/eagleusb/driver/eu_main.c,v
retrieving revision 1.24
diff -u -u -r1.24 eu_main.c
--- eu_main.c   7 Nov 2004 09:06:55 -0000       1.24
+++ eu_main.c   7 Dec 2004 12:02:37 -0000
@@ -130,11 +130,11 @@
 /*
  * Ethernet device related
  */
-static eu_instance_t *eu_init_prefirm ( struct usb_device *usb );
+static eu_instance_t *eu_init_prefirm ( struct usb_device *usb, int 
driver_info );
 #ifdef LINUX_2_6
-static eu_instance_t * eu_init_postfirm ( struct usb_device *usb, struct 
usb_interface *intf );
+static eu_instance_t * eu_init_postfirm ( struct usb_device *usb, struct 
usb_interface *intf, int driver_info );
 #else
-static eu_instance_t * eu_init_postfirm ( struct usb_device *usb );
+static eu_instance_t * eu_init_postfirm ( struct usb_device *usb, int 
driver_info );
 #endif
 static void eu_disconnect_postfirm ( eu_instance_t *ins , struct usb_device 
*usb );
 static void eu_process_rcv ( unsigned long data );
@@ -148,22 +148,22 @@
  */
 static const struct usb_device_id eu_ids[] =
 {
-    {  USB_DEVICE (EAGLE_VID, EAGLE_I_PID_PREFIRM) },
- { USB_DEVICE (EAGLE_VID, EAGLE_I_PID_PSTFIRM) }, - { USB_DEVICE (EAGLE_VID, EAGLE_II_PID_PREFIRM) },
-    {  USB_DEVICE (EAGLE_VID, EAGLE_II_PID_PSTFIRM) },
-    {  USB_DEVICE (EAGLE_VID, EAGLE_IIC_PID_PREFIRM) },
-    {  USB_DEVICE (EAGLE_VID, EAGLE_IIC_PID_PSTFIRM) },
-    {  USB_DEVICE (EAGLE_VID, EAGLE_III_PID_PREFIRM) },
-    {  USB_DEVICE (EAGLE_VID, EAGLE_III_PID_PSTFIRM) },
-    {  USB_DEVICE (USR_VID, MILLER_A_PID_PREFIRM) },
-    {  USB_DEVICE (USR_VID, MILLER_A_PID_PSTFIRM) },
-    {  USB_DEVICE (USR_VID, MILLER_B_PID_PREFIRM) },
-    {  USB_DEVICE (USR_VID, MILLER_B_PID_PSTFIRM) },
-    {  USB_DEVICE (USR_VID, HEINEKEN_A_PID_PREFIRM) },
-    {  USB_DEVICE (USR_VID, HEINEKEN_A_PID_PSTFIRM) },
-    {  USB_DEVICE (USR_VID, HEINEKEN_B_PID_PREFIRM) },
-    {  USB_DEVICE (USR_VID, HEINEKEN_B_PID_PSTFIRM) },
+    {  USB_DEVICE (EAGLE_VID, EAGLE_I_PID_PREFIRM), 
.driver_info=EAGLE_I|PREFIRM },
+ { USB_DEVICE (EAGLE_VID, EAGLE_I_PID_PSTFIRM), .driver_info=EAGLE_I|PSTFIRM }, + { USB_DEVICE (EAGLE_VID, EAGLE_II_PID_PREFIRM), .driver_info=EAGLE_II|PREFIRM },
+    {  USB_DEVICE (EAGLE_VID, EAGLE_II_PID_PSTFIRM), 
.driver_info=EAGLE_II|PSTFIRM },
+    {  USB_DEVICE (EAGLE_VID, EAGLE_IIC_PID_PREFIRM), 
.driver_info=EAGLE_II|PREFIRM },
+    {  USB_DEVICE (EAGLE_VID, EAGLE_IIC_PID_PSTFIRM), 
.driver_info=EAGLE_II|PSTFIRM },
+    {  USB_DEVICE (EAGLE_VID, EAGLE_III_PID_PREFIRM), 
.driver_info=EAGLE_III|PREFIRM },
+    {  USB_DEVICE (EAGLE_VID, EAGLE_III_PID_PSTFIRM), 
.driver_info=EAGLE_III|PSTFIRM },
+    {  USB_DEVICE (USR_VID, MILLER_A_PID_PREFIRM), 
.driver_info=EAGLE_I|PREFIRM },
+    {  USB_DEVICE (USR_VID, MILLER_A_PID_PSTFIRM), 
.driver_info=EAGLE_I|PSTFIRM },
+    {  USB_DEVICE (USR_VID, MILLER_B_PID_PREFIRM), 
.driver_info=EAGLE_I|PREFIRM },
+    {  USB_DEVICE (USR_VID, MILLER_B_PID_PSTFIRM), 
.driver_info=EAGLE_I|PSTFIRM },
+    {  USB_DEVICE (USR_VID, HEINEKEN_A_PID_PREFIRM), 
.driver_info=EAGLE_I|PREFIRM },
+    {  USB_DEVICE (USR_VID, HEINEKEN_A_PID_PSTFIRM), 
.driver_info=EAGLE_I|PSTFIRM },
+    {  USB_DEVICE (USR_VID, HEINEKEN_B_PID_PREFIRM), 
.driver_info=EAGLE_I|PREFIRM },
+    {  USB_DEVICE (USR_VID, HEINEKEN_B_PID_PSTFIRM), 
.driver_info=EAGLE_I|PSTFIRM },
     { }
 };
@@ -362,27 +362,19 @@
     eu_dbg (DBG_INIT,"vid (%#X) pid (%#X) \n",
              usb->descriptor.idVendor, usb->descriptor.idProduct);
- /*
-     * This driver knows only pre and postfirmware devices.
-     */
-    if ( !ISPREFIRM(pid) && !ISPOSTFIRM(pid) )
-    {
-        eu_dbg (DBG_INIT," Not a supported modem\n");
-        goto byebye;
- } -
+    int driver_info = (int) id->driver_info;
     switch ( pid )
     {
         case CASE_PREFIRM:
- ins = eu_init_prefirm ( usb );
+            ins = eu_init_prefirm ( usb, driver_info );
             break;
case CASE_POSTFIRM: #ifdef LINUX_2_6 - ins = eu_init_postfirm ( usb, intf );
+            ins = eu_init_postfirm ( usb, intf, driver_info);
 #else
-            ins = eu_init_postfirm ( usb );
+            ins = eu_init_postfirm ( usb, driver_info);
 #endif
break;
@@ -415,7 +407,7 @@
  *
  * @usb  -  USB device to init.
  */
-static eu_instance_t *eu_init_prefirm ( struct usb_device *usb ) +static eu_instance_t *eu_init_prefirm ( struct usb_device *usb, int driver_info ) {
     eu_instance_t *ins    = NULL;
     int            ret;
@@ -440,6 +432,7 @@
      */
     memset (ins, 0, sizeof(eu_instance_t));
     ins->usbdev = usb;
+    ins->driver_info = driver_info;
EU_CLEAR_FLAG (ins, EU_MSG_INITIALIZED);
     EU_CLEAR_FLAG (ins, EU_UNPLUG);
@@ -474,9 +467,9 @@
  * @usb  -  USB device to init
  */
 #ifdef LINUX_2_6
-static eu_instance_t * eu_init_postfirm ( struct usb_device *usb, struct 
usb_interface *intf )
+static eu_instance_t * eu_init_postfirm ( struct usb_device *usb, struct 
usb_interface *intf, int driver_info )
#else -static eu_instance_t * eu_init_postfirm ( struct usb_device *usb )
+static eu_instance_t * eu_init_postfirm ( struct usb_device *usb int 
driver_info )
 #endif
 {
     int                             i;
@@ -506,6 +499,7 @@
      */
     memset ( ins, 0, sizeof(eu_instance_t) );
     ins->usbdev = usb;
+    ins->driver_info = driver_info;
EU_CLEAR_FLAG ( ins, EU_MSG_INITIALIZED); EU_CLEAR_FLAG ( ins, EU_UNPLUG); @@ -1740,7 +1734,7 @@
     p += sprintf(p, "eagle-usb status display\n");
     p += sprintf(p, 
"-------------------------------------------------------------\n");
     p += sprintf(p, "Driver version %s     Chipset: Eagle%1.1d\n",
-                 EAGLEUSBVERSION, chipset_version);
+                 EAGLEUSBVERSION, ins->driver_info & 0xf);
if (ins->usbdev != NULL)
     {
Index: eu_types.h
===================================================================
RCS file: /cvs/eagleusb/eagleusb/driver/eu_types.h,v
retrieving revision 1.8
diff -u -u -r1.8 eu_types.h
--- eu_types.h  7 Nov 2004 09:06:55 -0000       1.8
+++ eu_types.h  7 Dec 2004 12:02:38 -0000
@@ -832,6 +832,8 @@
      */
     uint32_t Statistics[STAT_COUNT];
+ int driver_info;
+
     /*
      * ATM data
      */



Reply via email to