Diffstat (limited to 'gammu/emb/common/device/serial') (more/less context) (show whitespace changes)
-rw-r--r-- | gammu/emb/common/device/serial/ser_djg.c | 10 | ||||
-rw-r--r-- | gammu/emb/common/device/serial/ser_unx.c | 36 | ||||
-rw-r--r-- | gammu/emb/common/device/serial/ser_w32.c | 6 |
3 files changed, 42 insertions, 10 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 | |||
@@ -8,41 +8,41 @@ | |||
8 | #include "ser_djg.h" | 8 | #include "ser_djg.h" |
9 | 9 | ||
10 | static GSM_Error serial_close(GSM_StateMachine *s) | 10 | 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 | ||
17 | static GSM_Error serial_open (GSM_StateMachine *s) | 17 | static 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 | ||
24 | static GSM_Error serial_setparity(GSM_StateMachine *s, bool parity) | 24 | static 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 | ||
31 | static GSM_Error serial_setdtrrts(GSM_StateMachine *s, bool dtr, bool rts) | 31 | static 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 | ||
38 | static GSM_Error serial_setspeed(GSM_StateMachine *s, int speed) | 38 | static 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 | ||
45 | static int serial_read(GSM_StateMachine *s, void *buf, size_t nbytes) | 45 | static int serial_read(GSM_StateMachine *s, void *buf, size_t nbytes) |
46 | { | 46 | { |
47 | GSM_Device_SerialData *d = &s->Device.Data.Serial; | 47 | GSM_Device_SerialData *d = &s->Device.Data.Serial; |
48 | 48 | ||
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,8 +1,12 @@ | |||
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 | ||
6 | #ifdef GSM_ENABLE_SERIALDEVICE | 10 | #ifdef GSM_ENABLE_SERIALDEVICE |
7 | #ifndef WIN32 | 11 | #ifndef WIN32 |
8 | #ifndef DJGPP | 12 | #ifndef DJGPP |
@@ -13,12 +17,36 @@ | |||
13 | #include <termios.h> | 17 | #include <termios.h> |
14 | #include <errno.h> | 18 | #include <errno.h> |
15 | 19 | ||
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 | |||
19 | static GSM_Error serial_close(GSM_StateMachine *s) | 47 | static 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; |
22 | 50 | ||
23 | /* Restores old settings */ | 51 | /* Restores old settings */ |
24 | tcsetattr(d->hPhone, TCSANOW, &d->old_settings); | 52 | tcsetattr(d->hPhone, TCSANOW, &d->old_settings); |
@@ -26,16 +54,12 @@ static GSM_Error serial_close(GSM_StateMachine *s) | |||
26 | /* Closes device */ | 54 | /* Closes device */ |
27 | close(d->hPhone); | 55 | close(d->hPhone); |
28 | 56 | ||
29 | return ERR_NONE; | 57 | return ERR_NONE; |
30 | } | 58 | } |
31 | 59 | ||
32 | #ifndef O_NONBLOCK | ||
33 | # define O_NONBLOCK 0 | ||
34 | #endif | ||
35 | |||
36 | static GSM_Error serial_open (GSM_StateMachine *s) | 60 | static 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; |
39 | struct termios t; | 63 | struct termios t; |
40 | int i; | 64 | int i; |
41 | 65 | ||
@@ -199,27 +223,31 @@ static GSM_Error serial_setspeed(GSM_StateMachine *s, int speed) | |||
199 | case 1800: speed2 = B1800; break; | 223 | case 1800: speed2 = B1800; break; |
200 | case 2400: speed2 = B2400; break; | 224 | case 2400: speed2 = B2400; break; |
201 | case 4800: speed2 = B4800; break; | 225 | case 4800: speed2 = B4800; break; |
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; |
212 | case 1000000: speed2 = B1000000;break; | 238 | case 1000000: speed2 = B1000000;break; |
213 | case 1152000: speed2 = B1152000;break; | 239 | case 1152000: speed2 = B1152000;break; |
214 | case 1500000: speed2 = B1500000;break; | 240 | case 1500000: speed2 = B1500000;break; |
215 | case 2000000: speed2 = B2000000;break; | 241 | case 2000000: speed2 = B2000000;break; |
216 | case 2500000: speed2 = B2500000;break; | 242 | case 2500000: speed2 = B2500000;break; |
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 */ |
223 | cfsetispeed(&t, speed2); | 251 | cfsetispeed(&t, speed2); |
224 | cfsetospeed(&t, speed2); | 252 | cfsetospeed(&t, speed2); |
225 | 253 | ||
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,8 +1,12 @@ | |||
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 | ||
6 | #ifdef GSM_ENABLE_SERIALDEVICE | 10 | #ifdef GSM_ENABLE_SERIALDEVICE |
7 | #ifdef WIN32 | 11 | #ifdef WIN32 |
8 | 12 | ||