From 211ee6dc68921dc22ce113f41ba85a3ea3f4c869 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Fillod=2C=20F8CFE?= Date: Fri, 16 Apr 2004 20:04:11 +0000 Subject: [PATCH] export ser_set_dtr(), added ser_set_brk() git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@1718 7ae35d74-ebe9-4afe-98af-79ac388436b8 --- src/serial.c | 19 ++++++++++++++++--- src/serial.h | 5 +++-- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/serial.c b/src/serial.c index 65241be8b..51700af38 100644 --- a/src/serial.c +++ b/src/serial.c @@ -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.38 2003-10-01 19:44:00 fillods Exp $ + * $Id: serial.c,v 1.39 2004-04-16 20:04:11 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 @@ -464,7 +464,7 @@ int ser_set_rts(port_t *p, int state) y |= TIOCM_RTS; else y &= ~TIOCM_RTS; - return ioctl(p->fd, state ? TIOCMSET, &y); + return ioctl(p->fd, TIOCMSET, &y); #endif #endif } @@ -503,7 +503,7 @@ int ser_set_dtr(port_t *p, int state) y |= TIOCM_DTR; else y &= ~TIOCM_DTR; - return ioctl(p->fd, state ? TIOCMSET, &y); + return ioctl(p->fd, TIOCMSET, &y); #endif #endif } @@ -522,6 +522,19 @@ int ser_get_dtr(port_t *p, int *state) #endif } +int ser_set_brk(port_t *p, int state) +{ +#if defined(WIN32) + return !EscapeCommFunction(p->handle, state ? SETBREAK : CLRBREAK); +#else +#if defined(TIOCSBRK) && defined(TIOCCBRK) + return ioctl(p->fd, state ? TIOCSBRK : TIOCCBRK, 0 ); +#else + return -RIG_ENIMPL; +#endif +#endif +} + /* * assumes state not NULL * p is supposed to be &rig->state.rigport diff --git a/src/serial.h b/src/serial.h index e0e62ebe3..ea51a3f1c 100644 --- a/src/serial.h +++ b/src/serial.h @@ -2,7 +2,7 @@ * Hamlib Interface - serial communication header * Copyright (c) 2000-2002 by Stephane Fillod and Frank Singleton * - * $Id: serial.h,v 1.22 2003-09-28 15:34:44 fillods Exp $ + * $Id: serial.h,v 1.23 2004-04-16 20:04:11 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 @@ -40,7 +40,8 @@ int ser_ptt_get(port_t *p, ptt_t *pttx); int ser_dcd_get(port_t *p, dcd_t *dcdx); extern HAMLIB_EXPORT(int) ser_set_rts(port_t *p, int state); extern HAMLIB_EXPORT(int) ser_get_rts(port_t *p, int *state); -int ser_set_dtr(port_t *p, int state); +extern HAMLIB_EXPORT(int) ser_set_brk(port_t *p, int state); +extern HAMLIB_EXPORT(int) ser_set_dtr(port_t *p, int state); int ser_get_dtr(port_t *p, int *state); extern HAMLIB_EXPORT(int) ser_get_dcd(port_t *p, int *state); int par_open(port_t *p);