7 A Linux/Unix toolset and driver for Nokia mobile phones.
9 Copyright (C) 1999, 2000 Hugh Blemings & Pavel JanÃk ml.
11 Released under the terms of the GNU GPL, see file COPYING for more details.
14 Revision 1.1.1.1 2001/11/25 21:58:58 short
15 :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Sun Nov 25 22:56 CET 2001
17 Revision 1.11 2001/09/14 12:15:28 pkot
18 Cleanups from 0.3.3 (part1)
20 Revision 1.10 2001/08/20 23:27:37 pkot
21 Add hardware shakehand to the link layer (Manfred Jonsson)
23 Revision 1.9 2001/06/28 00:28:45 pkot
24 Small docs updates (Pawel Kot)
26 Revision 1.8 2001/02/21 19:56:55 chris
27 More fiddling with the directory layout
29 Revision 1.7 2001/02/09 18:12:53 chris
30 Marcel's tekram support
32 Revision 1.6 2001/02/03 23:56:12 chris
33 Start of work on irda support (now we just need fbus-irda.c!)
34 Proper unicode support in 7110 code (from pkot)
41 #include "devices/unixserial.h"
42 #include "devices/unixirda.h"
43 #include "devices/tekram.h"
47 * Structure to store the filedescriptor we use.
51 int device_portfd = -1;
53 /* The device type to use */
55 GSM_ConnectionType devicetype;
57 int device_getfd(void) {
62 int device_open(__const char *__file, int __with_odd_parity, int __with_async, int __with_hw_handshake, GSM_ConnectionType device_type)
64 devicetype = device_type;
69 device_portfd = serial_opendevice(__file, __with_odd_parity, __with_async, __with_hw_handshake);
72 device_portfd = tekram_open(__file);
75 device_portfd = irda_open();
80 return (device_portfd >= 0);
83 void device_close(void)
88 serial_close(device_portfd);
91 tekram_close(device_portfd);
94 irda_close(device_portfd);
101 void device_reset(void)
105 void device_setdtrrts(int __dtr, int __rts)
107 switch (devicetype) {
110 serial_setdtrrts(device_portfd, __dtr, __rts);
121 void device_changespeed(int __speed)
123 switch (devicetype) {
126 serial_changespeed(device_portfd, __speed);
129 tekram_changespeed(device_portfd, __speed);
138 size_t device_read(__ptr_t __buf, size_t __nbytes)
140 switch (devicetype) {
143 return (serial_read(device_portfd, __buf, __nbytes));
146 return (tekram_read(device_portfd, __buf, __nbytes));
149 return irda_read(device_portfd, __buf, __nbytes);
157 size_t device_write(__const __ptr_t __buf, size_t __n)
159 switch (devicetype) {
162 return (serial_write(device_portfd, __buf, __n));
165 return (tekram_write(device_portfd, __buf, __n));
168 return irda_write(device_portfd, __buf, __n);
176 int device_select(struct timeval *timeout)
178 switch (devicetype) {
181 return serial_select(device_portfd, timeout);
184 return tekram_select(device_portfd, timeout);
187 return irda_select(device_portfd, timeout);