Add some debug for timing in serial.c

pull/224/head
Michael Black 2020-03-15 09:52:05 -05:00
rodzic 39ba535c77
commit 4e606a054f
1 zmienionych plików z 15 dodań i 1 usunięć

Wyświetl plik

@ -196,8 +196,9 @@ int HAMLIB_API serial_open(hamlib_port_t *rp)
/*
* Open in Non-blocking mode. Watch for EAGAIN errors!
*/
rig_debug(RIG_DEBUG_TRACE,"%s: OPEN before\n", __func__);
fd = OPEN(rp->pathname, O_RDWR | O_NOCTTY | O_NDELAY);
rig_debug(RIG_DEBUG_TRACE,"%s: OPEN after\n", __func__);
if (fd == -1)
{
/* Could not open the port. */
@ -211,7 +212,9 @@ int HAMLIB_API serial_open(hamlib_port_t *rp)
rp->fd = fd;
rig_debug(RIG_DEBUG_TRACE,"%s: serial_setup before\n", __func__);
err = serial_setup(rp);
rig_debug(RIG_DEBUG_TRACE,"%s: serial_setup after\n", __func__);
if (err != RIG_OK)
{
@ -219,7 +222,9 @@ int HAMLIB_API serial_open(hamlib_port_t *rp)
return err;
}
rig_debug(RIG_DEBUG_TRACE,"%s: serial_flush before\n", __func__);
serial_flush(rp); // ensure nothing is there when we open
rig_debug(RIG_DEBUG_TRACE,"%s: serial_flush before\n", __func__);
return RIG_OK;
}
@ -259,18 +264,22 @@ int HAMLIB_API serial_setup(hamlib_port_t *rp)
* Get the current options for the port...
*/
#if defined(HAVE_TERMIOS_H)
rig_debug(RIG_DEBUG_TRACE,"%s: tcgetattr\n", __func__);
tcgetattr(fd, &options);
memcpy(&orig_options, &options, sizeof(orig_options));
#elif defined(HAVE_TERMIO_H)
rig_debug(RIG_DEBUG_TRACE,"%s: IOCTL TCGETA\n", __func__);
IOCTL(fd, TCGETA, &options);
memcpy(&orig_options, &options, sizeof(orig_options));
#else /* sgtty */
rig_debug(RIG_DEBUG_TRACE,"%s: IOCTL TIOCGETP\n", __func__);
IOCTL(fd, TIOCGETP, &sg);
memcpy(&orig_sg, &sg, sizeof(orig_sg));
#endif
#ifdef HAVE_CFMAKERAW
/* Set serial port to RAW mode by default. */
rig_debug(RIG_DEBUG_TRACE,"%s: cfmakeraw\n", __func__);
cfmakeraw(&options);
#endif
@ -334,7 +343,9 @@ int HAMLIB_API serial_setup(hamlib_port_t *rp)
}
/* TODO */
rig_debug(RIG_DEBUG_TRACE,"%s: cfsetispeed\n", __func__);
cfsetispeed(&options, speed);
rig_debug(RIG_DEBUG_TRACE,"%s: cfsetospeed\n", __func__);
cfsetospeed(&options, speed);
/*
@ -507,6 +518,7 @@ int HAMLIB_API serial_setup(hamlib_port_t *rp)
*/
#if defined(HAVE_TERMIOS_H)
rig_debug(RIG_DEBUG_TRACE,"%s: tcsetattr TCSANOW\n", __func__);
if (tcsetattr(fd, TCSANOW, &options) == -1)
{
rig_debug(RIG_DEBUG_ERR,
@ -520,6 +532,7 @@ int HAMLIB_API serial_setup(hamlib_port_t *rp)
#elif defined(HAVE_TERMIO_H)
rig_debug(RIG_DEBUG_TRACE,"%s: IOCTL TCSETA\n", __func__);
if (IOCTL(fd, TCSETA, &options) == -1)
{
rig_debug(RIG_DEBUG_ERR,
@ -533,6 +546,7 @@ int HAMLIB_API serial_setup(hamlib_port_t *rp)
#else
rig_debug(RIG_DEBUG_TRACE,"%s: IOCTL TIOCSETP\n", __func__);
/* sgtty */
if (IOCTL(fd, TIOCSETP, &sg) == -1)
{