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 #include #include +#include +#include /* STD */ #include @@ -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 ) {