From: Michael Gernoth Date: Sun, 6 Jun 2010 19:03:42 +0000 (+0200) Subject: increase USB timeout X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/rigol/commitdiff_plain/165abe625501e7c16934e33e15128eff9a2ad981?ds=sidebyside increase USB timeout --- diff --git a/usbtmc.c b/usbtmc.c index 8a35dd3..0249e25 100644 --- a/usbtmc.c +++ b/usbtmc.c @@ -6,6 +6,8 @@ #include "usbtmc.h" +#define USB_TIMEOUT 10000 + //Helper-routine: Convert a little-endian 4-byte word to an int static void int2chars(unsigned char *buff,unsigned int a) { buff[3]=(a>>24)&0xff; @@ -64,10 +66,10 @@ int usbtmc_sendscpi(usb_dev_handle *dev, char* cmd, buff[11]=0x39; //fprintf(stderr,"Writing header len=%d\n", cmdlen); //printb(buff,12); - r=usb_bulk_write(dev, 1, (char*)buff, 12, 1000); + r=usb_bulk_write(dev, 1, (char*)buff, 12, USB_TIMEOUT); //fprintf(stderr,"%i bytes written. Writing cmd\n",r); //printb(cmd, cmdlen); - r=usb_bulk_write(dev, 1, cmd, cmdlen, 1000); + r=usb_bulk_write(dev, 1, cmd, cmdlen, USB_TIMEOUT); //fprintf(stderr,"%i bytes written.\n",r); if (resp != NULL && resplen != 0) { //send read command @@ -81,9 +83,9 @@ int usbtmc_sendscpi(usb_dev_handle *dev, char* cmd, buff[11]=0; //fprintf(stderr,"Writing resp req header\n"); //printb(buff,12); - r=usb_bulk_write(dev, 1, (char*)buff, 12, 1000); + r=usb_bulk_write(dev, 1, (char*)buff, 12, USB_TIMEOUT); //fprintf(stderr,"%i bytes written. Reading response hdr\n",r); - r=usb_bulk_read(dev, 2, (char*)buff, 0x40, 1000); + r=usb_bulk_read(dev, 2, (char*)buff, 0x40, USB_TIMEOUT); //printb(buff,r); len=chars2int(buff+4); //fprintf(stderr,"%i bytes read. Resplen=%i\n",r,len); @@ -94,7 +96,7 @@ int usbtmc_sendscpi(usb_dev_handle *dev, char* cmd, if (len > 0x40-12) { //fprintf(stderr," Reading response:\n"); if (resplen