At least one person here was getting a hang when they were doing large
transfers with pppoa3.
I might have found a way of avoiding this but I need someone to test for
me. (I don't know what effect this might have on performance but I would
be interested to know if it fixes the problems. (I was getting hangs if I
enabled logging and it has fixed that)
This change is messy, untidy, and probably not the best way to do it but I
would be interested to hear of any successes or failures.
Tim.
--- pppoa3.orig/pusb-linux.c Thu Aug 16 23:50:27 2001
+++ pppoa3/pusb-linux.c Sun Sep 9 00:37:54 2001
@@ -306,17 +306,38 @@
if (ret < 0)
return ret;
-/*if (purb != &urb)
- printf("purb=%p, &urb=%p\n",purb,&urb);
-*/
-
-/* if (purb->buffer != buf)
- printf("purb->buffer=%p, buf=%p\n",purb->buffer,buf);
-*/
-
return purb->actual_length;
}
+int pusb_endpoint_read_timeout(int fd,int ep,const unsigned char * buf,int size,int
+timeout)
+{
+ struct usbdevfs_bulktransfer bulk;
+ int ret, received = 0;
+
+ bulk.ep = ep;
+ bulk.len = size;
+ if (bulk.len > PAGE_SIZE)
+ bulk.len = PAGE_SIZE;
+ bulk.timeout = timeout;
+ bulk.data = (unsigned char*)buf;
+
+ do
+ {
+ ret = ioctl(fd,USBDEVFS_BULK,&bulk);
+ }
+ while (ret < 0 && errno == EINTR);
+
+ if (ret < 0)
+ return ret;
+
+ buf += ret;
+ size -= ret;
+
+ received += ret;
+
+ return received;
+}
+
int pusb_endpoint_rw(int fd,int ep,const unsigned char * buf,int size,int timeout)
{
struct usbdevfs_bulktransfer bulk;
@@ -362,7 +383,8 @@
unsigned char *buf, int size, int timeout)
{
if (timeout == 0)
- return pusb_endpoint_rw_no_timeout(ep->fd,ep->ep|USB_DIR_IN,buf,size);
+ return pusb_endpoint_read_timeout(ep->fd,ep->ep|USB_DIR_IN,buf,size,30000);
+/* return
+pusb_endpoint_rw_no_timeout(ep->fd,ep->ep|USB_DIR_IN,buf,size);*/
return pusb_endpoint_rw(ep->fd,ep->ep|USB_DIR_IN,buf,size,timeout);
}
--- pppoa3.orig/pppoa3.c Sun Sep 9 00:51:47 2001
+++ pppoa3/pppoa3.c Sun Sep 9 00:53:58 2001
@@ -451,12 +451,14 @@
unsigned char *unused_cells;
/* Reads 64*53 bytes from usb */
- n = pusb_endpoint_read(ep_data, lbuf, sizeof(lbuf), 0);
+ do {
+ n = pusb_endpoint_read(ep_data, lbuf, sizeof(lbuf), 0);
- if(n < 0) {
- report(0, REPORT_DATE|REPORT_PERROR, "Error reading usb
urb\n");
- break;
- }
+/* if(n < 0) {
+ report(0, REPORT_PERROR, "Error reading usb urb (timeout?)\n");
+ }
+*/
+ } while(n<0);
/* Debug information */
report(2, REPORT_DATE|REPORT_DUMP, "ATM cells read from USB (%d bytes
long)\n", lbuf, n, n);
--
God said, "div D = rho, div B = 0, curl E = - @B/@t, curl H = J + @D/@t,"
and there was light.
http://locofungus.2y.net/ http://www.locofungus.btinternet.co.uk/
Liste de diffusion modem ALCATEL SpeedTouch USB
Pour se d�sinscrire : mailto:[EMAIL PROTECTED]?subject=unsubscribe