sim-card
/
sam7-util
Archived
9
0
Fork 0

posix: Remove the io_read_response implementation as it is unused

master
Holger Hans Peter Freyther 11 years ago
parent 861a0b11aa
commit e5c0adc53e
  1. 1
      io.h
  2. 49
      io_posix.c

@ -24,7 +24,6 @@ int io_init( char *dev );
int io_cleanup( void );
int io_write( void *buff, int len );
int io_read( void *buff, int len );
int io_read_response( char *buff, int len );
static inline int io_send_cmd( char *cmd, void *response, int response_len )

@ -98,52 +98,3 @@ int io_read( void *buff, int len )
#endif
}
#if 0
int io_read_response( char *buff, int len )
{
int read_len = 0;
struct timeval tv;
fd_set fds;
int ret;
while( read_len < len ) {
tv.tv_sec = 1;
tv.tv_usec = 0;
FD_ZERO( &fds );
FD_SET( io_fd, &fds );
if( (ret = select( io_fd + 1, &fds, NULL, NULL, &tv )) < 0 ) {
if( errno == EINTR ) {
continue;
}
}
if( ret == 0 ) {
buff[read_len] = '\0';
printf( "timeout '%s'\n", buff);
return -read_len;
}
if( (ret = read( io_fd, buff + read_len, len - read_len )) < 0 ) {
return -1;
}
read_len += ret;
if( (read_len > 0) &&
buff[ read_len - 1 ] == '>' ) {
if( (read_len > 2) &&
buff[ read_len - 2 ] == '\r' &&
buff[ read_len - 3 ] == '\n' ) {
return buff[read_len - 3] = '\0' ;
return read_len-3 ;
} else {
return buff[read_len - 1] = '\0' ;
return read_len-1 ;
}
}
}
return read_len;
}
#endif