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