summaryrefslogtreecommitdiffabout
path: root/gammu/emb/common/device
Unidiff
Diffstat (limited to 'gammu/emb/common/device') (more/less context) (show whitespace changes)
-rw-r--r--gammu/emb/common/device/bluetoth/bluez.c29
-rw-r--r--gammu/emb/common/device/devfunc.c12
-rw-r--r--gammu/emb/common/device/irda/irda.c8
-rw-r--r--gammu/emb/common/device/irda/irda_unx.h2
-rw-r--r--gammu/emb/common/device/serial/ser_djg.c10
-rw-r--r--gammu/emb/common/device/serial/ser_unx.c36
-rw-r--r--gammu/emb/common/device/serial/ser_w32.c6
7 files changed, 78 insertions, 25 deletions
diff --git a/gammu/emb/common/device/bluetoth/bluez.c b/gammu/emb/common/device/bluetoth/bluez.c
index 8a4807e..e7e8adf 100644
--- a/gammu/emb/common/device/bluetoth/bluez.c
+++ b/gammu/emb/common/device/bluetoth/bluez.c
@@ -1,3 +1,12 @@
1/* Based on work by Marcel Holtmann and other authors of Bluez */ 1/* Based on some work from Bluez (www.bluez.org)
2 * (C) 2000-2001 Qualcomm Incorporated
3 * (C) 2002-2003 Maxim Krasnyansky <maxk@qualcomm.com>
4 * (C) 2002-2004 Marcel Holtmann <marcel@holtmann.org>
5 * GNU GPL version 2
6 */
7/* based on some Marcel Holtmann work from Gnokii (www.gnokii.org)
8 * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot
9 * GNU GPL version 2 or later
10 */
2 11
3#include "../../gsmstate.h" 12#include "../../gsmstate.h"
@@ -82,5 +91,5 @@ static void print_service_desc(void *value, void *user)
82 case SDP_UUID32: 91 case SDP_UUID32:
83 case SDP_UUID128: 92 case SDP_UUID128:
84 proto = 1;//sdp_uuid_to_proto(&p->val.uuid); 93 proto = sdp_uuid_to_proto(&p->val.uuid);
85 break; 94 break;
86 case SDP_UINT8: 95 case SDP_UINT8:
@@ -105,11 +114,11 @@ static GSM_Error bluetooth_checkdevice(GSM_StateMachine *s, bdaddr_t *bdaddr, st
105{ 114{
106 sdp_session_t *sess; 115 sdp_session_t *sess;
107 sdp_list_t *attrid, *search, *seq, *next, *proto = 0;
108 uint32_t range = 0x0000ffff;
109 char str[20];
110 sdp_record_t *rec; 116 sdp_record_t *rec;
117 sdp_list_t *attrid, *search, *seq, *next, *proto = 0;
111 sdp_data_t *d; 118 sdp_data_t *d;
112 bdaddr_t interface; 119 bdaddr_t interface;
120 uint32_t range = 0x0000ffff;
113 struct search_context subcontext; 121 struct search_context subcontext;
122 char str[20];
114 int channel,channel2; 123 int channel,channel2;
115 124
@@ -143,8 +152,8 @@ static GSM_Error bluetooth_checkdevice(GSM_StateMachine *s, bdaddr_t *bdaddr, st
143 d = sdp_data_get(rec,SDP_ATTR_SVCNAME_PRIMARY); 152 d = sdp_data_get(rec,SDP_ATTR_SVCNAME_PRIMARY);
144 153
145 if (false) { 154 if (sdp_get_access_protos(rec,&proto) == 0) {
146 channel = -1; 155 channel = -1;
147 sdp_list_foreach(proto,print_access_protos,&channel); 156 sdp_list_foreach(proto,print_access_protos,&channel);
148 //sdp_list_free(proto,(sdp_free_func_t)sdp_data_free); 157 sdp_list_free(proto,(sdp_free_func_t)sdp_data_free);
149 } 158 }
150 smprintf(s,"Channel %i",channel); 159 smprintf(s,"Channel %i",channel);
@@ -163,5 +172,5 @@ static GSM_Error bluetooth_checkdevice(GSM_StateMachine *s, bdaddr_t *bdaddr, st
163 next = seq->next; 172 next = seq->next;
164 free(seq); 173 free(seq);
165 //sdp_record_free(rec); 174 sdp_record_free(rec);
166 } 175 }
167 sdp_close(sess); 176 sdp_close(sess);
@@ -169,5 +178,5 @@ static GSM_Error bluetooth_checkdevice(GSM_StateMachine *s, bdaddr_t *bdaddr, st
169 if (channel2 != -1) return bluetooth_connect(s, channel2, str); 178 if (channel2 != -1) return bluetooth_connect(s, channel2, str);
170 179
171 return ERR_UNKNOWN; 180 return ERR_NOTSUPPORTED;
172} 181}
173 182
@@ -181,5 +190,5 @@ GSM_Error bluetooth_findchannel(GSM_StateMachine *s)
181 190
182 memset(&context, '\0', sizeof(struct search_context)); 191 memset(&context, '\0', sizeof(struct search_context));
183 //sdp_uuid16_create(&(context.group),PUBLIC_BROWSE_GROUP); 192 sdp_uuid16_create(&(context.group),PUBLIC_BROWSE_GROUP);
184 193
185 if (!strcmp(s->CurrentConfig->Device,"/dev/ttyS1")) { 194 if (!strcmp(s->CurrentConfig->Device,"/dev/ttyS1")) {
diff --git a/gammu/emb/common/device/devfunc.c b/gammu/emb/common/device/devfunc.c
index d31ebbf..c58a01f 100644
--- a/gammu/emb/common/device/devfunc.c
+++ b/gammu/emb/common/device/devfunc.c
@@ -1,2 +1,10 @@
1/* Some source from Gnokii (www.gnokii.org)
2 * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot
3 * GNU GPL version 2 or later
4 */
5/* Some source from Minicom (http://alioth.debian.org/projects/minicom)
6 * (C) 1991,1992,1993,1994,1995,1996 by Miquel van Smoorenburg
7 * GNU GPL version 2
8 */
1 9
2#include <string.h> 10#include <string.h>
@@ -106,5 +114,5 @@ bool unlock_device(char **lock_file)
106GSM_Error lock_device(const char* port, char **lock_device) 114GSM_Error lock_device(const char* port, char **lock_device)
107{ 115{
108#ifndef WIN32 116#if !defined(WIN32) && !defined(DJGPP)
109 char *lock_file = NULL; 117 char *lock_file = NULL;
110 char buffer[max_buf_len]; 118 char buffer[max_buf_len];
@@ -219,5 +227,5 @@ failed:
219bool unlock_device(char **lock_file) 227bool unlock_device(char **lock_file)
220{ 228{
221#ifndef WIN32 229#if !defined(WIN32) && !defined(DJGPP)
222 int err; 230 int err;
223 231
diff --git a/gammu/emb/common/device/irda/irda.c b/gammu/emb/common/device/irda/irda.c
index fef50ac..e680377 100644
--- a/gammu/emb/common/device/irda/irda.c
+++ b/gammu/emb/common/device/irda/irda.c
@@ -1,5 +1,9 @@
1/* (c) 2001-2004 by Marcin Wiacek */ 1/* (c) 2001-2004 by Marcin Wiacek */
2/* based on some work from Ralf Thelen and MyGnokii */ 2/* based on some work from Ralf Thelen and MyGnokii (www.mwiacek.com) */
3/* based on some work from Gnokii and MSDN */ 3/* based on some work from MSDN */
4/* based on some work from Gnokii (www.gnokii.org)
5 * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot
6 * GNU GPL version 2 or later
7 */
4 8
5/* You have to include wsock32.lib library to MS VC project to compile it */ 9/* You have to include wsock32.lib library to MS VC project to compile it */
diff --git a/gammu/emb/common/device/irda/irda_unx.h b/gammu/emb/common/device/irda/irda_unx.h
index 8dbcb97..7a55273 100644
--- a/gammu/emb/common/device/irda/irda_unx.h
+++ b/gammu/emb/common/device/irda/irda_unx.h
@@ -1,3 +1,3 @@
1/* part of irda.h available in Linux kernel source */ 1/* part of irda.h available in Linux kernel source (www.kernel.org) */
2 2
3/********************************************************************* 3/*********************************************************************
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
@@ -12,5 +12,5 @@ static GSM_Error serial_close(GSM_StateMachine *s)
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
@@ -19,5 +19,5 @@ static GSM_Error serial_open (GSM_StateMachine *s)
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
@@ -26,5 +26,5 @@ static GSM_Error serial_setparity(GSM_StateMachine *s, bool parity)
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
@@ -33,5 +33,5 @@ static GSM_Error serial_setdtrrts(GSM_StateMachine *s, bool dtr, bool rts)
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
@@ -40,5 +40,5 @@ static GSM_Error serial_setspeed(GSM_StateMachine *s, int speed)
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
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,4 +1,8 @@
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"
@@ -17,4 +21,28 @@
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{
@@ -30,8 +58,4 @@ static GSM_Error serial_close(GSM_StateMachine *s)
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{
@@ -203,8 +227,10 @@ static GSM_Error serial_setspeed(GSM_StateMachine *s, int speed)
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;
@@ -218,4 +244,6 @@ static GSM_Error serial_setspeed(GSM_StateMachine *s, int speed)
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
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,4 +1,8 @@
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"