summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/opietooth2
Unidiff
Diffstat (limited to 'noncore/settings/networksettings2/opietooth2') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings2/opietooth2/OTDevice.cpp6
-rw-r--r--noncore/settings/networksettings2/opietooth2/OTDriver.cpp16
-rw-r--r--noncore/settings/networksettings2/opietooth2/OTDriverList.cpp4
-rw-r--r--noncore/settings/networksettings2/opietooth2/OTGateway.cpp14
-rw-r--r--noncore/settings/networksettings2/opietooth2/OTHCISocket.cpp14
-rw-r--r--noncore/settings/networksettings2/opietooth2/OTInquiry.cpp18
-rw-r--r--noncore/settings/networksettings2/opietooth2/OTPeer.cpp20
-rw-r--r--noncore/settings/networksettings2/opietooth2/Opietooth.cpp12
-rw-r--r--noncore/settings/networksettings2/opietooth2/config.in4
-rwxr-xr-xnoncore/settings/networksettings2/opietooth2/libopietooth2.postinst2
-rw-r--r--noncore/settings/networksettings2/opietooth2/opietooth2.pro7
11 files changed, 62 insertions, 55 deletions
diff --git a/noncore/settings/networksettings2/opietooth2/OTDevice.cpp b/noncore/settings/networksettings2/opietooth2/OTDevice.cpp
index 62f17a0..c6f7d5e 100644
--- a/noncore/settings/networksettings2/opietooth2/OTDevice.cpp
+++ b/noncore/settings/networksettings2/opietooth2/OTDevice.cpp
@@ -100,13 +100,13 @@ bool OTDevice::detach(){
100 if( m_hciattach ) { 100 if( m_hciattach ) {
101 delete m_hciattach; 101 delete m_hciattach;
102 m_hciattach = 0; 102 m_hciattach = 0;
103 } 103 }
104 104
105 if( kill( m_hciattachPid, 9) < 0 ) { 105 if( kill( m_hciattachPid, 9) < 0 ) {
106 owarn << "could not stop " << errno << oendl; 106 odebug << "could not stop " << errno << oendl;
107 emit error( tr( "Could not stop process" ) ); 107 emit error( tr( "Could not stop process" ) );
108 return FALSE; 108 return FALSE;
109 } 109 }
110 m_hciattachPid = 0; 110 m_hciattachPid = 0;
111 emit isEnabled( m_deviceNr, 0 ); 111 emit isEnabled( m_deviceNr, 0 );
112 m_deviceNr = -1; 112 m_deviceNr = -1;
@@ -165,13 +165,13 @@ void OTDevice::slotStdErr(OProcess* proc, char* chars, int len) {
165 165
166 if(proc == m_hciattach && len >= 1 ){ 166 if(proc == m_hciattach && len >= 1 ){
167 // collect output 167 // collect output
168 QCString string( chars, len+1 ); // \0 == +1 168 QCString string( chars, len+1 ); // \0 == +1
169 QString m_output; 169 QString m_output;
170 m_output.append( string.data() ); 170 m_output.append( string.data() );
171 owarn << m_output << oendl; 171 odebug << m_output << oendl;
172 } 172 }
173} 173}
174 174
175pid_t OTDevice::getPidOfHCIAttach( void ) { 175pid_t OTDevice::getPidOfHCIAttach( void ) {
176 176
177 if( needsAttach() ) { 177 if( needsAttach() ) {
@@ -208,13 +208,13 @@ pid_t OTDevice::getPidOfHCIAttach( void ) {
208 208
209void OTDevice::detectDeviceType( QString & Device, 209void OTDevice::detectDeviceType( QString & Device,
210 QString & Mode, 210 QString & Mode,
211 unsigned long & Speed ) { 211 unsigned long & Speed ) {
212 212
213 // detect device type and determine parms 213 // detect device type and determine parms
214 owarn << "Detecting device" << oendl; 214 odebug << "Detecting device" << oendl;
215 switch ( ODevice::inst()->model() ) { 215 switch ( ODevice::inst()->model() ) {
216 case Model_iPAQ_H39xx: 216 case Model_iPAQ_H39xx:
217 Device = "/dev/tts/1"; 217 Device = "/dev/tts/1";
218 Mode = "bcsp"; 218 Mode = "bcsp";
219 Speed = 921600; 219 Speed = 921600;
220 NeedsAttach = 1; 220 NeedsAttach = 1;
diff --git a/noncore/settings/networksettings2/opietooth2/OTDriver.cpp b/noncore/settings/networksettings2/opietooth2/OTDriver.cpp
index 8bd7919..a7ee662 100644
--- a/noncore/settings/networksettings2/opietooth2/OTDriver.cpp
+++ b/noncore/settings/networksettings2/opietooth2/OTDriver.cpp
@@ -147,13 +147,13 @@ static MainClassMap_t MainClasses[] = {
147OTDriver::OTDriver( OTGateway * _OT, struct hci_dev_info* di) : QObject( _OT ), Address() { 147OTDriver::OTDriver( OTGateway * _OT, struct hci_dev_info* di) : QObject( _OT ), Address() {
148 OT = _OT; 148 OT = _OT;
149 IsUp = 0; 149 IsUp = 0;
150 Socket = 0; 150 Socket = 0;
151 151
152 init(di); 152 init(di);
153 owarn << "Driver " << devname() << oendl; 153 odebug << "Driver " << devname() << oendl;
154 154
155 AutoClose = new QTimer( this ); 155 AutoClose = new QTimer( this );
156 connect( AutoClose, 156 connect( AutoClose,
157 SIGNAL( timeout() ), 157 SIGNAL( timeout() ),
158 this, 158 this,
159 SLOT( SLOT_CloseFd() ) 159 SLOT( SLOT_CloseFd() )
@@ -382,13 +382,13 @@ void OTDriver::setUp( bool M ) {
382 bringDown(); 382 bringDown();
383 } 383 }
384} 384}
385 385
386void OTDriver::bringUp() { 386void OTDriver::bringUp() {
387 387
388 owarn << "bringUp : " << Dev << oendl; 388 odebug << "bringUp : " << Dev << oendl;
389 389
390 if( ! open() ) { 390 if( ! open() ) {
391 return; 391 return;
392 } 392 }
393 393
394 if (! isUp()) { 394 if (! isUp()) {
@@ -405,13 +405,13 @@ void OTDriver::bringUp() {
405 QTimer::singleShot( 3000, this, SLOT( reinit() ) ); 405 QTimer::singleShot( 3000, this, SLOT( reinit() ) );
406 } 406 }
407} 407}
408 408
409void OTDriver::bringDown() { 409void OTDriver::bringDown() {
410 410
411 owarn << "bringDown : " << Dev << oendl; 411 odebug << "bringDown : " << Dev << oendl;
412 412
413 if( ! open() ) { 413 if( ! open() ) {
414 return; 414 return;
415 } 415 }
416 416
417 if ( isUp() ) { 417 if ( isUp() ) {
@@ -658,21 +658,21 @@ void OTDriver::setFeatures( unsigned char * _f) {
658void OTDriver::setManufacturer(int compid) { 658void OTDriver::setManufacturer(int compid) {
659 Manufacturer = bt_compidtostr(compid); 659 Manufacturer = bt_compidtostr(compid);
660} 660}
661 661
662OTHCISocket * OTDriver::openSocket( void ) { 662OTHCISocket * OTDriver::openSocket( void ) {
663 if( ! Socket ) { 663 if( ! Socket ) {
664 owarn << "Open HCI socket to " << devname() << oendl; 664 odebug << "Open HCI socket to " << devname() << oendl;
665 Socket = new OTHCISocket( this ); 665 Socket = new OTHCISocket( this );
666 } 666 }
667 return Socket; 667 return Socket;
668} 668}
669 669
670void OTDriver::closeSocket( void ) { 670void OTDriver::closeSocket( void ) {
671 if( Socket ) { 671 if( Socket ) {
672 owarn << "Close HCI socket to " << devname() << oendl; 672 odebug << "Close HCI socket to " << devname() << oendl;
673 delete Socket; 673 delete Socket;
674 Socket = 0; 674 Socket = 0;
675 } 675 }
676} 676}
677 677
678QString OTDriver::getPeerName( const OTDeviceAddress & PAddr ) { 678QString OTDriver::getPeerName( const OTDeviceAddress & PAddr ) {
@@ -710,13 +710,13 @@ long OTDriver::getLinkQuality( const OTDeviceAddress & Addr ) {
710 return 0; 710 return 0;
711 711
712 bacpy( &(cr->bdaddr), &(Addr.getBDAddr()) ); 712 bacpy( &(cr->bdaddr), &(Addr.getBDAddr()) );
713 cr->type = ACL_LINK; 713 cr->type = ACL_LINK;
714 714
715 if (ioctl( fd(), HCIGETCONNINFO, (unsigned long) cr) < 0) { 715 if (ioctl( fd(), HCIGETCONNINFO, (unsigned long) cr) < 0) {
716 owarn << "Get connection info failed" << oendl; 716 odebug << "Get connection info failed" << oendl;
717 free(cr); 717 free(cr);
718 return 0; 718 return 0;
719 } 719 }
720 720
721 handle = htobs(cr->conn_info->handle); 721 handle = htobs(cr->conn_info->handle);
722 722
@@ -728,17 +728,17 @@ long OTDriver::getLinkQuality( const OTDeviceAddress & Addr ) {
728 rq.cparam = &handle; 728 rq.cparam = &handle;
729 rq.clen = 2; 729 rq.clen = 2;
730 rq.rparam = &rp; 730 rq.rparam = &rp;
731 rq.rlen = GET_LINK_QUALITY_RP_SIZE; 731 rq.rlen = GET_LINK_QUALITY_RP_SIZE;
732 732
733 if (hci_send_req( fd(), &rq, 100) < 0) { 733 if (hci_send_req( fd(), &rq, 100) < 0) {
734 owarn << "Get connection info failed" << oendl; 734 odebug << "Get connection info failed" << oendl;
735 return 0; 735 return 0;
736 } 736 }
737 737
738 if( rp.status ) { 738 if( rp.status ) {
739 owarn << QString().sprintf("HCI get_link_quality cmd failed (0x%2.2X)", rp.status) << oendl; 739 odebug << QString().sprintf("HCI get_link_quality cmd failed (0x%2.2X)", rp.status) << oendl;
740 return 0; 740 return 0;
741 } 741 }
742 742
743 return rp.rssi+50; 743 return rp.rssi+50;
744} 744}
diff --git a/noncore/settings/networksettings2/opietooth2/OTDriverList.cpp b/noncore/settings/networksettings2/opietooth2/OTDriverList.cpp
index f703834..e5af742 100644
--- a/noncore/settings/networksettings2/opietooth2/OTDriverList.cpp
+++ b/noncore/settings/networksettings2/opietooth2/OTDriverList.cpp
@@ -50,13 +50,13 @@ void OTDriverList::update() {
50 exit(1); 50 exit(1);
51 } 51 }
52 52
53 dl->dev_num = cur; 53 dl->dev_num = cur;
54 54
55 if( ioctl( OT->getSocket(), HCIGETDEVLIST, (void*)dl) ) { 55 if( ioctl( OT->getSocket(), HCIGETDEVLIST, (void*)dl) ) {
56 owarn << "WARNING : cannot read device list. " 56 odebug << "WARNING : cannot read device list. "
57 << errno 57 << errno
58 << strerror( errno ) << oendl; 58 << strerror( errno ) << oendl;
59 return; 59 return;
60 } 60 }
61 61
62 // if num == cur perhaps we did not get all devices yet 62 // if num == cur perhaps we did not get all devices yet
@@ -76,11 +76,11 @@ void OTDriverList::update() {
76 // get device info 76 // get device info
77 if( ioctl( OT->getSocket(), HCIGETDEVINFO, (void*)&di) != 0 ) 77 if( ioctl( OT->getSocket(), HCIGETDEVINFO, (void*)&di) != 0 )
78 continue; // uh ? 78 continue; // uh ?
79 insert( cur, new OTDriver( OT, &di ) ); 79 insert( cur, new OTDriver( OT, &di ) );
80 } 80 }
81 81
82 owarn << "Found " << count() << " devices" << oendl; 82 odebug << "Found " << count() << " devices" << oendl;
83 83
84 ::free( dl ); 84 ::free( dl );
85 } 85 }
86} 86}
diff --git a/noncore/settings/networksettings2/opietooth2/OTGateway.cpp b/noncore/settings/networksettings2/opietooth2/OTGateway.cpp
index 6531cf6..e8137dd 100644
--- a/noncore/settings/networksettings2/opietooth2/OTGateway.cpp
+++ b/noncore/settings/networksettings2/opietooth2/OTGateway.cpp
@@ -151,13 +151,13 @@ bool OTGateway::isEnabled() {
151 // else check system 151 // else check system
152 return getOTDevice()->isAttached(); 152 return getOTDevice()->isAttached();
153} 153}
154 154
155void OTGateway::SLOT_ShowError( const QString & S ) { 155void OTGateway::SLOT_ShowError( const QString & S ) {
156 156
157 owarn << S << oendl; 157 odebug << S << oendl;
158 158
159 if( ErrorConnectCount > 0 ) { 159 if( ErrorConnectCount > 0 ) {
160 // pass error 160 // pass error
161 emit error( QString( "<p>" ) + S + "</p>" ); 161 emit error( QString( "<p>" ) + S + "</p>" );
162 return; 162 return;
163 } 163 }
@@ -207,13 +207,13 @@ void OTGateway::timerEvent( QTimerEvent * ) {
207 } 207 }
208 } 208 }
209 } 209 }
210} 210}
211 211
212void OTGateway::SLOT_Enabled( int id, bool Up ) { 212void OTGateway::SLOT_Enabled( int id, bool Up ) {
213 owarn << "device " << id << " state " << Up << oendl; 213 odebug << "device " << id << " state " << Up << oendl;
214 if( Up ) { 214 if( Up ) {
215 // device is up -> detect it 215 // device is up -> detect it
216 updateDrivers(); 216 updateDrivers();
217 if( (unsigned)id >= AllDrivers.count() ) { 217 if( (unsigned)id >= AllDrivers.count() ) {
218 // to make sure that the driver really IS detected 218 // to make sure that the driver really IS detected
219 AllDrivers[id]->bringUp(); 219 AllDrivers[id]->bringUp();
@@ -224,13 +224,13 @@ void OTGateway::SLOT_Enabled( int id, bool Up ) {
224 224
225void OTGateway::updateDrivers( void ) { 225void OTGateway::updateDrivers( void ) {
226 OTDriver * D; 226 OTDriver * D;
227 227
228 AllDrivers.update(); 228 AllDrivers.update();
229 229
230 owarn << "updated drivers. now " << AllDrivers.count() << oendl; 230 odebug << "updated drivers. now " << AllDrivers.count() << oendl;
231 231
232 // connect signals for each driver 232 // connect signals for each driver
233 for( unsigned int i = 0; 233 for( unsigned int i = 0;
234 i < AllDrivers.count(); 234 i < AllDrivers.count();
235 i ++ ) { 235 i ++ ) {
236 D = AllDrivers[i]; 236 D = AllDrivers[i];
@@ -262,13 +262,13 @@ void OTGateway::updateDrivers( void ) {
262 setScanWith( 0 ); 262 setScanWith( 0 );
263 263
264 emit driverListChanged(); 264 emit driverListChanged();
265} 265}
266 266
267void OTGateway::SLOT_DriverDisappeared( OTDriver * D ) { 267void OTGateway::SLOT_DriverDisappeared( OTDriver * D ) {
268 owarn << "Driver " << D->devname() << " when offline" << oendl; 268 odebug << "Driver " << D->devname() << " when offline" << oendl;
269 updateDrivers(); 269 updateDrivers();
270} 270}
271 271
272void OTGateway::scanNeighbourhood( OTDriver * D ) { 272void OTGateway::scanNeighbourhood( OTDriver * D ) {
273 273
274 if( Scanning ) { 274 if( Scanning ) {
@@ -315,13 +315,13 @@ OTDriver* OTGateway::findDriver( const OTDeviceAddress & Addr ) {
315} 315}
316 316
317void OTGateway::SLOT_PeerDetected( OTPeer * P, bool IsNew ) { 317void OTGateway::SLOT_PeerDetected( OTPeer * P, bool IsNew ) {
318 318
319 if( IsNew ) { 319 if( IsNew ) {
320 // new peer 320 // new peer
321 owarn << "New peer " << P->name() << oendl; 321 odebug << "New peer " << P->name() << oendl;
322 addPeer( P ); 322 addPeer( P );
323 } 323 }
324 324
325 emit detectedPeer( P, IsNew ); 325 emit detectedPeer( P, IsNew );
326} 326}
327 327
@@ -381,20 +381,20 @@ PANConnectionVector OTGateway::getPANConnections( void ) {
381 struct bnep_conninfo ci[48]; 381 struct bnep_conninfo ci[48];
382 382
383 V.setAutoDelete(TRUE); 383 V.setAutoDelete(TRUE);
384 384
385 int ctl = socket(PF_BLUETOOTH, SOCK_RAW, BTPROTO_BNEP); 385 int ctl = socket(PF_BLUETOOTH, SOCK_RAW, BTPROTO_BNEP);
386 if (ctl < 0) { 386 if (ctl < 0) {
387 owarn << "Failed to open control socket" << oendl; 387 odebug << "Failed to open control socket" << oendl;
388 return V; 388 return V;
389 } 389 }
390 390
391 req.cnum = 48; 391 req.cnum = 48;
392 req.ci = ci; 392 req.ci = ci;
393 if (ioctl(ctl, BNEPGETCONNLIST, &req)) { 393 if (ioctl(ctl, BNEPGETCONNLIST, &req)) {
394 owarn << "Failed to get connection list" << oendl; 394 odebug << "Failed to get connection list" << oendl;
395 ::close( ctl ); 395 ::close( ctl );
396 return V; 396 return V;
397 } 397 }
398 398
399 for ( unsigned i=0; i < req.cnum; i++) { 399 for ( unsigned i=0; i < req.cnum; i++) {
400 V.resize( V.size() + 1 ); 400 V.resize( V.size() + 1 );
diff --git a/noncore/settings/networksettings2/opietooth2/OTHCISocket.cpp b/noncore/settings/networksettings2/opietooth2/OTHCISocket.cpp
index 471c3bf..1997b44 100644
--- a/noncore/settings/networksettings2/opietooth2/OTHCISocket.cpp
+++ b/noncore/settings/networksettings2/opietooth2/OTHCISocket.cpp
@@ -31,25 +31,25 @@ OTHCISocket::OTHCISocket( OTDriver * D ) :
31 31
32OTHCISocket::~OTHCISocket() { 32OTHCISocket::~OTHCISocket() {
33 close(); 33 close();
34} 34}
35 35
36void OTHCISocket::close() { 36void OTHCISocket::close() {
37 owarn << "OTHCISocket::close()" << oendl; 37 odebug << "OTHCISocket::close()" << oendl;
38 if( HCIReadNotifier ) { 38 if( HCIReadNotifier ) {
39 delete HCIReadNotifier; 39 delete HCIReadNotifier;
40 } 40 }
41 41
42 if( HCISocket.isValid() ) { 42 if( HCISocket.isValid() ) {
43 HCISocket.close(); 43 HCISocket.close();
44 } 44 }
45} 45}
46 46
47bool OTHCISocket::open() { 47bool OTHCISocket::open() {
48 48
49 owarn << "OTHCISocket::open()" << oendl; 49 odebug << "OTHCISocket::open()" << oendl;
50 int s; 50 int s;
51 51
52 s = ::socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI); 52 s = ::socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI);
53 53
54 if (s < 0) { 54 if (s < 0) {
55 emit error( tr( "Error creating socket on %1 : %2 %3"). 55 emit error( tr( "Error creating socket on %1 : %2 %3").
@@ -148,13 +148,13 @@ void OTHCISocket::slotSocketActivated() {
148 databuf.duplicate((char*)(buf+3), len); 148 databuf.duplicate((char*)(buf+3), len);
149 emit event(eventCode, databuf); 149 emit event(eventCode, databuf);
150 if (eventCode == EVT_CMD_STATUS) { 150 if (eventCode == EVT_CMD_STATUS) {
151 updateStatus( databuf ); 151 updateStatus( databuf );
152 } 152 }
153 } else { 153 } else {
154 owarn << "Error reading hci packet: packetSize(" 154 odebug << "Error reading hci packet: packetSize("
155 << psize 155 << psize
156 << ")-3 != dataSize(" 156 << ")-3 != dataSize("
157 << len 157 << len
158 << ")" 158 << ")"
159 << oendl; 159 << oendl;
160 } 160 }
@@ -180,13 +180,13 @@ void OTHCISocket::updateStatus(const QByteArray& data) {
180 LastStatus = status; 180 LastStatus = status;
181 LastStatusOgf = cmd_opcode_ogf(opcode); 181 LastStatusOgf = cmd_opcode_ogf(opcode);
182 LastStatusOcf = cmd_opcode_ocf(opcode); 182 LastStatusOcf = cmd_opcode_ocf(opcode);
183} 183}
184 184
185void OTHCISocket::slotConnectionClosed() { 185void OTHCISocket::slotConnectionClosed() {
186 owarn << "HCI connection closed." << oendl; 186 odebug << "HCI connection closed." << oendl;
187 emit connectionClosed(); 187 emit connectionClosed();
188} 188}
189 189
190void OTHCISocket::readEvent() { 190void OTHCISocket::readEvent() {
191 191
192 if (HCIReadNotifier) { 192 if (HCIReadNotifier) {
@@ -227,13 +227,13 @@ bool OTHCISocket::readStatus( unsigned char ogf,
227 227
228 timer.start(timeout_ms, true); 228 timer.start(timeout_ms, true);
229 BStatusSet = false; 229 BStatusSet = false;
230 230
231 while (timer.isActive() && HCISocket.isValid()) { 231 while (timer.isActive() && HCISocket.isValid()) {
232 232
233 owarn << "OTHCISocket::readStatus()" << oendl; 233 odebug << "OTHCISocket::readStatus()" << oendl;
234 bool timeout = false; 234 bool timeout = false;
235 235
236 if( HCISocket.bytesAvailable() == 0) { 236 if( HCISocket.bytesAvailable() == 0) {
237 int rv = HCISocket.waitForMore(timeout_ms); 237 int rv = HCISocket.waitForMore(timeout_ms);
238 timeout = (rv == 0); 238 timeout = (rv == 0);
239 } 239 }
@@ -243,25 +243,25 @@ bool OTHCISocket::readStatus( unsigned char ogf,
243 } 243 }
244 244
245 if( BStatusSet == true && 245 if( BStatusSet == true &&
246 ogf == LastStatusOgf && 246 ogf == LastStatusOgf &&
247 ocf == LastStatusOcf) { 247 ocf == LastStatusOcf) {
248 *status = LastStatus; 248 *status = LastStatus;
249 owarn << "OTHCISocket::readStatus(ogf=" 249 odebug << "OTHCISocket::readStatus(ogf="
250 << ogf 250 << ogf
251 << ",ocf=" 251 << ",ocf="
252 << ocf 252 << ocf
253 << ",timeout=" 253 << ",timeout="
254 << LastStatus 254 << LastStatus
255 << ")" 255 << ")"
256 << oendl; 256 << oendl;
257 return true; 257 return true;
258 } 258 }
259 } 259 }
260 260
261 owarn << "OTHCISocket::readStatus(ogf=" 261 odebug << "OTHCISocket::readStatus(ogf="
262 << ogf 262 << ogf
263 << ",ocf=" 263 << ",ocf="
264 << ocf 264 << ocf
265 << ",timeout=" 265 << ",timeout="
266 << LastStatus 266 << LastStatus
267 << ") : timeout " 267 << ") : timeout "
diff --git a/noncore/settings/networksettings2/opietooth2/OTInquiry.cpp b/noncore/settings/networksettings2/opietooth2/OTInquiry.cpp
index 8e94bbc..2bc63c7 100644
--- a/noncore/settings/networksettings2/opietooth2/OTInquiry.cpp
+++ b/noncore/settings/networksettings2/opietooth2/OTInquiry.cpp
@@ -56,13 +56,13 @@ OTInquiry::OTInquiry( OTDriver * Drv ) : QObject( Drv ) {
56OTInquiry::~OTInquiry() { 56OTInquiry::~OTInquiry() {
57 stopInquiring(); 57 stopInquiring();
58} 58}
59 59
60void OTInquiry::stopInquiring( void ) { 60void OTInquiry::stopInquiring( void ) {
61 if( Socket ) { 61 if( Socket ) {
62 owarn << "Stop inquiry" << oendl; 62 odebug << "Stop inquiry" << oendl;
63 Driver->closeSocket(); 63 Driver->closeSocket();
64 Socket = 0; 64 Socket = 0;
65 } 65 }
66} 66}
67 67
68bool OTInquiry::inquire( double timeout, int numResponses, int lap) { 68bool OTInquiry::inquire( double timeout, int numResponses, int lap) {
@@ -72,13 +72,13 @@ bool OTInquiry::inquire( double timeout, int numResponses, int lap) {
72 cmdBuf[0] = lap & 0xFF; 72 cmdBuf[0] = lap & 0xFF;
73 cmdBuf[1] = (lap >> 8) & 0xFF; 73 cmdBuf[1] = (lap >> 8) & 0xFF;
74 cmdBuf[2] = (lap >> 16) & 0xFF; 74 cmdBuf[2] = (lap >> 16) & 0xFF;
75 cmdBuf[3] = max(0x01, min(0x30, int(timeout/1.28))); 75 cmdBuf[3] = max(0x01, min(0x30, int(timeout/1.28)));
76 cmdBuf[4] = (unsigned char)numResponses; 76 cmdBuf[4] = (unsigned char)numResponses;
77 77
78 owarn << "Send HCI inquiry command. wait for " << cmdBuf[3] << oendl; 78 odebug << "Send HCI inquiry command. wait for " << cmdBuf[3] << oendl;
79 79
80 Socket->sendCommand(0x01, 0x0001, cmdBuf); 80 Socket->sendCommand(0x01, 0x0001, cmdBuf);
81 81
82 int status; 82 int status;
83 83
84 if( Socket->readStatus(0x01, 0x0001, &status)) { 84 if( Socket->readStatus(0x01, 0x0001, &status)) {
@@ -86,18 +86,18 @@ bool OTInquiry::inquire( double timeout, int numResponses, int lap) {
86 SuccessfullyStarted = true; 86 SuccessfullyStarted = true;
87 InquiryTimeoutTimer->start( int(1000*(timeout+1.0)), true); 87 InquiryTimeoutTimer->start( int(1000*(timeout+1.0)), true);
88 return true; 88 return true;
89 } 89 }
90 else { 90 else {
91 QString S =QString().sprintf( "%x", status ); 91 QString S =QString().sprintf( "%x", status );
92 owarn << "OTInquiry::inquiry() failed: 0x" << S << oendl; 92 odebug << "OTInquiry::inquiry() failed: 0x" << S << oendl;
93 emit finished(); 93 emit finished();
94 return false; 94 return false;
95 } 95 }
96 } else { 96 } else {
97 owarn << "OTInquiry::inquiry(): Timeout." << oendl; 97 odebug << "OTInquiry::inquiry(): Timeout." << oendl;
98 return false; 98 return false;
99 } 99 }
100} 100}
101 101
102bool OTInquiry::isInquiring() { 102bool OTInquiry::isInquiring() {
103 return InquiryTimeoutTimer->isActive(); 103 return InquiryTimeoutTimer->isActive();
@@ -123,27 +123,27 @@ void OTInquiry::onPeerFound( OTPeer * Peer, bool IsNew ) {
123void OTInquiry::slotInquiryTimeout() { 123void OTInquiry::slotInquiryTimeout() {
124 emit error( tr( "Timeout while waiting for end of inquiry.") ); 124 emit error( tr( "Timeout while waiting for end of inquiry.") );
125} 125}
126 126
127void OTInquiry::slotHCIEvent(unsigned char eventCode, QByteArray buf) { 127void OTInquiry::slotHCIEvent(unsigned char eventCode, QByteArray buf) {
128 128
129 owarn << "OTInquiry: hci packet received: eventCode=" 129 odebug << "OTInquiry: hci packet received: eventCode="
130 << (unsigned int)eventCode 130 << (unsigned int)eventCode
131 << " packetLength=" 131 << " packetLength="
132 << (unsigned int)buf.size() 132 << (unsigned int)buf.size()
133 << oendl; 133 << oendl;
134 134
135 unsigned char *data = (unsigned char*)buf.data(); 135 unsigned char *data = (unsigned char*)buf.data();
136 switch (eventCode) { 136 switch (eventCode) {
137 case EVT_INQUIRY_COMPLETE: 137 case EVT_INQUIRY_COMPLETE:
138 { unsigned char status = data[0]; 138 { unsigned char status = data[0];
139 owarn << "EVT_INQUIRY_COMPLETE status=" << status << oendl; 139 odebug << "EVT_INQUIRY_COMPLETE status=" << status << oendl;
140 InquiryTimeoutTimer->stop(); 140 InquiryTimeoutTimer->stop();
141 if (status == 0) { 141 if (status == 0) {
142 if( SuccessfullyStarted == true) { 142 if( SuccessfullyStarted == true) {
143 owarn << "OTInquiry ended successfully" << oendl; 143 odebug << "OTInquiry ended successfully" << oendl;
144 SuccessfullyEnded = true; 144 SuccessfullyEnded = true;
145 } 145 }
146 emit finished(); 146 emit finished();
147 } 147 }
148 else { 148 else {
149 emit error( tr( "OTInquiry completed with error (code %1)" ). 149 emit error( tr( "OTInquiry completed with error (code %1)" ).
@@ -160,13 +160,13 @@ void OTInquiry::slotHCIEvent(unsigned char eventCode, QByteArray buf) {
160 160
161 inquiry_info *results = (inquiry_info*)(data+1); 161 inquiry_info *results = (inquiry_info*)(data+1);
162 162
163 for (int n=0; n<numResults; n++) { 163 for (int n=0; n<numResults; n++) {
164 Addr.setBDAddr( results[n].bdaddr ); 164 Addr.setBDAddr( results[n].bdaddr );
165 165
166 owarn << "INQUIRY_RESULT: " 166 odebug << "INQUIRY_RESULT: "
167 << Addr.toString() 167 << Addr.toString()
168 << oendl; 168 << oendl;
169 169
170 P = Driver->gateway()->findPeer( Addr ); 170 P = Driver->gateway()->findPeer( Addr );
171 171
172 if( P ) { 172 if( P ) {
@@ -200,13 +200,13 @@ void OTInquiry::slotHCIEvent(unsigned char eventCode, QByteArray buf) {
200 } 200 }
201 break; 201 break;
202 case EVT_CMD_STATUS : 202 case EVT_CMD_STATUS :
203 { int status = data[0]; 203 { int status = data[0];
204 int numHciCmdPkts = data[1]; 204 int numHciCmdPkts = data[1];
205 int cmdOpcode = *((uint16_t*)(data+2)); 205 int cmdOpcode = *((uint16_t*)(data+2));
206 owarn << "EVT_CMD_STATUS status=" 206 odebug << "EVT_CMD_STATUS status="
207 << status 207 << status
208 << " numPkts=" 208 << " numPkts="
209 << numHciCmdPkts 209 << numHciCmdPkts
210 << " cmdOpcode=" 210 << " cmdOpcode="
211 << cmdOpcode 211 << cmdOpcode
212 << oendl; 212 << oendl;
diff --git a/noncore/settings/networksettings2/opietooth2/OTPeer.cpp b/noncore/settings/networksettings2/opietooth2/OTPeer.cpp
index 0d7e943..2272f04 100644
--- a/noncore/settings/networksettings2/opietooth2/OTPeer.cpp
+++ b/noncore/settings/networksettings2/opietooth2/OTPeer.cpp
@@ -48,20 +48,20 @@ OTPeer::~OTPeer( ) {
48 48
49void OTPeer::updateServices( void ) { 49void OTPeer::updateServices( void ) {
50 sdp_session_t *session; 50 sdp_session_t *session;
51 51
52 serviceList.clear(); 52 serviceList.clear();
53 53
54 owarn << "Get services from " << Addr.toString() << oendl; 54 odebug << "Get services from " << Addr.toString() << oendl;
55 55
56 session = sdp_connect( &(OTDeviceAddress::any.getBDAddr()), 56 session = sdp_connect( &(OTDeviceAddress::any.getBDAddr()),
57 &(Addr.getBDAddr()), 57 &(Addr.getBDAddr()),
58 0); 58 0);
59 59
60 if (!session) { 60 if (!session) {
61 owarn << "sdp_connect(" 61 odebug << "sdp_connect("
62 << Addr.toString() 62 << Addr.toString()
63 << ") failed" 63 << ") failed"
64 << oendl; 64 << oendl;
65 return; // error 65 return; // error
66 } 66 }
67 67
@@ -77,13 +77,13 @@ void OTPeer::updateServices( void ) {
77 sdp_list_t* seq; 77 sdp_list_t* seq;
78 if (sdp_service_search_attr_req( session, 78 if (sdp_service_search_attr_req( session,
79 search, 79 search,
80 SDP_ATTR_REQ_RANGE, 80 SDP_ATTR_REQ_RANGE,
81 attrId, 81 attrId,
82 &seq ) ) { 82 &seq ) ) {
83 owarn << "Service Search failed" << oendl; 83 odebug << "Service Search failed" << oendl;
84 sdp_close(session); 84 sdp_close(session);
85 return; 85 return;
86 } 86 }
87 87
88 sdp_list_free(attrId, 0); 88 sdp_list_free(attrId, 0);
89 sdp_list_free(search, 0); 89 sdp_list_free(search, 0);
@@ -174,13 +174,13 @@ void OTPeer::findOutState( int timeoutInSec, bool Force ) {
174 State = OTPeer::Peer_Unknown; 174 State = OTPeer::Peer_Unknown;
175 } // else keep state or is connected to us 175 } // else keep state or is connected to us
176 176
177 if( State == OTPeer::Peer_Unknown ) { 177 if( State == OTPeer::Peer_Unknown ) {
178 ProbePhase = 0; 178 ProbePhase = 0;
179 ProbeTimeout = timeoutInSec*1000; 179 ProbeTimeout = timeoutInSec*1000;
180 owarn << "Ping " << address().toString() << oendl; 180 odebug << "Ping " << address().toString() << oendl;
181 startTimer( POLLDELAY ); 181 startTimer( POLLDELAY );
182 } else { 182 } else {
183 ProbeTimeout = 0; 183 ProbeTimeout = 0;
184 startTimer( 0 ); 184 startTimer( 0 );
185 } 185 }
186} 186}
@@ -232,13 +232,13 @@ void OTPeer::timerEvent( QTimerEvent * ev ) {
232 char buf[L2CAP_CMD_HDR_SIZE + PINGSIZE + 20]; 232 char buf[L2CAP_CMD_HDR_SIZE + PINGSIZE + 20];
233 int n; 233 int n;
234 234
235 pf[0].fd = ProbeFD; 235 pf[0].fd = ProbeFD;
236 pf[0].events = POLLOUT; 236 pf[0].events = POLLOUT;
237 if( (n = ::poll(pf, 1, 0)) < 0 ) { 237 if( (n = ::poll(pf, 1, 0)) < 0 ) {
238 owarn << address().toString() 238 odebug << address().toString()
239 << " : errno " 239 << " : errno "
240 << errno 240 << errno
241 << " " 241 << " "
242 << strerror(errno)<<oendl; 242 << strerror(errno)<<oendl;
243 ProbeTimeout = 0; 243 ProbeTimeout = 0;
244 break; 244 break;
@@ -263,23 +263,23 @@ void OTPeer::timerEvent( QTimerEvent * ev ) {
263 /* Send Echo Request */ 263 /* Send Echo Request */
264 if( ::send(ProbeFD, buf, PINGSIZE + L2CAP_CMD_HDR_SIZE, 0) <= 0) { 264 if( ::send(ProbeFD, buf, PINGSIZE + L2CAP_CMD_HDR_SIZE, 0) <= 0) {
265 if( errno == EACCES ) { 265 if( errno == EACCES ) {
266 // permission denied means that we could not 266 // permission denied means that we could not
267 // connect because the device does not allow us 267 // connect because the device does not allow us
268 // but it is UP 268 // but it is UP
269 owarn << address().toString() 269 odebug << address().toString()
270 << " good send error " 270 << " good send error "
271 << errno 271 << errno
272 << " " 272 << " "
273 << strerror( errno) 273 << strerror( errno)
274 << oendl; 274 << oendl;
275 State = OTPeer::Peer_Up; 275 State = OTPeer::Peer_Up;
276 ProbeTimeout = 0; 276 ProbeTimeout = 0;
277 break; 277 break;
278 } else if( errno != EBUSY ) { 278 } else if( errno != EBUSY ) {
279 owarn << address().toString() 279 odebug << address().toString()
280 << " : errno " 280 << " : errno "
281 << errno 281 << errno
282 << " " 282 << " "
283 << strerror(errno) 283 << strerror(errno)
284 << oendl; 284 << oendl;
285 ProbeTimeout = 0; 285 ProbeTimeout = 0;
@@ -296,13 +296,13 @@ void OTPeer::timerEvent( QTimerEvent * ev ) {
296 l2cap_cmd_hdr *cmd = (l2cap_cmd_hdr *) buf; 296 l2cap_cmd_hdr *cmd = (l2cap_cmd_hdr *) buf;
297 int n; 297 int n;
298 298
299 pf[0].fd = ProbeFD; 299 pf[0].fd = ProbeFD;
300 pf[0].events = POLLIN; 300 pf[0].events = POLLIN;
301 if( (n = ::poll(pf, 1, 0)) < 0 ) { 301 if( (n = ::poll(pf, 1, 0)) < 0 ) {
302 owarn << address().toString() 302 odebug << address().toString()
303 << " : errno " 303 << " : errno "
304 << errno 304 << errno
305 << " " 305 << " "
306 << strerror(errno) 306 << strerror(errno)
307 <<oendl; 307 <<oendl;
308 ProbeTimeout = 0; 308 ProbeTimeout = 0;
@@ -312,13 +312,13 @@ void OTPeer::timerEvent( QTimerEvent * ev ) {
312 if( ! n ) { 312 if( ! n ) {
313 // not ready -> try again 313 // not ready -> try again
314 break; 314 break;
315 } 315 }
316 316
317 if( (n = ::recv( ProbeFD, buf, sizeof(buf), 0)) < 0) { 317 if( (n = ::recv( ProbeFD, buf, sizeof(buf), 0)) < 0) {
318 owarn << address().toString() 318 odebug << address().toString()
319 << "errno " 319 << "errno "
320 << errno 320 << errno
321 << " " 321 << " "
322 << strerror(errno) 322 << strerror(errno)
323 << oendl; 323 << oendl;
324 ProbeTimeout = 0; 324 ProbeTimeout = 0;
@@ -327,13 +327,13 @@ void OTPeer::timerEvent( QTimerEvent * ev ) {
327 327
328 /* Check for our id */ 328 /* Check for our id */
329 if( cmd->ident != *(char *)this ) 329 if( cmd->ident != *(char *)this )
330 // not our reply 330 // not our reply
331 break; 331 break;
332 332
333 owarn << "reply from " 333 odebug << "reply from "
334 << address().toString() 334 << address().toString()
335 << oendl; 335 << oendl;
336 // whatever reply we get is a valid reply 336 // whatever reply we get is a valid reply
337 State = OTPeer::Peer_Up; 337 State = OTPeer::Peer_Up;
338 ProbeTimeout = 0; 338 ProbeTimeout = 0;
339 } 339 }
diff --git a/noncore/settings/networksettings2/opietooth2/Opietooth.cpp b/noncore/settings/networksettings2/opietooth2/Opietooth.cpp
index b14cc2f..8323549 100644
--- a/noncore/settings/networksettings2/opietooth2/Opietooth.cpp
+++ b/noncore/settings/networksettings2/opietooth2/Opietooth.cpp
@@ -534,13 +534,13 @@ void OTScan::SLOT_Selected( QListViewItem * it ) {
534 return; 534 return;
535 } 535 }
536 536
537 SelectedPeer = ((PeerLVI *)it)->peer(); 537 SelectedPeer = ((PeerLVI *)it)->peer();
538 SelectedChannel = 0; 538 SelectedChannel = 0;
539 } 539 }
540 owarn << "Selected " << SelectedPeer->address().toString() << 540 odebug << "Selected " << SelectedPeer->address().toString() <<
541 " Channel " << SelectedChannel << oendl; 541 " Channel " << SelectedChannel << oendl;
542 emit selected(); 542 emit selected();
543} 543}
544 544
545void OTScan::SLOT_FinishedDetecting( ) { 545void OTScan::SLOT_FinishedDetecting( ) {
546 scanMode( false ); 546 scanMode( false );
@@ -562,29 +562,29 @@ void OTScan::SLOT_CleanupOld( ) {
562 // what about linkkeys ? 562 // what about linkkeys ?
563 for( k = 0; k < Keys.count(); k ++ ) { 563 for( k = 0; k < Keys.count(); k ++ ) {
564 if( TheP->address() == Keys[k].to() || 564 if( TheP->address() == Keys[k].to() ||
565 TheP->address() == Keys[k].from() 565 TheP->address() == Keys[k].from()
566 ) { 566 ) {
567 // part of linkkey 567 // part of linkkey
568 owarn << "LINKKEY " << TheP->address().toString() << oendl; 568 odebug << "LINKKEY " << TheP->address().toString() << oendl;
569 break; 569 break;
570 } 570 }
571 } 571 }
572 572
573 if( k == Keys.count() ) { 573 if( k == Keys.count() ) {
574 owarn << "RM LINKKEY " << TheP->address().toString() << oendl; 574 odebug << "RM LINKKEY " << TheP->address().toString() << oendl;
575 // not found -> remember to remove this peer 575 // not found -> remember to remove this peer
576 QListViewItem * Nit; 576 QListViewItem * Nit;
577 OT->removePeer( TheP ); 577 OT->removePeer( TheP );
578 Nit = Lit->nextSibling(); 578 Nit = Lit->nextSibling();
579 delete Lit; 579 delete Lit;
580 Lit = Nit; 580 Lit = Nit;
581 continue; 581 continue;
582 } 582 }
583 } else { 583 } else {
584 owarn << "NODOWN " << TheP->address().toString() << oendl; 584 odebug << "NODOWN " << TheP->address().toString() << oendl;
585 } 585 }
586 586
587 Lit = Lit->nextSibling(); 587 Lit = Lit->nextSibling();
588 } 588 }
589} 589}
590 590
@@ -603,13 +603,13 @@ void OTScan::SLOT_NewPeer( OTPeer * P, bool IsNew ){
603 break; 603 break;
604 } 604 }
605 Lit = Lit->nextSibling(); 605 Lit = Lit->nextSibling();
606 } 606 }
607 607
608 if( ! it ) { 608 if( ! it ) {
609 owarn << "Should not occur" << oendl; 609 odebug << "Should not occur" << oendl;
610 return; 610 return;
611 } 611 }
612 } 612 }
613 613
614 // update/show info 614 // update/show info
615 it->setText( 0, P->name() ); 615 it->setText( 0, P->name() );
@@ -926,13 +926,13 @@ void OTManage::SLOT_ShowDriver( QListViewItem * It ) {
926 926
927void OTManage::SLOT_UpDriver( bool Up ) { 927void OTManage::SLOT_UpDriver( bool Up ) {
928 QListViewItem * it = AllDrivers_LV->firstChild(); 928 QListViewItem * it = AllDrivers_LV->firstChild();
929 while( it ) { 929 while( it ) {
930 if( it->isSelected() ) { 930 if( it->isSelected() ) {
931 OTDriver * D = ((DriverLVI *)it)->driver(); 931 OTDriver * D = ((DriverLVI *)it)->driver();
932 owarn << "UP driver " << D->devname() << oendl; 932 odebug << "UP driver " << D->devname() << oendl;
933 // this 933 // this
934 D->setUp( Up ); 934 D->setUp( Up );
935 return; 935 return;
936 } 936 }
937 it = it->nextSibling(); 937 it = it->nextSibling();
938 } 938 }
diff --git a/noncore/settings/networksettings2/opietooth2/config.in b/noncore/settings/networksettings2/opietooth2/config.in
index 720f49a..084e8c0 100644
--- a/noncore/settings/networksettings2/opietooth2/config.in
+++ b/noncore/settings/networksettings2/opietooth2/config.in
@@ -1,5 +1,5 @@
1config NS2OPIETOOTH 1config NS2OPIETOOTH
2 boolean "opie-networksettings2 bluetooth library" 2 boolean "Opietooth2 bluetooth library"
3 default "y" 3 default "y"
4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE 4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBBLUEZ_DEP && NS2CORE
5 5
diff --git a/noncore/settings/networksettings2/opietooth2/libopietooth2.postinst b/noncore/settings/networksettings2/opietooth2/libopietooth2.postinst
index cd605c2..2713c61 100755
--- a/noncore/settings/networksettings2/opietooth2/libopietooth2.postinst
+++ b/noncore/settings/networksettings2/opietooth2/libopietooth2.postinst
@@ -2,9 +2,9 @@
2 2
3QTPB=/opt/QtPalmtop/bin 3QTPB=/opt/QtPalmtop/bin
4 4
5[ ! -L ${QTPB}/networksettings2-opietooth ] && ln -sf ${QTPB}/networksettings2 ${QTPB}/networksettings2-opietooth 5[ ! -L ${QTPB}/networksettings2-opietooth ] && ln -sf ${QTPB}/networksettings2 ${QTPB}/networksettings2-opietooth
6 6
7# qcop QPE/Taskbar "linkChanged(opietooth)" 7# qcop QPE/Taskbar "linkChanged(opietooth)"
8qcop QPE/Taskbar "reloadApps()" 8${QTPB}/qcop QPE/Taskbar "reloadApps()"
9 9
10exit 0 10exit 0
diff --git a/noncore/settings/networksettings2/opietooth2/opietooth2.pro b/noncore/settings/networksettings2/opietooth2/opietooth2.pro
index e0057a9..16277cf 100644
--- a/noncore/settings/networksettings2/opietooth2/opietooth2.pro
+++ b/noncore/settings/networksettings2/opietooth2/opietooth2.pro
@@ -32,6 +32,13 @@ DEPENDPATH += $(OPIEDIR)/include
32LIBS += -lqpe -lopiecore2 -lbluetooth -lnetworksettings2 32LIBS += -lqpe -lopiecore2 -lbluetooth -lnetworksettings2
33 INTERFACES= OTMainGUI.ui OTSniffGUI.ui OTScanGUI.ui OTManageGUI.ui OTPairingGUI.ui 33 INTERFACES= OTMainGUI.ui OTSniffGUI.ui OTScanGUI.ui OTManageGUI.ui OTPairingGUI.ui
34 TARGET = opietooth2 34 TARGET = opietooth2
35 VERSION = 1.0.0 35 VERSION = 1.0.0
36 36
37include ( $(OPIEDIR)/include.pro ) 37include ( $(OPIEDIR)/include.pro )
38
39!isEmpty( LIBBLUEZ_INC_DIR ) {
40 INCLUDEPATH += $$LIBBLUEZ_INC_DIR
41}
42!isEmpty( LIBBLUEZ_LIB_DIR ) {
43 LIBS += -L$$LIBBLUEZ_LIB_DIR
44}