remove unused buffered mode stuff

git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@1555 7ae35d74-ebe9-4afe-98af-79ac388436b8
Hamlib-1.2.0
Stéphane Fillod, F8CFE 2003-10-01 19:44:00 +00:00
rodzic d62dfa3c37
commit 7ec6ee0b12
5 zmienionych plików z 23 dodań i 115 usunięć

Wyświetl plik

@ -2,7 +2,7 @@
* Hamlib Interface - generic file based io functions
* Copyright (c) 2000-2003 by Stephane Fillod and Frank Singleton
*
* $Id: iofunc.c,v 1.9 2003-08-20 07:22:40 fillods Exp $
* $Id: iofunc.c,v 1.10 2003-10-01 19:44:00 fillods Exp $
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
@ -195,77 +195,6 @@ int read_block(port_t *p, char *rxbuffer, size_t count)
return total_count; /* return bytes count read */
}
int fread_block(port_t *p, char *rxbuffer, size_t count)
{
fd_set rfds;
struct timeval tv, tv_timeout;
int rd_count, total_count = 0;
int retval;
int fd;
fd = fileno(p->stream);
FD_ZERO(&rfds);
FD_SET(fd, &rfds);
/*
* Wait up to timeout ms.
*/
tv_timeout.tv_sec = p->timeout/1000;
tv_timeout.tv_usec = (p->timeout%1000)*1000;
/*
* grab bytes from the rig
* The file descriptor must have been set up non blocking.
*/
rd_count = fread(rxbuffer, 1, count, p->stream);
if (rd_count < 0) {
rig_debug(RIG_DEBUG_ERR, "read_block: read failed - %s\n",
strerror(errno));
return -RIG_EIO;
}
total_count += rd_count;
count -= rd_count;
while (count > 0) {
tv = tv_timeout; /* select may have updated it */
retval = select(fd+1, &rfds, NULL, NULL, &tv);
if (retval == 0) {
dump_hex(rxbuffer, total_count);
#if 0
rig_debug(RIG_DEBUG_WARN, "fread_block: timedout after %d chars\n",
total_count);
#endif
return -RIG_ETIMEOUT;
}
if (retval < 0) {
dump_hex(rxbuffer, total_count);
rig_debug(RIG_DEBUG_ERR,"fread_block: select error after %d chars: "
"%s\n", total_count, strerror(errno));
return -RIG_EIO;
}
/*
* grab bytes from the rig
* The file descriptor must have been set up non blocking.
*/
rd_count = fread(rxbuffer+total_count, 1, count, p->stream);
if (rd_count < 0) {
dump_hex(rxbuffer, total_count);
rig_debug(RIG_DEBUG_ERR, "read_block: read failed - %s\n",
strerror(errno));
return -RIG_EIO;
}
total_count += rd_count;
count -= rd_count;
}
rig_debug(RIG_DEBUG_TRACE,"RX %d bytes\n",total_count);
dump_hex(rxbuffer, total_count);
return total_count; /* return bytes count read */
}
/*
* Read a string from "fd" and put result into

Wyświetl plik

@ -2,7 +2,7 @@
* Hamlib Interface - io function header
* Copyright (c) 2000,2001,2002 by Stephane Fillod and Frank Singleton
*
* $Id: iofunc.h,v 1.2 2002-03-10 23:41:39 fillods Exp $
* $Id: iofunc.h,v 1.3 2003-10-01 19:44:00 fillods Exp $
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
@ -28,7 +28,6 @@
extern HAMLIB_EXPORT(int) read_block(port_t *p, char *rxbuffer, size_t count);
extern HAMLIB_EXPORT(int) write_block(port_t *p, const char *txbuffer, size_t count);
extern HAMLIB_EXPORT(int) fread_block(port_t *p, char *rxbuffer, size_t count);
extern HAMLIB_EXPORT(int) read_string(port_t *p, char *rxbuffer, size_t rxmax, const char *stopset, int stopset_len);
#endif /* _IOFUNC_H */

Wyświetl plik

@ -2,7 +2,7 @@
* Hamlib Interface - main file
* Copyright (c) 2000-2003 by Stephane Fillod and Frank Singleton
*
* $Id: rig.c,v 1.76 2003-08-25 22:33:38 fillods Exp $
* $Id: rig.c,v 1.77 2003-10-01 19:44:00 fillods Exp $
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
@ -420,7 +420,6 @@ int rig_open(RIG *rig)
break;
case RIG_PORT_PARALLEL:
rs->rigport.stream = NULL;
status = par_open(&rs->rigport);
if (status < 0)
return status;
@ -607,22 +606,17 @@ int rig_close(RIG *rig)
rs->dcdport.fd = rs->pttport.fd = -1;
if (rs->rigport.fd != -1) {
if (rs->rigport.stream) {
fclose(rs->rigport.stream); /* this closes also fd */
} else {
switch(rs->rigport.type.rig) {
case RIG_PORT_SERIAL:
ser_close(&rs->rigport);
break;
case RIG_PORT_PARALLEL:
par_close(&rs->rigport);
break;
default:
close(rs->rigport.fd);
}
switch(rs->rigport.type.rig) {
case RIG_PORT_SERIAL:
ser_close(&rs->rigport);
break;
case RIG_PORT_PARALLEL:
par_close(&rs->rigport);
break;
default:
close(rs->rigport.fd);
}
rs->rigport.fd = -1;
rs->rigport.stream = NULL;
}
remove_opened_rig(rig);

Wyświetl plik

@ -2,7 +2,7 @@
* Hamlib Interface - main file
* Copyright (c) 2000-2002 by Stephane Fillod and Frank Singleton
*
* $Id: rotator.c,v 1.12 2003-08-25 22:33:38 fillods Exp $
* $Id: rotator.c,v 1.13 2003-10-01 19:44:00 fillods Exp $
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
@ -292,7 +292,6 @@ int rot_open(ROT *rot)
break;
case RIG_PORT_PARALLEL:
rs->rotport.stream = NULL;
status = par_open(&rs->rotport);
if (status < 0)
return status;
@ -373,22 +372,17 @@ int rot_close(ROT *rot)
if (rs->rotport.fd != -1) {
if (rs->rotport.stream != NULL) {
fclose(rs->rotport.stream); /* this closes also fd */
} else {
switch(rs->rotport.type.rig) {
case RIG_PORT_SERIAL:
ser_close(&rs->rotport);
break;
case RIG_PORT_PARALLEL:
par_close(&rs->rotport);
break;
default:
close(rs->rotport.fd);
}
switch(rs->rotport.type.rig) {
case RIG_PORT_SERIAL:
ser_close(&rs->rotport);
break;
case RIG_PORT_PARALLEL:
par_close(&rs->rotport);
break;
default:
close(rs->rotport.fd);
}
rs->rotport.fd = -1;
rs->rotport.stream = NULL;
}
remove_opened_rot(rot);

Wyświetl plik

@ -4,7 +4,7 @@
* Parts of the PTT handling are derived from soundmodem, an excellent
* ham packet softmodem written by Thomas Sailer, HB9JNX.
*
* $Id: serial.c,v 1.37 2003-09-28 15:34:44 fillods Exp $
* $Id: serial.c,v 1.38 2003-10-01 19:44:00 fillods Exp $
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
@ -146,14 +146,6 @@ int serial_open(port_t *rp) {
return err;
}
rp->stream = fdopen(fd, "r+b");
if (rp->stream == NULL) {
rig_debug(RIG_DEBUG_ERR, "open_serial: fdopen failed: %s\n",
strerror(errno));
CLOSE(fd);
return -RIG_EIO; /* arg, so close! */
}
return RIG_OK;
}