summaryrefslogtreecommitdiffabout
path: root/gammu/emb/common/device/serial
Unidiff
Diffstat (limited to 'gammu/emb/common/device/serial') (more/less context) (ignore whitespace changes)
-rw-r--r--gammu/emb/common/device/serial/ser_djg.c10
-rw-r--r--gammu/emb/common/device/serial/ser_unx.c38
-rw-r--r--gammu/emb/common/device/serial/ser_w32.c6
3 files changed, 43 insertions, 11 deletions
diff --git a/gammu/emb/common/device/serial/ser_djg.c b/gammu/emb/common/device/serial/ser_djg.c
index ac9d7c8..2524187 100644
--- a/gammu/emb/common/device/serial/ser_djg.c
+++ b/gammu/emb/common/device/serial/ser_djg.c
@@ -11,35 +11,35 @@ static GSM_Error serial_close(GSM_StateMachine *s)
11{ 11{
12 GSM_Device_SerialData *d = &s->Device.Data.Serial; 12 GSM_Device_SerialData *d = &s->Device.Data.Serial;
13 13
14 return ERR_NONE; 14 return ERR_NOTIMPLEMENTED;
15} 15}
16 16
17static GSM_Error serial_open (GSM_StateMachine *s) 17static GSM_Error serial_open (GSM_StateMachine *s)
18{ 18{
19 GSM_Device_SerialData *d = &s->Device.Data.Serial; 19 GSM_Device_SerialData *d = &s->Device.Data.Serial;
20 20
21 return ERR_NONE; 21 return ERR_NOTIMPLEMENTED;
22} 22}
23 23
24static GSM_Error serial_setparity(GSM_StateMachine *s, bool parity) 24static GSM_Error serial_setparity(GSM_StateMachine *s, bool parity)
25{ 25{
26 GSM_Device_SerialData *d = &s->Device.Data.Serial; 26 GSM_Device_SerialData *d = &s->Device.Data.Serial;
27 27
28 return ERR_NONE; 28 return ERR_NOTIMPLEMENTED;
29} 29}
30 30
31static GSM_Error serial_setdtrrts(GSM_StateMachine *s, bool dtr, bool rts) 31static GSM_Error serial_setdtrrts(GSM_StateMachine *s, bool dtr, bool rts)
32{ 32{
33 GSM_Device_SerialData *d = &s->Device.Data.Serial; 33 GSM_Device_SerialData *d = &s->Device.Data.Serial;
34 34
35 return ERR_NONE; 35 return ERR_NOTIMPLEMENTED;
36} 36}
37 37
38static GSM_Error serial_setspeed(GSM_StateMachine *s, int speed) 38static GSM_Error serial_setspeed(GSM_StateMachine *s, int speed)
39{ 39{
40 GSM_Device_SerialData *d = &s->Device.Data.Serial; 40 GSM_Device_SerialData *d = &s->Device.Data.Serial;
41 41
42 return ERR_NONE; 42 return ERR_NOTIMPLEMENTED;
43} 43}
44 44
45static int serial_read(GSM_StateMachine *s, void *buf, size_t nbytes) 45static int serial_read(GSM_StateMachine *s, void *buf, size_t nbytes)
diff --git a/gammu/emb/common/device/serial/ser_unx.c b/gammu/emb/common/device/serial/ser_unx.c
index 2a87b11..69c7515 100644
--- a/gammu/emb/common/device/serial/ser_unx.c
+++ b/gammu/emb/common/device/serial/ser_unx.c
@@ -1,5 +1,9 @@
1/* (c) 2002-2004 by Marcin Wiacek */ 1/* (c) 2002-2004 by Marcin Wiacek */
2/* locking device and settings all speeds by Michal Cihar */ 2/* locking device and settings all speeds by Michal Cihar */
3/* based on some work from Gnokii (www.gnokii.org)
4 * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot
5 * GNU GPL version 2 or later
6 */
3 7
4#include "../../gsmstate.h" 8#include "../../gsmstate.h"
5 9
@@ -16,6 +20,30 @@
16#include "../../gsmcomon.h" 20#include "../../gsmcomon.h"
17#include "ser_unx.h" 21#include "ser_unx.h"
18 22
23#ifndef O_NONBLOCK
24# define O_NONBLOCK 0
25#endif
26
27#ifdef __NetBSD__
28# define FNONBLOCK O_NONBLOCK
29
30# define B57600 0010001
31# define B115200 0010002
32# define B230400 0010003
33# define B460800 0010004
34# define B500000 0010005
35# define B576000 0010006
36# define B921600 0010007
37# define B1000000 0010010
38# define B1152000 0010011
39# define B1500000 0010012
40# define B2000000 0010013
41# define B2500000 0010014
42# define B3000000 0010015
43# define B3500000 0010016
44# define B4000000 0010017
45#endif
46
19static GSM_Error serial_close(GSM_StateMachine *s) 47static GSM_Error serial_close(GSM_StateMachine *s)
20{ 48{
21 GSM_Device_SerialData *d = &s->Device.Data.Serial; 49 GSM_Device_SerialData *d = &s->Device.Data.Serial;
@@ -29,10 +57,6 @@ static GSM_Error serial_close(GSM_StateMachine *s)
29 return ERR_NONE; 57 return ERR_NONE;
30} 58}
31 59
32#ifndef O_NONBLOCK
33# define O_NONBLOCK 0
34#endif
35
36static GSM_Error serial_open (GSM_StateMachine *s) 60static GSM_Error serial_open (GSM_StateMachine *s)
37{ 61{
38 GSM_Device_SerialData *d = &s->Device.Data.Serial; 62 GSM_Device_SerialData *d = &s->Device.Data.Serial;
@@ -177,7 +201,7 @@ static GSM_Error serial_setspeed(GSM_StateMachine *s, int speed)
177{ 201{
178 GSM_Device_SerialData *d = &s->Device.Data.Serial; 202 GSM_Device_SerialData *d = &s->Device.Data.Serial;
179 struct termios t; 203 struct termios t;
180 int speed2 = B19200; 204 int speed2 = B19200;
181 205
182 if (tcgetattr(d->hPhone, &t)) { 206 if (tcgetattr(d->hPhone, &t)) {
183 GSM_OSErrorInfo(s,"tcgetattr in serial_setspeed"); 207 GSM_OSErrorInfo(s,"tcgetattr in serial_setspeed");
@@ -202,10 +226,12 @@ static GSM_Error serial_setspeed(GSM_StateMachine *s, int speed)
202 case 9600: speed2 = B9600; break; 226 case 9600: speed2 = B9600; break;
203 case 19200: speed2 = B19200;break; 227 case 19200: speed2 = B19200;break;
204 case 38400: speed2 = B38400;break; 228 case 38400: speed2 = B38400;break;
229#ifdef B57600
205 case 57600: speed2 = B57600;break; 230 case 57600: speed2 = B57600;break;
206 case 115200: speed2 = B115200;break; 231 case 115200: speed2 = B115200;break;
207 case 230400: speed2 = B230400;break; 232 case 230400: speed2 = B230400;break;
208 case 460800: speed2 = B460800;break; 233 case 460800: speed2 = B460800;break;
234#ifdef B500000
209 case 500000: speed2 = B500000;break; 235 case 500000: speed2 = B500000;break;
210 case 576000: speed2 = B576000;break; 236 case 576000: speed2 = B576000;break;
211 case 921600: speed2 = B921600;break; 237 case 921600: speed2 = B921600;break;
@@ -217,6 +243,8 @@ static GSM_Error serial_setspeed(GSM_StateMachine *s, int speed)
217 case 3000000: speed2 = B3000000;break; 243 case 3000000: speed2 = B3000000;break;
218 case 3500000: speed2 = B3500000;break; 244 case 3500000: speed2 = B3500000;break;
219 case 4000000: speed2 = B4000000; break; 245 case 4000000: speed2 = B4000000; break;
246#endif
247#endif
220 } 248 }
221 249
222 /* This should work on all systems because it is done according to POSIX */ 250 /* This should work on all systems because it is done according to POSIX */
diff --git a/gammu/emb/common/device/serial/ser_w32.c b/gammu/emb/common/device/serial/ser_w32.c
index 9fa0135..7d88fc7 100644
--- a/gammu/emb/common/device/serial/ser_w32.c
+++ b/gammu/emb/common/device/serial/ser_w32.c
@@ -1,5 +1,9 @@
1/* (c) 2002-2004 by Marcin Wiacek */ 1/* (c) 2002-2004 by Marcin Wiacek */
2/* based on some work from Gnokii, MSDN and others */ 2/* based on some work from MSDN and others */
3/* based on some work from Gnokii (www.gnokii.org)
4 * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot
5 * GNU GPL version 2 or later
6 */
3 7
4#include "../../gsmstate.h" 8#include "../../gsmstate.h"
5 9