Version 6 now available from the same location
(http://www.hystedjp.pwp.blueyonder.co.uk). For Rev 0 and 2 modems this
works as before, but for version 4 modems it does a get_state every 12
seconds until it sees that the modem has sync'ed. There is no need for the
timed_out=0 fix anymore and I believe it should work with kernel mode
drivers. I chose 12 seconds as my modem almost always manages to sync within
24 seconds, though on one memorable occasion it took 783 seconds to sync.
The timeout code in the CVS sets a limit of 60 seconds to sync, so I have
kept to that, though I think it is too short.
The patch also fixes some problems with extract.c for newer firmware
versions.

Index: src/extract.c
===================================================================
RCS file: /cvsroot/speedtouch/speedtouch/src/extract.c,v
retrieving revision 1.10
diff -u -r1.10 extract.c
--- src/extract.c 6 Aug 2003 01:37:46 -0000 1.10
+++ src/extract.c 13 Feb 2004 08:16:31 -0000
@@ -67,6 +67,8 @@
  {0x3b4a5854, 671653, "1.6.1 - MacOSX - Win32(1.0.1800)"},
  {0xd673923f, 672264, "2.0.0 - Win32(07)"},
  {0x5bca7d16, 677641, "2.0.1 - MacOSX - Win32(2.0.0)"},
+ {0x78039fed, 762650, "3.0.6 - MacOSX - Win32"},
+ {0x0223733c, 775509, "1.0.10 - Win32 Rev 0400 SACHU3"},
 };


/***************************************************************************
**
@@ -150,7 +152,7 @@
     id = firmware_ids[loop].id;
   }

-  report(1, REPORT_INFO, "Firmware information (CRC:0x%8x, Size:%d, %s)\n",
+  report(1, REPORT_INFO, "Firmware information (CRC:0x%08x, Size:%d,
%s)\n",
          ~aal5_calc_crc(buf1, *size,~0),
          *size,
          id);
@@ -340,7 +342,7 @@
   return(-1);
  }

- printf("Firmware CRC: 0x%8x\n", ~aal5_calc_crc(buf, size,~0));
+ printf("Firmware CRC: 0x%08x\n", ~aal5_calc_crc(buf, size,~0));
  printf("Firmware Size: %d\n", size);

  free(buf);
Index: src/modem_run.c
===================================================================
RCS file: /cvsroot/speedtouch/speedtouch/src/modem_run.c,v
retrieving revision 1.36
diff -u -r1.36 modem_run.c
--- src/modem_run.c 4 Jan 2004 22:44:25 -0000 1.36
+++ src/modem_run.c 13 Feb 2004 08:16:33 -0000
@@ -64,6 +64,7 @@
 /* Timeout in milliseconds */
 #define CTRL_TIMEOUT 2000
 #define DATA_TIMEOUT 2000
+#define SYNC_TIMEOUT 12000

 #define OFFSET_7  0 /* size 1 */
 #define OFFSET_b  1 /* size 8 */
@@ -97,6 +98,8 @@
 static int timed_out = 0;    /* Used to give a timeout signal inside the
wait loop */
 static int sb = 0;           /* Software buffering */
 static int signal_kernel = 0;/* Kernel driver notification */
+static int alternate_ep = 1; /* historically was 2, speedtouch 330 needs 1
*/
+static int revision = -1;    /* 0, 2 or 4. Default to 2 if not deduced or
supplied */

 /*
  * This array is just ARM code that initializes the speedtouch
@@ -348,6 +351,127 @@
 #endif
 };

+static unsigned char data1_400[] =
+{
+       0x88, 0xf8, 0x00, 0x00, 0x00, 0x00, 0xf2, 0x01,
+       0x0a, 0x00, 0x00, 0xea, 0x09, 0x00, 0x00, 0xea,
+       0x08, 0x00, 0x00, 0xea, 0x07, 0x00, 0x00, 0xea,
+       0x06, 0x00, 0x00, 0xea, 0x05, 0x00, 0x00, 0xea,
+       0x9c, 0x00, 0x00, 0xea, 0x03, 0x00, 0x00, 0xea,
+       0x18, 0x13, 0x9f, 0xe5, 0x00, 0x00, 0xa0, 0xe3,
+       0x00, 0x00, 0x81, 0xe5, 0xfb, 0xff, 0xff, 0xea,
+       0x01, 0x00, 0xa0, 0xe3, 0x08, 0x13, 0x9f, 0xe5,
+       0x00, 0x00, 0x81, 0xe5, 0xd1, 0x00, 0xa0, 0xe3,
+       0x00, 0xf0, 0x29, 0xe1, 0xfc, 0xd2, 0x9f, 0xe5,
+       0xd2, 0x00, 0xa0, 0xe3, 0x00, 0xf0, 0x29, 0xe1,
+       0xf4, 0xd2, 0x9f, 0xe5, 0xd3, 0x00, 0xa0, 0xe3,
+       0x00, 0xf0, 0x29, 0xe1, 0xec, 0xd2, 0x9f, 0xe5,
+       0x00, 0x00, 0xa0, 0xe3, 0x00, 0x10, 0xa0, 0xe3,
+       0xe4, 0x12, 0x9f, 0xe5, 0x01, 0x22, 0xa0, 0xe3,
+       0x01, 0x00, 0xa0, 0xe3, 0x00, 0x00, 0x81, 0xe5,
+       0xd8, 0xa2, 0x9f, 0xe5, 0x15, 0x00, 0x00, 0xeb,
+       0x00, 0x00, 0x82, 0xe5, 0x7d, 0xaf, 0xa0, 0xe3,
+       0x12, 0x00, 0x00, 0xeb, 0x10, 0x00, 0x82, 0xe5,
+       0x08, 0x60, 0xa0, 0xe3, 0x20, 0x00, 0x82, 0xe5,
+       0x20, 0xa0, 0xa0, 0xe3, 0x0d, 0x00, 0x00, 0xeb,
+       0x01, 0x60, 0x56, 0xe2, 0xfa, 0xff, 0xff, 0x1a,
+       0xac, 0x52, 0x9f, 0xe5, 0x00, 0x00, 0x85, 0xe5,
+       0x00, 0x00, 0xa0, 0xe3, 0x00, 0x00, 0x81, 0xe5,
+       0x01, 0x02, 0xa0, 0xe3, 0x00, 0x10, 0xa0, 0xe3,
+       0x98, 0x22, 0x9f, 0xe5, 0x04, 0x30, 0xa0, 0xe3,
+       0x03, 0x10, 0x80, 0xe6, 0x02, 0x00, 0x50, 0xe1,
+       0xfc, 0xff, 0xff, 0x1a, 0x02, 0x00, 0x00, 0xea,
+       0x01, 0xa0, 0x5a, 0xe2, 0xfd, 0xff, 0xff, 0x1a,
+       0x0e, 0xf0, 0xa0, 0xe1, 0x00, 0x10, 0xa0, 0xe3,
+       0x01, 0x28, 0xa0, 0xe3, 0x7f, 0x2f, 0x82, 0xe2,
+       0x02, 0x16, 0x81, 0xe0, 0x12, 0x30, 0xa0, 0xe3,
+       0x03, 0x3b, 0x83, 0xe2, 0x00, 0x00, 0xa0, 0xe3,
+       0x00, 0x2a, 0x83, 0xe1, 0x04, 0x20, 0x81, 0xe4,
+       0x01, 0x00, 0x80, 0xe2, 0x01, 0x0c, 0x50, 0xe3,
+       0xfa, 0xff, 0xff, 0xba, 0x1e, 0x30, 0xa0, 0xe3,
+       0x03, 0x3b, 0x83, 0xe2, 0x00, 0x2a, 0x83, 0xe1,
+       0x04, 0x20, 0x81, 0xe4, 0x01, 0x00, 0x80, 0xe2,
+       0x01, 0x4c, 0xa0, 0xe3, 0x02, 0x40, 0x84, 0xe2,
+       0x04, 0x00, 0x50, 0xe1, 0xf8, 0xff, 0xff, 0xba,
+       0x12, 0x30, 0xa0, 0xe3, 0x03, 0x3b, 0x83, 0xe2,
+       0x00, 0x2a, 0x83, 0xe1, 0x04, 0x20, 0x81, 0xe4,
+       0x01, 0x00, 0x80, 0xe2, 0x01, 0x0a, 0x50, 0xe3,
+       0xfa, 0xff, 0xff, 0xba, 0x00, 0x10, 0xa0, 0xe3,
+       0x01, 0x28, 0xa0, 0xe3, 0x7f, 0x2f, 0x82, 0xe2,
+       0x02, 0x16, 0x81, 0xe0, 0x10, 0x1f, 0x02, 0xee,
+       0x03, 0x40, 0xa0, 0xe3, 0x10, 0x4f, 0x03, 0xee,
+       0x00, 0x50, 0xa0, 0xe3, 0x10, 0x5f, 0x05, 0xee,
+       0x17, 0x5f, 0x07, 0xee, 0x17, 0x5f, 0x08, 0xee,
+       0x3d, 0x00, 0xa0, 0xe3, 0x10, 0x0f, 0x01, 0xee,
+       0x01, 0x73, 0xa0, 0xe3, 0x04, 0x00, 0xa0, 0xe3,
+       0x05, 0x00, 0xc7, 0xe5, 0x01, 0x00, 0xa0, 0xe3,
+       0x06, 0x00, 0xc7, 0xe5, 0x01, 0x00, 0xa0, 0xe3,
+       0x07, 0x00, 0xc7, 0xe5, 0x03, 0x00, 0xa0, 0xe3,
+       0x08, 0x00, 0xc7, 0xe5, 0x00, 0x00, 0xa0, 0xe3,
+       0x09, 0x00, 0xc7, 0xe5, 0x80, 0x00, 0xa0, 0xe3,
+       0x01, 0x00, 0xc7, 0xe5, 0x53, 0x00, 0xa0, 0xe3,
+       0x00, 0xf0, 0x29, 0xe1, 0x98, 0x11, 0x9f, 0xe5,
+       0x00, 0x00, 0xe0, 0xe3, 0x00, 0x00, 0x81, 0xe5,
+       0x90, 0x11, 0x9f, 0xe5, 0x00, 0x00, 0xe0, 0xe3,
+       0x00, 0x00, 0x81, 0xe5, 0x88, 0x11, 0x9f, 0xe5,
+       0x03, 0x00, 0xa0, 0xe3, 0x00, 0x00, 0x81, 0xe5,
+       0x01, 0x09, 0xa0, 0xe3, 0x7c, 0x11, 0x9f, 0xe5,
+       0x00, 0x00, 0x40, 0x01, 0x12, 0x88, 0x9c, 0xf2,
+       0x01, 0x00, 0x00, 0x96, 0x01, 0x81, 0xe5, 0x80,
+       0x00, 0xa0, 0xe3, 0x40, 0x11, 0x9f, 0xe5, 0x00,
+       0x00, 0x81, 0xe5, 0x04, 0x00, 0x8f, 0xe2, 0x01,
+       0x00, 0x80, 0xe2, 0x10, 0xff, 0x2f, 0xe1, 0x59,
+       0x4f, 0xb8, 0x78, 0x40, 0x1e, 0xfc, 0xd1, 0x38,
+       0x78, 0xf9, 0x7a, 0x09, 0x02, 0xbc, 0x7a, 0x21,
+       0x43, 0x09, 0x02, 0x7c, 0x7a, 0x21, 0x43, 0x09,
+       0x02, 0x3c, 0x7a, 0x21, 0x43, 0x11, 0x38, 0x01,
+       0x28, 0x2d, 0xdb, 0x03, 0x28, 0x2b, 0xdc, 0x80,
+       0x00, 0x50, 0x4c, 0x24, 0x58, 0xa7, 0x46, 0x3c,
+       0x4b, 0x0e, 0x33, 0x7a, 0x7b, 0x12, 0x02, 0x3c,
+       0x7b, 0x22, 0x43, 0x12, 0xd0, 0x14, 0x1c, 0xf4,
+       0x3c, 0xff, 0x3c, 0x0e, 0xd5, 0x40, 0x07, 0x02,
+       0xd0, 0x1c, 0x1c, 0x0b, 0x1c, 0x21, 0x1c, 0x52,
+       0x1e, 0x8c, 0x5c, 0x9c, 0x54, 0xfb, 0xd1, 0x31,
+       0xa4, 0x14, 0x23, 0x23, 0x60, 0xc0, 0x0f, 0x64,
+       0x30, 0x00, 0xe0, 0x66, 0x20, 0x78, 0x70, 0xcb,
+       0xe7, 0x01, 0xa2, 0x10, 0x47, 0x00, 0x00, 0x01,
+       0xf0, 0xa0, 0xe1, 0x04, 0x20, 0x8f, 0xe2, 0x01,
+       0x20, 0x82, 0xe2, 0x12, 0xff, 0x2f, 0xe1, 0x60,
+       0x20, 0xf0, 0xe7, 0x04, 0xe0, 0x4e, 0xe2, 0x00,
+       0x40, 0x2d, 0xe9, 0x00, 0xe0, 0x4f, 0xe1, 0x07,
+       0x40, 0x2d, 0xe9, 0x80, 0x10, 0x8f, 0xe2, 0x00,
+       0x00, 0x91, 0xe5, 0x01, 0x00, 0x20, 0xe2, 0x00,
+       0x00, 0x81, 0xe5, 0x00, 0x00, 0x50, 0xe3, 0x03,
+       0x00, 0x00, 0x0a, 0x0d, 0x10, 0xa0, 0xe3, 0xb8,
+       0x20, 0x9f, 0xe5, 0x00, 0x10, 0x82, 0xe5, 0x02,
+       0x00, 0x00, 0xea, 0x0f, 0x10, 0xa0, 0xe3, 0xa8,
+       0x20, 0x9f, 0xe5, 0x00, 0x10, 0x82, 0xe5, 0x01,
+       0x00, 0xa0, 0xe3, 0x64, 0x10, 0x9f, 0xe5, 0x00,
+       0x00, 0x81, 0xe5, 0x44, 0x10, 0x8f, 0xe2, 0x00,
+       0x00, 0x91, 0xe5, 0x01, 0x00, 0x40, 0xe2, 0x00,
+       0x00, 0x81, 0xe5, 0x00, 0x00, 0x50, 0xe3, 0x02,
+       0x00, 0x00, 0x1a, 0x80, 0x00, 0x9f, 0xe5, 0x80,
+       0x10, 0x9f, 0xe5, 0x00, 0x00, 0x81, 0xe5, 0x60,
+       0x00, 0x9f, 0xe5, 0x00, 0x10, 0x90, 0xe5, 0x08,
+       0x20, 0xc1, 0xe3, 0x00, 0x20, 0x80, 0xe5, 0x07,
+       0x40, 0xbd, 0xe8, 0x0e, 0xf0, 0x69, 0xe1, 0x00,
+       0x80, 0xfd, 0xe8, 0x15, 0x2f, 0x8c, 0x9b, 0x00,
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78,
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x3d,
+       0x02, 0x00, 0x00, 0x3d, 0x02, 0x00, 0x00, 0x77,
+       0x02, 0x00, 0x00, 0x10, 0x02, 0x00, 0xb0, 0x64,
+       0x00, 0x00, 0x90, 0x00, 0x40, 0x00, 0x10, 0x9c,
+       0x3f, 0x00, 0x10, 0x7c, 0x3c, 0x00, 0x10, 0x00,
+       0x02, 0x00, 0x06, 0x88, 0x13, 0x00, 0x00, 0x30,
+       0x4e, 0x00, 0x10, 0x00, 0x00, 0x20, 0x10, 0x24,
+       0x00, 0x00, 0xb0, 0x20, 0x00, 0x00, 0xb0, 0x28,
+       0x00, 0x00, 0xb0, 0x08, 0x02, 0x00, 0xb0, 0x00,
+       0x00, 0x00, 0x04, 0x30, 0x03, 0x00, 0x00, 0x58,
+       0x00, 0x00, 0x90, 0x70, 0xc3, 0x00, 0x00, 0x60,
+       0x00, 0x00, 0x90, 0x40, 0x01, 0x12, 0x08, 0x04,
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x14
+};
+

/***************************************************************************
***
 * Prototypes

****************************************************************************
**/
@@ -391,6 +515,7 @@
  char *devicename = NULL;
  const char *user;
  int timeout = 60; /* Wait for 60s before giving up */
+ int bcdrevision = 0xFFFF;

  /*
  * Security stuff
@@ -427,6 +552,8 @@
    sb = 1;
   else if (strcmp(argv[i],"-k")==0)
    signal_kernel = 1;
+  else if ((strcmp(argv[i], "-r") == 0) && i+1 < argc)
+   revision = atoi(argv[++i]);
   else if (strcmp(argv[i],"-m")==0)
    monitoring = 1;
   else if (strcmp(argv[i],"-s")==0)
@@ -469,7 +596,38 @@

  }

+ /* this will be set to 0xFFFF if -d devname was used or if there is a
problem */
+ bcdrevision = pusb_get_revision(fdusb);
+
+ /* have we been told what kind of modem this is with -r <n> or should we
use what we find */
+        if (revision == -1) {
+                if (bcdrevision == 0x0400) {
+                 revision = 4;
+  }
+  else {
+   if (bcdrevision == 0x0200) {
+    revision = 2;
+   }
+   else {
+    if (bcdrevision == 0x0000) {
+                          revision = 0;
+    }
+    else {
+     if (bcdrevision == 0xFFFF) {
+     report (0, REPORT_INFO, "Unable to determine Rev level of modem\n");
+     }
+     else {
+     report (0, REPORT_INFO, "Unexpected Rev %04x of modem
found\n",bcdrevision);
+     }
+     /* in case of doubt - default to speedtouch 330 Rev 2 */
+     revision = 2;
+    }
+   }
+  }
+        }
+
  report(1, REPORT_INFO, "Found ALCATEL SpeedTouch USB modem\n");
+ report(1, REPORT_INFO, "Rev %04x detected, revision %d
chosen\n",bcdrevision,revision);

  /*
   * we check that no one else is already using the modem,
@@ -549,7 +707,9 @@
    *
    * NB: Historically we used alternate 2 (before 2002-12-13)
    */
-  if (pusb_set_interface(fdusb, 1, 1) < 0) {
+  if (revision == 0)
+   alternate_ep = 2;
+  if (pusb_set_interface(fdusb,1,alternate_ep) < 0) {
    report(0, REPORT_ERROR, "pusb_set_interface");
    return(-1);
   }
@@ -573,7 +733,8 @@

  /* Cosmetic */
  get_reference(fdusb);
- test_sequence(fdusb);
+ if ((revision==0) || (revision==2))
+  test_sequence(fdusb);

  /* should start line sync */
  modem_start_synchro(fdusb);
@@ -592,6 +753,9 @@
  /* Reset the alarm signal - no races possible (see the USR2 signal
hanlder) */
  alarm(0);

+ /* if (revision==4) */
+ /* timed_out = 0; */
+
  if (timed_out) {
          report(0, REPORT_ERROR, "ADSL synchronization failed - timed
out\n");
  } else {
@@ -645,6 +809,7 @@
  fprintf(stderr, "  -d device    : defines the device to use\n");
  fprintf(stderr, "  -k           : using the kernel mode driver\n");
  fprintf(stderr, "  -t seconds   : synchronization timeout\n");
+ fprintf(stderr, "  -r revision  : use 0 for USB, 2 for 330, 4 for 330
Silver\n");
  fprintf(stderr, "  --help       : this message\n");
  exit(-1);

@@ -717,7 +882,12 @@

  /* URB 8 : both leds are static green */
  gettimeofday(&start,NULL);
- n = pusb_endpoint_write(ep_code,data1,sizeof(data1),DATA_TIMEOUT);
+ if (revision==4) {
+  n =
pusb_endpoint_write(ep_code,data1_400,sizeof(data1_400),DATA_TIMEOUT);
+ }
+ else {
+  n = pusb_endpoint_write(ep_code,data1,sizeof(data1),DATA_TIMEOUT);
+ }
  gettimeofday(&stop,NULL);

  if (n < 0) {
@@ -726,12 +896,22 @@
   return(n);
  }
  else {
-  report(1, REPORT_INFO, "BLOCK1 : %6d bytes   uploaded : OK\n",
sizeof(data1));
-  report(2, REPORT_DEBUG|REPORT_DUMP,"Downloaded in %f ms\n",
-         data1,
-         sizeof(data1),
-         (double)(stop.tv_sec -start.tv_sec) * 1000.0 +
-         (double)(stop.tv_usec - start.tv_usec) / 1000.0);
+  if (revision == 4) {
+   report(1, REPORT_INFO, "BLOCK1 : %6d bytes   uploaded : OK\n",
sizeof(data1_400));
+   report(2, REPORT_DEBUG|REPORT_DUMP,"Downloaded in %f ms\n",
+           data1_400,
+           sizeof(data1_400),
+           (double)(stop.tv_sec -start.tv_sec) * 1000.0 +
+           (double)(stop.tv_usec - start.tv_usec) / 1000.0);
+  }
+  else {
+   report(1, REPORT_INFO, "BLOCK1 : %6d bytes   uploaded : OK\n",
sizeof(data1));
+   report(2, REPORT_DEBUG|REPORT_DUMP,"Downloaded in %f ms\n",
+           data1,
+           sizeof(data1),
+           (double)(stop.tv_sec -start.tv_sec) * 1000.0 +
+           (double)(stop.tv_usec - start.tv_usec) / 1000.0);
+  }

  }

@@ -1078,13 +1258,16 @@
   memset(buf, 0, TOTAL + 1000);
   memset(prevbuf, 0, TOTAL);

-  while(1) {
+  while( !((revision==4) && up) ) {

    int ret;
    unsigned char lbuf[6];

    /* We can try reading the int endpoint */
-   ret = pusb_endpoint_read(ep_int, lbuf, sizeof(lbuf), 0);
+   if (revision==4)
+    ret = pusb_endpoint_read(ep_int, lbuf, sizeof(lbuf), SYNC_TIMEOUT);
+   else
+    ret = pusb_endpoint_read(ep_int, lbuf, sizeof(lbuf), 0);

    /* Ok we failed, perhaps the device has been disconnected  */
    if(ret < 0 && errno == ENODEV) {
@@ -1093,9 +1276,9 @@
    }

    /* Just a failure -- report the error and then wait in the waiting loop
*/
-   if(ret < 0)
-    report(0, REPORT_ERROR, "Error reading interrupts\n");
-
+   /*if(ret < 0) */
+   /* report(0, REPORT_ERROR, "Error reading interrupts\n");    */
+
    /*
     * Perhaps the reading is a success, in this case the buffer is 6 bytes
     * long and the content of the buffer is the line state as described
@@ -1141,6 +1324,8 @@
     get_state(fdusb, buf);

     if(memcmp(buf, prevbuf, TOTAL)) {
+
+     print_state(buf);

      /* Ok the line is UP */
      if(buf[OFFSET_7] == 0x20 && prevbuf[OFFSET_7] != 0x20) {
Index: src/pusb-bsd.c
===================================================================
RCS file: /cvsroot/speedtouch/speedtouch/src/pusb-bsd.c,v
retrieving revision 1.16
diff -u -r1.16 pusb-bsd.c
--- src/pusb-bsd.c 8 Aug 2003 18:07:26 -0000 1.16
+++ src/pusb-bsd.c 13 Feb 2004 08:16:33 -0000
@@ -19,7 +19,7 @@
 *  Author   : Richard Tobin
 *  Creation : May 2001
 *
-* $Id: pusb-bsd.c,v 1.16 2003/08/08 18:07:26 rogler Exp $
+* $Id$
 */

 #include <stdio.h>
@@ -87,6 +87,8 @@
 int pusb_get_interface(pusb_device_t dev, int interface);
 int pusb_get_configuration(pusb_device_t dev);

+static int udi_releaseNo_global = 0xFFFF;
+

/***************************************************************************
**
 * Library functions

****************************************************************************
*/
@@ -161,7 +163,8 @@
 #endif

    if(di.udi_vendorNo == vendorID && di.udi_productNo == productID)
-   { if(strncmp(di.udi_devnames[0], "ugen", 4) != 0)
+   { udi_releaseNo_global = di.udi_releaseNo;
+     if(strncmp(di.udi_devnames[0], "ugen", 4) != 0)
     {
       /* Has a real driver, don't mess with it */
      continue;
@@ -428,4 +431,11 @@
 int pusb_ioctl (pusb_device_t dev,int interface,int code,void *data)
 {
  return -ENOTTY;
+}
+
+int pusb_get_revision(pusb_device_t dev)
+{
+
+ return(udi_releaseNo_global);
+
 }
Index: src/pusb-linux.c
===================================================================
RCS file: /cvsroot/speedtouch/speedtouch/src/pusb-linux.c,v
retrieving revision 1.11
diff -u -r1.11 pusb-linux.c
--- src/pusb-linux.c 4 Jan 2004 22:44:25 -0000 1.11
+++ src/pusb-linux.c 13 Feb 2004 08:16:34 -0000
@@ -105,6 +105,10 @@
  * This variable is initialized each time make_device() is called, so we
are
  * sure it is initialized before it's used */
 static long pagesize = -1;
+/* Holds the bcdDevice for the current device
+ * This variable is initialized each time test_file() from usbfs_search()
from
+ * pusb_search_open() is called, so it is usually initialized before it's
used */
+static int bcdDevice_global = 0xFFFF;


/***************************************************************************
**
 * Library functions
@@ -422,6 +426,17 @@
  return(ioctl(dev->fd,USBDEVFS_IOCTL,&ctrl));
 }

+/*
+* Function     : pusb_get_revision
+* Return value : dev.bcdDevice
+* Description  : Returns revision as a bcd (for now)
+*/
+int pusb_get_revision(pusb_device_t dev)
+{
+
+ return(bcdDevice_global);
+
+}

/***************************************************************************
**
 * Local functions

****************************************************************************
*/
@@ -460,6 +475,7 @@
      fprintf(stderr, "  idProduct       = %04x\n",desc.idProduct);
      fprintf(stderr, "  bcdDevice       = %04x\n",desc.bcdDevice);
    */
+   bcdDevice_global = desc.bcdDevice;
    if( vendorID == desc.idVendor &&
     productID == desc.idProduct)
     return(fd);
Index: src/pusb.h
===================================================================
RCS file: /cvsroot/speedtouch/speedtouch/src/pusb.h,v
retrieving revision 1.4
diff -u -r1.4 pusb.h
--- src/pusb.h 31 Jan 2003 21:47:02 -0000 1.4
+++ src/pusb.h 13 Feb 2004 08:16:34 -0000
@@ -19,7 +19,7 @@
 *  Author   : Benoit PAPILLAULT <[EMAIL PROTECTED]>
 *  Creation : 29/05/2001
 *
-* $Id: pusb.h,v 1.4 2003/01/31 21:47:02 edgomez Exp $
+* $Id$
 */

 #ifndef PUSB_H
@@ -52,5 +52,6 @@
 int pusb_endpoint_write(pusb_endpoint_t ep,
    const unsigned char *buf, int size, int timeout);
 int pusb_endpoint_close(pusb_endpoint_t ep);
+int pusb_get_revision(pusb_device_t dev);

 #endif




Liste de diffusion modem ALCATEL SpeedTouch USB
Pour se désinscrire : mailto:[EMAIL PROTECTED]

        

Reply via email to