/[uisp]/uisp/src/Serial.C
ViewVC logotype

Diff of /uisp/src/Serial.C

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by troth, Thu Apr 17 04:59:29 2003 UTC revision 1.5 by troth, Sat May 10 21:01:44 2003 UTC
# Line 39  Line 39 
39  #include <unistd.h>  #include <unistd.h>
40  #include <fcntl.h>  #include <fcntl.h>
41  #include <ctype.h>  #include <ctype.h>
42    #include <errno.h>
43  #include "Global.h"  #include "Global.h"
44  #include "Serial.h"  #include "Serial.h"
45    
# Line 56  int TSerial::Rx(unsigned char* queue, in Line 57  int TSerial::Rx(unsigned char* queue, in
57    int ret;    int ret;
58    fd_set rfds;    fd_set rfds;
59    FD_ZERO(&rfds); FD_SET(serline,&rfds);    FD_ZERO(&rfds); FD_SET(serline,&rfds);
60    if ((ret=select(getdtablesize(),&rfds,NULL,NULL, timeout))==-1){  
61      throw Error_C("Select failed");    int tries = 5;
62      while (1) {
63        if ((ret=select(serline+1, &rfds, NULL, NULL, timeout))==-1) {
64          Info(3, "Select on %d returned retval:%d errno:%d\n",
65               serline, ret, errno);
66          if ((errno == EINTR) && tries) {
67            tries--;
68            continue;
69          }
70          throw Error_C("Select failed");
71        }
72    
73        // Success.
74        break;
75    }    }
76    
77    if (ret==0){throw Error_Device("Programmer is not responding.");}    if (ret==0){throw Error_Device("Programmer is not responding.");}
78    int size = read(serline, queue, queue_size);      int size = read(serline, queue, queue_size);  
79    Info(4, "Receive: { ");    Info(4, "Receive: { ");

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26