1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
Index: bluezapplet.cpp
===================================================================
RCS file: /cvs/opie/noncore/net/opietooth/applet/bluezapplet.cpp,v
retrieving revision 1.20
diff -u -r1.20 bluezapplet.cpp
--- applet/bluezapplet.cpp 29 Aug 2005 21:27:26 -0000 1.20
+++ applet/bluezapplet.cpp 5 Jul 2006 22:21:22 -0000
@@ -49,6 +49,8 @@
#include <qstring.h>
#include <qtimer.h>
#include <qpopupmenu.h>
+#include <qfile.h>
+#include <qtextstream.h>
/* STD */
#include <device.h>
@@ -103,18 +105,41 @@
int BluezApplet::setBluezStatus(int c) {
if ( c == 1 ) {
- switch ( ODevice::inst()->model() ) {
- case Model_iPAQ_H39xx:
- btDevice = new Device( "/dev/tts/1", "bcsp", "921600" );
- break;
-
- case Model_iPAQ_H5xxx:
- btDevice = new Device( "/dev/tts/1", "any", "921600" );
- break;
-
- default:
- btDevice = new Device( "/dev/ttySB0", "bcsp", "230400" );
- break;
+ QFile cfg("/etc/sysconfig/bluetooth");
+ if(cfg.open(IO_ReadOnly)) {
+ QTextStream stream (&cfg);
+ QString streamIn = stream.read();
+ QStringList list = QStringList::split("\n", streamIn);
+ cfg.close();
+ if(list.grep("BLUETOOTH_PORT=").count() > 0 &&
+ list.grep("BLUETOOTH_PROTOCOL=").count() > 0 &&
+ list.grep("BLUETOOTH_SPEED=").count() > 0) {
+ btDevice = new Device( list.grep("BLUETOOTH_PORT=")[0].
+ replace((QString)"BLUETOOTH_PORT=", ""),
+ list.grep("BLUETOOTH_PROTOCOL=")[0].
+ replace((QString)"BLUETOOTH_PROTOCOL=", ""),
+ list.grep("BLUETOOTH_SPEED=")[0].
+ replace((QString)"BLUETOOTH_SPEED=", ""));
+ }
+ }
+ if(!btDevice) {
+ switch ( ODevice::inst()->model() ) {
+ case Model_iPAQ_H39xx:
+ btDevice = new Device( "/dev/tts/1", "bcsp", "921600" );
+ break;
+
+ case Model_iPAQ_H5xxx:
+ btDevice = new Device( "/dev/tts/1", "any", "921600" );
+ break;
+
+ case Model_iPAQ_H22xx:
+ btDevice = new Device( "/dev/tts/3", "any", "921600" );
+ break;
+
+ default:
+ btDevice = new Device( "/dev/ttySB0", "bcsp", "230400" );
+ break;
+ }
}
} else {
if ( btDevice ) {
|