summaryrefslogtreecommitdiffabout
path: root/gammu/emb/common/device/serial/ser_unx.c
Side-by-side diff
Diffstat (limited to 'gammu/emb/common/device/serial/ser_unx.c') (more/less context) (ignore whitespace changes)
-rw-r--r--gammu/emb/common/device/serial/ser_unx.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/gammu/emb/common/device/serial/ser_unx.c b/gammu/emb/common/device/serial/ser_unx.c
index 69c7515..18b5f6f 100644
--- a/gammu/emb/common/device/serial/ser_unx.c
+++ b/gammu/emb/common/device/serial/ser_unx.c
@@ -1,12 +1,21 @@
/* (c) 2002-2004 by Marcin Wiacek */
/* locking device and settings all speeds by Michal Cihar */
/* based on some work from Gnokii (www.gnokii.org)
* (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot
* GNU GPL version 2 or later
*/
+/* Due to a problem in the source code management, the names of some of
+ * the authors have unfortunately been lost. We do not mean to belittle
+ * their efforts and hope they will contact us to see their names
+ * properly added to the Copyright notice above.
+ * Having published their contributions under the terms of the GNU
+ * General Public License (GPL) [version 2], the Copyright of these
+ * authors will remain respected by adhering to the license they chose
+ * to publish their code under.
+ */
#include "../../gsmstate.h"
#ifdef GSM_ENABLE_SERIALDEVICE
#ifndef WIN32
#ifndef DJGPP
@@ -57,14 +66,14 @@ static GSM_Error serial_close(GSM_StateMachine *s)
return ERR_NONE;
}
static GSM_Error serial_open (GSM_StateMachine *s)
{
GSM_Device_SerialData *d = &s->Device.Data.Serial;
- struct termios t;
- int i;
+ struct termios t;
+ int i;
/* O_NONBLOCK MUST is required to avoid waiting for DCD */
d->hPhone = open(s->CurrentConfig->Device, O_RDWR | O_NOCTTY | O_NONBLOCK);
if (d->hPhone < 0) {
i = errno;
GSM_OSErrorInfo(s,"open in serial_open");
@@ -121,13 +130,13 @@ static GSM_Error serial_open (GSM_StateMachine *s)
return ERR_NONE;
}
static GSM_Error serial_setparity(GSM_StateMachine *s, bool parity)
{
GSM_Device_SerialData *d = &s->Device.Data.Serial;
- struct termios t;
+ struct termios t;
if (tcgetattr(d->hPhone, &t)) {
GSM_OSErrorInfo(s,"tcgetattr in serial_setparity");
return ERR_DEVICEREADERROR;
}
@@ -147,14 +156,14 @@ static GSM_Error serial_setparity(GSM_StateMachine *s, bool parity)
return ERR_NONE;
}
static GSM_Error serial_setdtrrts(GSM_StateMachine *s, bool dtr, bool rts)
{
GSM_Device_SerialData *d = &s->Device.Data.Serial;
- struct termios t;
- unsigned int flags;
+ struct termios t;
+ unsigned int flags;
if (tcgetattr(d->hPhone, &t)) {
GSM_OSErrorInfo(s,"tcgetattr in serial_setdtrrts");
return ERR_DEVICEREADERROR;
}
@@ -261,14 +270,14 @@ static GSM_Error serial_setspeed(GSM_StateMachine *s, int speed)
}
static int serial_read(GSM_StateMachine *s, void *buf, size_t nbytes)
{
GSM_Device_SerialData *d = &s->Device.Data.Serial;
struct timeval timeout2;
- fd_set readfds;
- int actual = 0;
+ fd_set readfds;
+ int actual = 0;
FD_ZERO(&readfds);
FD_SET(d->hPhone, &readfds);
timeout2.tv_sec = 0;
timeout2.tv_usec = 1;
@@ -280,14 +289,14 @@ static int serial_read(GSM_StateMachine *s, void *buf, size_t nbytes)
return actual;
}
static int serial_write(GSM_StateMachine *s, void *buf, size_t nbytes)
{
GSM_Device_SerialData *d = &s->Device.Data.Serial;
- int ret;
- size_t actual = 0;
+ int ret;
+ size_t actual = 0;
do {
ret = write(d->hPhone, (unsigned char *)buf, nbytes - actual);
if (ret < 0 && errno == EAGAIN) continue;
if (ret < 0) {
if (actual != nbytes) GSM_OSErrorInfo(s,"serial_write");