summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/opietooth/lib/device.cc35
1 files changed, 32 insertions, 3 deletions
diff --git a/noncore/net/opietooth/lib/device.cc b/noncore/net/opietooth/lib/device.cc
index eea1178..40acbd2 100644
--- a/noncore/net/opietooth/lib/device.cc
+++ b/noncore/net/opietooth/lib/device.cc
@@ -4,6 +4,8 @@
4/* OPIE */ 4/* OPIE */
5#include <opie2/oprocess.h> 5#include <opie2/oprocess.h>
6#include <opie2/odebug.h> 6#include <opie2/odebug.h>
7#include <opie2/odevice.h>
8
7using namespace Opie::Core; 9using namespace Opie::Core;
8 10
9/* STD */ 11/* STD */
@@ -14,13 +16,27 @@ using namespace OpieTooth;
14 16
15using Opie::Core::OProcess; 17using Opie::Core::OProcess;
16namespace { 18namespace {
17 int parsePid( const QCString& par ){ 19 int parsePid( const QCString& par )
20 {
18 int id=0; 21 int id=0;
19 QString string( par ); 22 QString string( par );
20 QStringList list = QStringList::split( '\n', string ); 23 QStringList list = QStringList::split( '\n', string );
21 for( QStringList::Iterator it = list.begin(); it != list.end(); ++it ){ 24
25 for( QStringList::Iterator it = list.begin(); it != list.end(); ++it )
26 {
22 owarn << "parsePID: " << (*it).latin1() << oendl; 27 owarn << "parsePID: " << (*it).latin1() << oendl;
23 if( !(*it).startsWith("CSR") ){ 28
29 // FIXME mbhaynie: Surely there is a better way to skip
30 // verbosity (E.g. the TI device configuration
31 // script). Apparently the PID is always on a line by
32 // itself, or is at least the first word of a line. Does
33 // QString have somethine like startsWithRegex("[0-9]+")?
34 if( (*it).startsWith("#") ) continue;
35 if( (*it).startsWith("TI") ) continue;
36 if( (*it).startsWith("Loading") ) continue;
37 if( (*it).startsWith("BTS") ) continue;
38 if( !(*it).startsWith("CSR") )
39 {
24 id = (*it).toInt(); 40 id = (*it).toInt();
25 break; 41 break;
26 } 42 }
@@ -44,6 +60,10 @@ Device::Device(const QString &device, const QString &mode, const QString &speed
44Device::~Device(){ 60Device::~Device(){
45 detach(); 61 detach();
46} 62}
63
64// FIXME mbhaynie -- If BT is active, and opie is restarted, this
65// applet thinks bt is down, and will fail to start it again. Not
66// sure why.
47void Device::attach(){ 67void Device::attach(){
48 owarn << "attaching " << m_device.latin1() << " " << m_mode.latin1() << " " << m_speed.latin1() << oendl; 68 owarn << "attaching " << m_device.latin1() << " " << m_mode.latin1() << " " << m_speed.latin1() << oendl;
49 if(m_process == 0 ){ 69 if(m_process == 0 ){
@@ -52,7 +72,16 @@ void Device::attach(){
52 m_process = new OProcess(); 72 m_process = new OProcess();
53 *m_process << "hciattach"; 73 *m_process << "hciattach";
54 *m_process << "-p"; 74 *m_process << "-p";
75
76 // FIXME -- this is a hack for an odd hciattach interface.
77 if ( ODevice::inst()->modelString() == "HX4700" )
78 {
79 *m_process << "-S" << "/etc/bluetooth/TIInit_3.2.26.bts" << "/dev/ttyS1" << "texas";
80 }
81 else
82 {
55 *m_process << m_device << m_mode << m_speed; 83 *m_process << m_device << m_mode << m_speed;
84 }
56 connect(m_process, SIGNAL( processExited(Opie::Core::OProcess*) ), 85 connect(m_process, SIGNAL( processExited(Opie::Core::OProcess*) ),
57 this, SLOT( slotExited(Opie::Core::OProcess* ) ) ); 86 this, SLOT( slotExited(Opie::Core::OProcess* ) ) );
58 connect(m_process, SIGNAL( receivedStdout(Opie::Core::OProcess*, char*, int) ), 87 connect(m_process, SIGNAL( receivedStdout(Opie::Core::OProcess*, char*, int) ),