author | erik <erik> | 2007-03-06 01:24:35 (UTC) |
---|---|---|
committer | erik <erik> | 2007-03-06 01:24:35 (UTC) |
commit | 3efe70df6fdaf32a8213ceadbdd1679a0a658934 (patch) (unidiff) | |
tree | f5f2459bd9435602d43438ae4aca39d9f51927ea | |
parent | 6b0fa616c4aac654c549621eb0009ab3eb32fe34 (diff) | |
download | opie-3efe70df6fdaf32a8213ceadbdd1679a0a658934.zip opie-3efe70df6fdaf32a8213ceadbdd1679a0a658934.tar.gz opie-3efe70df6fdaf32a8213ceadbdd1679a0a658934.tar.bz2 |
Bluetooth didn't quite work for kernel 2.6 based iPAQs in familiar. This
patch fixes that by reading the distro supplied file in /etc/sysconfig.
This patch was submitted by Slavek Banko. Thank you Slavek!
-rw-r--r-- | noncore/net/opietooth/applet/bluezapplet.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/noncore/net/opietooth/applet/bluezapplet.cpp b/noncore/net/opietooth/applet/bluezapplet.cpp index 787abc6..60fa4f8 100644 --- a/noncore/net/opietooth/applet/bluezapplet.cpp +++ b/noncore/net/opietooth/applet/bluezapplet.cpp | |||
@@ -47,16 +47,18 @@ using namespace Opie::Core; | |||
47 | #include <qpainter.h> | 47 | #include <qpainter.h> |
48 | #include <qlayout.h> | 48 | #include <qlayout.h> |
49 | #include <qframe.h> | 49 | #include <qframe.h> |
50 | #include <qpixmap.h> | 50 | #include <qpixmap.h> |
51 | #include <qstring.h> | 51 | #include <qstring.h> |
52 | #include <qtimer.h> | 52 | #include <qtimer.h> |
53 | #include <qpopupmenu.h> | 53 | #include <qpopupmenu.h> |
54 | #include <qmessagebox.h> | 54 | #include <qmessagebox.h> |
55 | #include <qfile.h> | ||
56 | #include <qtextstream.h> | ||
55 | 57 | ||
56 | /* STD */ | 58 | /* STD */ |
57 | #include <device.h> | 59 | #include <device.h> |
58 | 60 | ||
59 | namespace OpieTooth { | 61 | namespace OpieTooth { |
60 | BluezApplet::BluezApplet( QWidget *parent, const char *name ) : QWidget( parent, name ) { | 62 | BluezApplet::BluezApplet( QWidget *parent, const char *name ) : QWidget( parent, name ) { |
61 | setFixedHeight( AppLnk::smallIconSize() ); | 63 | setFixedHeight( AppLnk::smallIconSize() ); |
62 | setFixedWidth( AppLnk::smallIconSize() ); | 64 | setFixedWidth( AppLnk::smallIconSize() ); |
@@ -119,16 +121,35 @@ namespace OpieTooth { | |||
119 | odebug << "btDevice is ZERO" << oendl; | 121 | odebug << "btDevice is ZERO" << oendl; |
120 | return false; | 122 | return false; |
121 | } | 123 | } |
122 | } | 124 | } |
123 | 125 | ||
124 | int BluezApplet::setBluezStatus(int c, bool sync) { | 126 | int BluezApplet::setBluezStatus(int c, bool sync) { |
125 | 127 | ||
126 | if ( c == 1 ) { | 128 | if ( c == 1 ) { |
129 | QFile cfg("/etc/sysconfig/bluetooth"); | ||
130 | if ( cfg.open( IO_ReadOnly ) ) { | ||
131 | QTextStream stream( &cfg ); | ||
132 | QString streamIn = stream.read(); | ||
133 | QStringList list = QStringList::split( "\n", streamIn ); | ||
134 | cfg.close(); | ||
135 | if ( list.grep( "BLUETOOTH_PORT=" ).count() > 0 && | ||
136 | list.grep( "BLUETOOTH_PROTOCOL=" ).count() > 0 && | ||
137 | list.grep( "BLUETOOTH_SPEED=" ).count() > 0) | ||
138 | { | ||
139 | btDevice = | ||
140 | new Device( list.grep( "BLUETOOTH_PORT=" )[0].replace( QString( "BLUETOOTH_PORT=" ), ""), | ||
141 | list.grep( "BLUETOOTH_PROTOCOL=" )[0].replace( QString( "BLUETOOTH_PROTOCOL=" ), ""), | ||
142 | list.grep( "BLUETOOTH_SPEED=" )[0].replace( QString( "BLUETOOTH_SPEED=" ), "" ) ); | ||
143 | return 0; | ||
144 | } | ||
145 | } | ||
146 | |||
147 | // Device-specific stuff - should be removed | ||
127 | switch ( ODevice::inst()->model() ) { | 148 | switch ( ODevice::inst()->model() ) { |
128 | case Model_iPAQ_H39xx: | 149 | case Model_iPAQ_H39xx: |
129 | btDevice = new Device( "/dev/tts/1", "bcsp", "921600" ); | 150 | btDevice = new Device( "/dev/tts/1", "bcsp", "921600" ); |
130 | break; | 151 | break; |
131 | 152 | ||
132 | case Model_iPAQ_H5xxx: | 153 | case Model_iPAQ_H5xxx: |
133 | btDevice = new Device( "/dev/tts/1", "any", "921600" ); | 154 | btDevice = new Device( "/dev/tts/1", "any", "921600" ); |
134 | break; | 155 | break; |