24 files changed, 139 insertions, 137 deletions
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.cpp b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.cpp index ef6878a..3df7f5c 100644 --- a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.cpp +++ b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.cpp @@ -23,9 +23,9 @@ State_t BluetoothRFCOMMRun::detectState( void ) { if( deviceNrOfConnection() >= 0 ) { return Available; } - owarn << "Bluetooth " + odebug << "Bluetooth " << OT->isEnabled() << oendl; return ( OT->isEnabled() ) ? Off : Unavailable; @@ -118,9 +118,9 @@ RFCOMMChannel * BluetoothRFCOMMRun::getChannel( void ) { if( Dlg->exec() == QDialog::Accepted ) { unsigned int i = 0; for( i = 0; i < Data->Devices.count(); i ++ ) { if( LB->isSelected(i) ) { - owarn << "Selected " << Data->Devices[i]->Name << oendl; + odebug << "Selected " << Data->Devices[i]->Name << oendl; Ch = Data->Devices[i]; break; } } @@ -146,17 +146,17 @@ int BluetoothRFCOMMRun::deviceNrOfConnection( void ) { } DeviceNr = -1; for( unsigned int i = 0; i < Data->Devices.count(); i ++ ) { - owarn << "Check for rfcomm on " + odebug << "Check for rfcomm on " << Data->Devices[i]->BDAddress << " " << Data->Devices[i]->Channel << oendl; if( ( DeviceNr = OT->connectedToRFCommChannel( OTDeviceAddress( Data->Devices[i]->BDAddress ), Data->Devices[i]->Channel ) ) >= 0 ) { - owarn << "Up " + odebug << "Up " << oendl; break; } } diff --git a/noncore/settings/networksettings2/bluetooth/config.in b/noncore/settings/networksettings2/bluetooth/config.in index 398cff1..1a76f96 100644 --- a/noncore/settings/networksettings2/bluetooth/config.in +++ b/noncore/settings/networksettings2/bluetooth/config.in @@ -1,4 +1,4 @@ config NS2BT boolean "opie-networksettings2plugin-bluetooth (set up BLUETOOTH)" default "n" if NS2 - depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && NS2CORE && NS2OPIETOOTH + depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && NS2CORE && NS2OPIETOOTH && LIBBLUEZ_DEP diff --git a/noncore/settings/networksettings2/config.in b/noncore/settings/networksettings2/config.in index d2b5f26..0236bab 100644 --- a/noncore/settings/networksettings2/config.in +++ b/noncore/settings/networksettings2/config.in @@ -2,9 +2,9 @@ source noncore/settings/networksettings2/opietooth2/config.in source noncore/settings/networksettings2/opietooth2_applet/config.in config NS2 - boolean + boolean "opie-networksettings2 application" default "y" depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && NS2CORE && NS2OPIETOOTH source noncore/settings/networksettings2/profile/config.in diff --git a/noncore/settings/networksettings2/editconnection.cpp b/noncore/settings/networksettings2/editconnection.cpp index 0c3ead6..717d9e9 100644 --- a/noncore/settings/networksettings2/editconnection.cpp +++ b/noncore/settings/networksettings2/editconnection.cpp @@ -154,9 +154,8 @@ NodeCollection * EditConnection::getTmpCollection( void ) { it = it->nextSibling(); } if( ! it ) { - owarn << "Radio not selected" << oendl; TmpIsValid = 0; return 0; } diff --git a/noncore/settings/networksettings2/gprs/GPRSrun.cpp b/noncore/settings/networksettings2/gprs/GPRSrun.cpp index e842b99..cccc71a 100644 --- a/noncore/settings/networksettings2/gprs/GPRSrun.cpp +++ b/noncore/settings/networksettings2/gprs/GPRSrun.cpp @@ -22,14 +22,14 @@ State_t GPRSRun::detectState( void ) { } // check ppp itself and figure out interface - owarn << "Check for ppp " << NC->name() << oendl; + odebug << "Check for ppp " << NC->name() << oendl; if( D.exists( QString("ppp-")+removeSpaces(NC->name())+".pid") ) { // get pid and check if pppd is still running QFile F( D.path()+"/ppp-"+removeSpaces(NC->name())+".pid"); - owarn << "PPP PID " << F.name() << oendl; + odebug << "PPP PID " << F.name() << oendl; if( F.open( IO_ReadOnly ) ) { QTextStream TS(&F); QString X = TS.readLine(); PPPPid = X.toULong(); @@ -42,9 +42,9 @@ State_t GPRSRun::detectState( void ) { // pppd is still up X = TS.readLine(); I = NSResources->system().findInterface(X); - owarn << "ppp running : IFace " << X << " = " << (long)I << oendl; + odebug << "ppp running : IFace " << X << " = " << (long)I << oendl; if( I ) { NC->assignInterface( I ); return (I->IsUp) ? IsUp : Available; @@ -87,9 +87,9 @@ QString GPRSRun::setMyState( NodeCollection * NC, Action_t A , bool ) { if( ! NSResources->system().execAsUser( SL ) ) { return QString("Cannot terminate pppd for %1").arg(NC->name()); } NC->assignInterface( 0 ); - owarn << "ppp stopped " << oendl; + odebug << "ppp stopped " << oendl; PPPPid = 0; } } diff --git a/noncore/settings/networksettings2/network/networkrun.cpp b/noncore/settings/networksettings2/network/networkrun.cpp index c17aa7f..2c93d9d 100644 --- a/noncore/settings/networksettings2/network/networkrun.cpp +++ b/noncore/settings/networksettings2/network/networkrun.cpp @@ -21,31 +21,30 @@ State_t NetworkRun::detectState( void ) { QString NetworkRun::setMyState( NodeCollection * NC, Action_t A, bool ) { // we handle UP and DOWN InterfaceInfo * II = NC->assignedInterface(); + if( ! II ) { + Log(( "no interface assigned." )); + return QString(); + } + + QStringList SL; + if( A == Up ) { // we can bring UP if lower level is available - QStringList SL; - SL << "ifup" - << QString().sprintf( "%s=%s-c%d-allowed", + SL << "ifup"; + } else if( A == Down ) { + SL << "ifdown"; + } else { + return QString(); + } + + SL << QString().sprintf( "%s=%s-c%d-allowed", II->Name.latin1(), II->Name.latin1(), nodeCollection()->number() ); - if( ! NSResources->system().runAsRoot( SL ) ) { - return QString("Cannot call %1").arg(SL.join(" ")); - } - return QString(); - } - - if( A == Down ) { - QStringList SL; - if( II ) { - SL << "ifdown" - << II->Name.latin1(); - if( ! NSResources->system().runAsRoot( SL ) ) { - return QString( "Cannot call %1" ).arg( SL.join( " " )); - } - } else { - Log(( "no interface assigned." )); - } - } + + if( ! NSResources->system().runAsRoot( SL ) ) { + return QString("Cannot call %1").arg(SL.join(" ")); + } + return QString(); } diff --git a/noncore/settings/networksettings2/networksettings.cpp b/noncore/settings/networksettings2/networksettings.cpp index 9680a96..78b6cce 100644 --- a/noncore/settings/networksettings2/networksettings.cpp +++ b/noncore/settings/networksettings2/networksettings.cpp @@ -108,11 +108,9 @@ NetworkSettings::NetworkSettings( QWidget *parent, NetworkSettings::~NetworkSettings() { QString S; - owarn << "Dispose NS" << oendl; if( NSD.isModified() ) { - owarn << "Modified" << oendl; S = NSD.saveSettings(); if( ! S.isEmpty() ) { S.insert( 0, "<p>" ); S.append( "</p>" ); @@ -285,14 +283,12 @@ void NetworkSettings::SLOT_ShowNode( QListBoxItem * LBI ) { bool FrmActive = 1; bool IsEnabled = 1; int leds = 0; - owarn << "State " << NC->state() << oendl; switch( NC->state() ) { case Disabled : // no further work IsEnabled = 0; FrmActive = 0; - owarn << "LEds " << leds << oendl; break; case Unknown : case Unchecked : case Unavailable : @@ -358,9 +354,9 @@ void NetworkSettings::SLOT_Disable( bool T ) { return; NodeCollection * NC = NSResources->findConnection( LBI->text() ); - owarn << "Prepare to disable" << oendl; + Log(( "Prepare to %sable\n", (T) ? "en" : "dis" )); Msg = NC->setState( (T) ? Disable : Enable ); if( ! Msg.isEmpty() ) { Msg.insert( 0, "<p>" ); Msg.append( "</p>" ); diff --git a/noncore/settings/networksettings2/networksettings2/config.in b/noncore/settings/networksettings2/networksettings2/config.in index b384e18..56e971e 100644 --- a/noncore/settings/networksettings2/networksettings2/config.in +++ b/noncore/settings/networksettings2/networksettings2/config.in @@ -1,5 +1,5 @@ config NS2CORE - boolean "opie-networksettings2 (TCP/IP network settings)" + boolean "opie-networksettings2 library" default "y" depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2UI diff --git a/noncore/settings/networksettings2/networksettings2/system.cpp b/noncore/settings/networksettings2/networksettings2/system.cpp index e642c08..f027d35 100644 --- a/noncore/settings/networksettings2/networksettings2/system.cpp +++ b/noncore/settings/networksettings2/networksettings2/system.cpp @@ -71,9 +71,9 @@ int System::runAsRoot( QStringList & S, MyProcess * Prc ) { S.prepend( "sudo" ); } if( getenv( "NS2TESTMODE" ) ) { - owarn << "TESTMODE !!! execute " + odebug << "TESTMODE !!! execute " << S.join( " ") << oendl; } else { MyProcess * P; @@ -105,15 +105,15 @@ int System::runAsRoot( QStringList & S, MyProcess * Prc ) { Log(("Executing %s\n", S.join( " " ).latin1() )); if( ! P->process().start( OProcess::DontCare, OProcess::AllOutput ) ) { - owarn << "Error starting " << S << oendl; + odebug << "Error starting " << S << oendl; if( ! Prc ) delete P; // error starting app return 0; } - owarn << "Started " << S << oendl; + odebug << "Started " << S << oendl; } // all is fine return 1; @@ -269,9 +269,9 @@ void System::probeInterfaces( void ) { } sockfd = socket(PF_INET, SOCK_DGRAM, 0); if(sockfd == -1) { - owarn << "Cannot open INET socket " + odebug << "Cannot open INET socket " << errno << " " << strerror( errno ) << oendl; @@ -281,9 +281,9 @@ void System::probeInterfaces( void ) { // read interfaces from /proc/dev/net // SIOCGIFCONF does not return ALL interfaces ???!? ProcDevNet = new QFile(PROCNETDEV); if( ! ProcDevNet->open(IO_ReadOnly) ) { - owarn << "Cannot open " + odebug << "Cannot open " << PROCNETDEV << " " << errno << " " @@ -508,9 +508,9 @@ void LogClose( void ) { QString removeSpaces( const QString & X ) { QString Y; Y = X.simplifyWhiteSpace(); Y.replace( QRegExp(" "), "_" ); - owarn << X << " **" << Y << "**" << oendl; + odebug << X << " **" << Y << "**" << oendl; return Y; } // @@ -547,9 +547,9 @@ void MyProcess::SLOT_Stdout( Opie::Core::OProcess * , char * Buf, int len ) { // now input is zero terminated StdoutBuffer += LB; - owarn << "Received " << len << " bytes on stdout" << oendl; + odebug << "Received " << len << " bytes on stdout" << oendl; // see if we have some lines (allow empty lines) QStringList SL = QStringList::split( "\n", StdoutBuffer, TRUE ); for( unsigned int i = 0; i < SL.count()-1; i ++ ) { @@ -568,9 +568,9 @@ void MyProcess::SLOT_Stderr( Opie::Core::OProcess * , char * Buf, int len ) { // now input is zero terminated StderrBuffer += LB; - owarn << "Received " << len << " bytes on stderr" << oendl; + odebug << "Received " << len << " bytes on stderr" << oendl; // see if we have some lines (allow empty lines) QStringList SL = QStringList::split( "\n", StderrBuffer, TRUE ); for( unsigned int i = 0; i < SL.count()-1; i ++ ) { diff --git a/noncore/settings/networksettings2/networksettings2/systemfile.cpp b/noncore/settings/networksettings2/networksettings2/systemfile.cpp index 8deef94..1b1988e 100644 --- a/noncore/settings/networksettings2/networksettings2/systemfile.cpp +++ b/noncore/settings/networksettings2/networksettings2/systemfile.cpp @@ -98,18 +98,18 @@ bool SystemFile::open( void ) { return 0; } } else { if( ! F ) { - owarn << "!!!!!!!!!!!!!!!!!! " << oendl; - owarn << "!!!! TESTMODE !!!!" << oendl; - owarn << "!!!!!!!!!!!!!!!!!! " << oendl; - owarn << "!!!!" << oendl; - owarn << "!!!! GENERATE " << Path << oendl; + odebug << "!!!!!!!!!!!!!!!!!! " << oendl; + odebug << "!!!! TESTMODE !!!!" << oendl; + odebug << "!!!!!!!!!!!!!!!!!! " << oendl; + odebug << "!!!!" << oendl; + odebug << "!!!! GENERATE " << Path << oendl; if( InAppend ) { - owarn << "!!!! In APPEND mode" << oendl; + odebug << "!!!! In APPEND mode" << oendl; } - owarn << "!!!!" << oendl; - owarn << "!!!!!!!!!!!!!!!!!!" << oendl; + odebug << "!!!!" << oendl; + odebug << "!!!!!!!!!!!!!!!!!!" << oendl; F = new QFile(); F->open( IO_WriteOnly, stderr ); } @@ -135,9 +135,9 @@ bool SystemFile::close( void ) { delete F; F = 0; if( ! InAppend ) { - owarn << "Rename " << OldP << " to " << Path << oendl; + odebug << "Rename " << OldP << " to " << Path << oendl; return ( rename( OldP.latin1(), Path.latin1() ) >= 0 ); } return 1; } diff --git a/noncore/settings/networksettings2/opie-networksettings2.postinst b/noncore/settings/networksettings2/opie-networksettings2.postinst index ce43274..d1d98ac 100755 --- a/noncore/settings/networksettings2/opie-networksettings2.postinst +++ b/noncore/settings/networksettings2/opie-networksettings2.postinst @@ -3,7 +3,7 @@ QTPB=/opt/QtPalmtop/bin [ ! -L ${QTPB}/networksettings2-request ] && ln -sf ${QTPB}/networksettings2 ${QTPB}/networksettings2-request -qcop QPE/TaskBar "reloadApps()" +${QTPB}/qcop QPE/TaskBar "reloadApps()" exit 0 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 @@ -102,9 +102,9 @@ bool OTDevice::detach(){ m_hciattach = 0; } if( kill( m_hciattachPid, 9) < 0 ) { - owarn << "could not stop " << errno << oendl; + odebug << "could not stop " << errno << oendl; emit error( tr( "Could not stop process" ) ); return FALSE; } m_hciattachPid = 0; @@ -167,9 +167,9 @@ void OTDevice::slotStdErr(OProcess* proc, char* chars, int len) { // collect output QCString string( chars, len+1 ); // \0 == +1 QString m_output; m_output.append( string.data() ); - owarn << m_output << oendl; + odebug << m_output << oendl; } } pid_t OTDevice::getPidOfHCIAttach( void ) { @@ -210,9 +210,9 @@ void OTDevice::detectDeviceType( QString & Device, QString & Mode, unsigned long & Speed ) { // detect device type and determine parms - owarn << "Detecting device" << oendl; + odebug << "Detecting device" << oendl; switch ( ODevice::inst()->model() ) { case Model_iPAQ_H39xx: Device = "/dev/tts/1"; Mode = "bcsp"; 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 @@ -149,9 +149,9 @@ OTDriver::OTDriver( OTGateway * _OT, struct hci_dev_info* di) : QObject( _OT ), IsUp = 0; Socket = 0; init(di); - owarn << "Driver " << devname() << oendl; + odebug << "Driver " << devname() << oendl; AutoClose = new QTimer( this ); connect( AutoClose, SIGNAL( timeout() ), @@ -384,9 +384,9 @@ void OTDriver::setUp( bool M ) { } void OTDriver::bringUp() { - owarn << "bringUp : " << Dev << oendl; + odebug << "bringUp : " << Dev << oendl; if( ! open() ) { return; } @@ -407,9 +407,9 @@ void OTDriver::bringUp() { } void OTDriver::bringDown() { - owarn << "bringDown : " << Dev << oendl; + odebug << "bringDown : " << Dev << oendl; if( ! open() ) { return; } @@ -660,17 +660,17 @@ void OTDriver::setManufacturer(int compid) { } OTHCISocket * OTDriver::openSocket( void ) { if( ! Socket ) { - owarn << "Open HCI socket to " << devname() << oendl; + odebug << "Open HCI socket to " << devname() << oendl; Socket = new OTHCISocket( this ); } return Socket; } void OTDriver::closeSocket( void ) { if( Socket ) { - owarn << "Close HCI socket to " << devname() << oendl; + odebug << "Close HCI socket to " << devname() << oendl; delete Socket; Socket = 0; } } @@ -712,9 +712,9 @@ long OTDriver::getLinkQuality( const OTDeviceAddress & Addr ) { bacpy( &(cr->bdaddr), &(Addr.getBDAddr()) ); cr->type = ACL_LINK; if (ioctl( fd(), HCIGETCONNINFO, (unsigned long) cr) < 0) { - owarn << "Get connection info failed" << oendl; + odebug << "Get connection info failed" << oendl; free(cr); return 0; } @@ -730,14 +730,14 @@ long OTDriver::getLinkQuality( const OTDeviceAddress & Addr ) { rq.rparam = &rp; rq.rlen = GET_LINK_QUALITY_RP_SIZE; if (hci_send_req( fd(), &rq, 100) < 0) { - owarn << "Get connection info failed" << oendl; + odebug << "Get connection info failed" << oendl; return 0; } if( rp.status ) { - owarn << QString().sprintf("HCI get_link_quality cmd failed (0x%2.2X)", rp.status) << oendl; + odebug << QString().sprintf("HCI get_link_quality cmd failed (0x%2.2X)", rp.status) << oendl; return 0; } return rp.rssi+50; 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 @@ -52,9 +52,9 @@ void OTDriverList::update() { dl->dev_num = cur; if( ioctl( OT->getSocket(), HCIGETDEVLIST, (void*)dl) ) { - owarn << "WARNING : cannot read device list. " + odebug << "WARNING : cannot read device list. " << errno << strerror( errno ) << oendl; return; } @@ -78,9 +78,9 @@ void OTDriverList::update() { continue; // uh ? insert( cur, new OTDriver( OT, &di ) ); } - owarn << "Found " << count() << " devices" << oendl; + odebug << "Found " << count() << " devices" << oendl; ::free( dl ); } } 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 @@ -153,9 +153,9 @@ bool OTGateway::isEnabled() { } void OTGateway::SLOT_ShowError( const QString & S ) { - owarn << S << oendl; + odebug << S << oendl; if( ErrorConnectCount > 0 ) { // pass error emit error( QString( "<p>" ) + S + "</p>" ); @@ -209,9 +209,9 @@ void OTGateway::timerEvent( QTimerEvent * ) { } } void OTGateway::SLOT_Enabled( int id, bool Up ) { - owarn << "device " << id << " state " << Up << oendl; + odebug << "device " << id << " state " << Up << oendl; if( Up ) { // device is up -> detect it updateDrivers(); if( (unsigned)id >= AllDrivers.count() ) { @@ -226,9 +226,9 @@ void OTGateway::updateDrivers( void ) { OTDriver * D; AllDrivers.update(); - owarn << "updated drivers. now " << AllDrivers.count() << oendl; + odebug << "updated drivers. now " << AllDrivers.count() << oendl; // connect signals for each driver for( unsigned int i = 0; i < AllDrivers.count(); @@ -264,9 +264,9 @@ void OTGateway::updateDrivers( void ) { emit driverListChanged(); } void OTGateway::SLOT_DriverDisappeared( OTDriver * D ) { - owarn << "Driver " << D->devname() << " when offline" << oendl; + odebug << "Driver " << D->devname() << " when offline" << oendl; updateDrivers(); } void OTGateway::scanNeighbourhood( OTDriver * D ) { @@ -317,9 +317,9 @@ OTDriver* OTGateway::findDriver( const OTDeviceAddress & Addr ) { void OTGateway::SLOT_PeerDetected( OTPeer * P, bool IsNew ) { if( IsNew ) { // new peer - owarn << "New peer " << P->name() << oendl; + odebug << "New peer " << P->name() << oendl; addPeer( P ); } emit detectedPeer( P, IsNew ); @@ -383,16 +383,16 @@ PANConnectionVector OTGateway::getPANConnections( void ) { V.setAutoDelete(TRUE); int ctl = socket(PF_BLUETOOTH, SOCK_RAW, BTPROTO_BNEP); if (ctl < 0) { - owarn << "Failed to open control socket" << oendl; + odebug << "Failed to open control socket" << oendl; return V; } req.cnum = 48; req.ci = ci; if (ioctl(ctl, BNEPGETCONNLIST, &req)) { - owarn << "Failed to get connection list" << oendl; + odebug << "Failed to get connection list" << oendl; ::close( ctl ); return V; } 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 @@ -33,9 +33,9 @@ OTHCISocket::~OTHCISocket() { close(); } void OTHCISocket::close() { - owarn << "OTHCISocket::close()" << oendl; + odebug << "OTHCISocket::close()" << oendl; if( HCIReadNotifier ) { delete HCIReadNotifier; } @@ -45,9 +45,9 @@ void OTHCISocket::close() { } bool OTHCISocket::open() { - owarn << "OTHCISocket::open()" << oendl; + odebug << "OTHCISocket::open()" << oendl; int s; s = ::socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI); @@ -150,9 +150,9 @@ void OTHCISocket::slotSocketActivated() { if (eventCode == EVT_CMD_STATUS) { updateStatus( databuf ); } } else { - owarn << "Error reading hci packet: packetSize(" + odebug << "Error reading hci packet: packetSize(" << psize << ")-3 != dataSize(" << len << ")" @@ -182,9 +182,9 @@ void OTHCISocket::updateStatus(const QByteArray& data) { LastStatusOcf = cmd_opcode_ocf(opcode); } void OTHCISocket::slotConnectionClosed() { - owarn << "HCI connection closed." << oendl; + odebug << "HCI connection closed." << oendl; emit connectionClosed(); } void OTHCISocket::readEvent() { @@ -229,9 +229,9 @@ bool OTHCISocket::readStatus( unsigned char ogf, BStatusSet = false; while (timer.isActive() && HCISocket.isValid()) { - owarn << "OTHCISocket::readStatus()" << oendl; + odebug << "OTHCISocket::readStatus()" << oendl; bool timeout = false; if( HCISocket.bytesAvailable() == 0) { int rv = HCISocket.waitForMore(timeout_ms); @@ -245,9 +245,9 @@ bool OTHCISocket::readStatus( unsigned char ogf, if( BStatusSet == true && ogf == LastStatusOgf && ocf == LastStatusOcf) { *status = LastStatus; - owarn << "OTHCISocket::readStatus(ogf=" + odebug << "OTHCISocket::readStatus(ogf=" << ogf << ",ocf=" << ocf << ",timeout=" @@ -257,9 +257,9 @@ bool OTHCISocket::readStatus( unsigned char ogf, return true; } } - owarn << "OTHCISocket::readStatus(ogf=" + odebug << "OTHCISocket::readStatus(ogf=" << ogf << ",ocf=" << ocf << ",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 @@ -58,9 +58,9 @@ OTInquiry::~OTInquiry() { } void OTInquiry::stopInquiring( void ) { if( Socket ) { - owarn << "Stop inquiry" << oendl; + odebug << "Stop inquiry" << oendl; Driver->closeSocket(); Socket = 0; } } @@ -74,9 +74,9 @@ bool OTInquiry::inquire( double timeout, int numResponses, int lap) { cmdBuf[2] = (lap >> 16) & 0xFF; cmdBuf[3] = max(0x01, min(0x30, int(timeout/1.28))); cmdBuf[4] = (unsigned char)numResponses; - owarn << "Send HCI inquiry command. wait for " << cmdBuf[3] << oendl; + odebug << "Send HCI inquiry command. wait for " << cmdBuf[3] << oendl; Socket->sendCommand(0x01, 0x0001, cmdBuf); int status; @@ -88,14 +88,14 @@ bool OTInquiry::inquire( double timeout, int numResponses, int lap) { return true; } else { QString S =QString().sprintf( "%x", status ); - owarn << "OTInquiry::inquiry() failed: 0x" << S << oendl; + odebug << "OTInquiry::inquiry() failed: 0x" << S << oendl; emit finished(); return false; } } else { - owarn << "OTInquiry::inquiry(): Timeout." << oendl; + odebug << "OTInquiry::inquiry(): Timeout." << oendl; return false; } } @@ -125,9 +125,9 @@ void OTInquiry::slotInquiryTimeout() { } void OTInquiry::slotHCIEvent(unsigned char eventCode, QByteArray buf) { - owarn << "OTInquiry: hci packet received: eventCode=" + odebug << "OTInquiry: hci packet received: eventCode=" << (unsigned int)eventCode << " packetLength=" << (unsigned int)buf.size() << oendl; @@ -135,13 +135,13 @@ void OTInquiry::slotHCIEvent(unsigned char eventCode, QByteArray buf) { unsigned char *data = (unsigned char*)buf.data(); switch (eventCode) { case EVT_INQUIRY_COMPLETE: { unsigned char status = data[0]; - owarn << "EVT_INQUIRY_COMPLETE status=" << status << oendl; + odebug << "EVT_INQUIRY_COMPLETE status=" << status << oendl; InquiryTimeoutTimer->stop(); if (status == 0) { if( SuccessfullyStarted == true) { - owarn << "OTInquiry ended successfully" << oendl; + odebug << "OTInquiry ended successfully" << oendl; SuccessfullyEnded = true; } emit finished(); } @@ -162,9 +162,9 @@ void OTInquiry::slotHCIEvent(unsigned char eventCode, QByteArray buf) { for (int n=0; n<numResults; n++) { Addr.setBDAddr( results[n].bdaddr ); - owarn << "INQUIRY_RESULT: " + odebug << "INQUIRY_RESULT: " << Addr.toString() << oendl; P = Driver->gateway()->findPeer( Addr ); @@ -202,9 +202,9 @@ void OTInquiry::slotHCIEvent(unsigned char eventCode, QByteArray buf) { case EVT_CMD_STATUS : { int status = data[0]; int numHciCmdPkts = data[1]; int cmdOpcode = *((uint16_t*)(data+2)); - owarn << "EVT_CMD_STATUS status=" + odebug << "EVT_CMD_STATUS status=" << status << " numPkts=" << numHciCmdPkts << " cmdOpcode=" 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 @@ -50,16 +50,16 @@ void OTPeer::updateServices( void ) { sdp_session_t *session; serviceList.clear(); - owarn << "Get services from " << Addr.toString() << oendl; + odebug << "Get services from " << Addr.toString() << oendl; session = sdp_connect( &(OTDeviceAddress::any.getBDAddr()), &(Addr.getBDAddr()), 0); if (!session) { - owarn << "sdp_connect(" + odebug << "sdp_connect(" << Addr.toString() << ") failed" << oendl; return; // error @@ -79,9 +79,9 @@ void OTPeer::updateServices( void ) { search, SDP_ATTR_REQ_RANGE, attrId, &seq ) ) { - owarn << "Service Search failed" << oendl; + odebug << "Service Search failed" << oendl; sdp_close(session); return; } @@ -176,9 +176,9 @@ void OTPeer::findOutState( int timeoutInSec, bool Force ) { if( State == OTPeer::Peer_Unknown ) { ProbePhase = 0; ProbeTimeout = timeoutInSec*1000; - owarn << "Ping " << address().toString() << oendl; + odebug << "Ping " << address().toString() << oendl; startTimer( POLLDELAY ); } else { ProbeTimeout = 0; startTimer( 0 ); @@ -234,9 +234,9 @@ void OTPeer::timerEvent( QTimerEvent * ev ) { pf[0].fd = ProbeFD; pf[0].events = POLLOUT; if( (n = ::poll(pf, 1, 0)) < 0 ) { - owarn << address().toString() + odebug << address().toString() << " : errno " << errno << " " << strerror(errno)<<oendl; @@ -265,9 +265,9 @@ void OTPeer::timerEvent( QTimerEvent * ev ) { if( errno == EACCES ) { // permission denied means that we could not // connect because the device does not allow us // but it is UP - owarn << address().toString() + odebug << address().toString() << " good send error " << errno << " " << strerror( errno) @@ -275,9 +275,9 @@ void OTPeer::timerEvent( QTimerEvent * ev ) { State = OTPeer::Peer_Up; ProbeTimeout = 0; break; } else if( errno != EBUSY ) { - owarn << address().toString() + odebug << address().toString() << " : errno " << errno << " " << strerror(errno) @@ -298,9 +298,9 @@ void OTPeer::timerEvent( QTimerEvent * ev ) { pf[0].fd = ProbeFD; pf[0].events = POLLIN; if( (n = ::poll(pf, 1, 0)) < 0 ) { - owarn << address().toString() + odebug << address().toString() << " : errno " << errno << " " << strerror(errno) @@ -314,9 +314,9 @@ void OTPeer::timerEvent( QTimerEvent * ev ) { break; } if( (n = ::recv( ProbeFD, buf, sizeof(buf), 0)) < 0) { - owarn << address().toString() + odebug << address().toString() << "errno " << errno << " " << strerror(errno) @@ -329,9 +329,9 @@ void OTPeer::timerEvent( QTimerEvent * ev ) { if( cmd->ident != *(char *)this ) // not our reply break; - owarn << "reply from " + odebug << "reply from " << address().toString() << oendl; // whatever reply we get is a valid reply State = OTPeer::Peer_Up; 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 @@ -536,9 +536,9 @@ void OTScan::SLOT_Selected( QListViewItem * it ) { SelectedPeer = ((PeerLVI *)it)->peer(); SelectedChannel = 0; } - owarn << "Selected " << SelectedPeer->address().toString() << + odebug << "Selected " << SelectedPeer->address().toString() << " Channel " << SelectedChannel << oendl; emit selected(); } @@ -564,15 +564,15 @@ void OTScan::SLOT_CleanupOld( ) { if( TheP->address() == Keys[k].to() || TheP->address() == Keys[k].from() ) { // part of linkkey - owarn << "LINKKEY " << TheP->address().toString() << oendl; + odebug << "LINKKEY " << TheP->address().toString() << oendl; break; } } if( k == Keys.count() ) { - owarn << "RM LINKKEY " << TheP->address().toString() << oendl; + odebug << "RM LINKKEY " << TheP->address().toString() << oendl; // not found -> remember to remove this peer QListViewItem * Nit; OT->removePeer( TheP ); Nit = Lit->nextSibling(); @@ -580,9 +580,9 @@ void OTScan::SLOT_CleanupOld( ) { Lit = Nit; continue; } } else { - owarn << "NODOWN " << TheP->address().toString() << oendl; + odebug << "NODOWN " << TheP->address().toString() << oendl; } Lit = Lit->nextSibling(); } @@ -605,9 +605,9 @@ void OTScan::SLOT_NewPeer( OTPeer * P, bool IsNew ){ Lit = Lit->nextSibling(); } if( ! it ) { - owarn << "Should not occur" << oendl; + odebug << "Should not occur" << oendl; return; } } @@ -928,9 +928,9 @@ void OTManage::SLOT_UpDriver( bool Up ) { QListViewItem * it = AllDrivers_LV->firstChild(); while( it ) { if( it->isSelected() ) { OTDriver * D = ((DriverLVI *)it)->driver(); - owarn << "UP driver " << D->devname() << oendl; + odebug << "UP driver " << D->devname() << oendl; // this D->setUp( Up ); return; } 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 @@ config NS2OPIETOOTH - boolean "opie-networksettings2 bluetooth library" + boolean "Opietooth2 bluetooth library" default "y" - depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE + depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBBLUEZ_DEP && NS2CORE 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 @@ -4,7 +4,7 @@ QTPB=/opt/QtPalmtop/bin [ ! -L ${QTPB}/networksettings2-opietooth ] && ln -sf ${QTPB}/networksettings2 ${QTPB}/networksettings2-opietooth # qcop QPE/Taskbar "linkChanged(opietooth)" -qcop QPE/Taskbar "reloadApps()" +${QTPB}/qcop QPE/Taskbar "reloadApps()" exit 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 @@ -34,4 +34,11 @@ INTERFACES = OTMainGUI.ui OTSniffGUI.ui OTScanGUI.ui OTManageGUI.ui OTPairingGUI TARGET = opietooth2 VERSION = 1.0.0 include ( $(OPIEDIR)/include.pro ) + +!isEmpty( LIBBLUEZ_INC_DIR ) { + INCLUDEPATH += $$LIBBLUEZ_INC_DIR +} +!isEmpty( LIBBLUEZ_LIB_DIR ) { + LIBS += -L$$LIBBLUEZ_LIB_DIR +} diff --git a/noncore/settings/networksettings2/profile/profilerun.cpp b/noncore/settings/networksettings2/profile/profilerun.cpp index ab57a00..acb67bd 100644 --- a/noncore/settings/networksettings2/profile/profilerun.cpp +++ b/noncore/settings/networksettings2/profile/profilerun.cpp @@ -9,9 +9,9 @@ State_t ProfileRun::detectState( void ) { return Unknown; } QString ProfileRun::setMyState( NodeCollection * NC, Action_t A, bool ) { - owarn << "Profile " << Data->Disabled << oendl; + odebug << "Profile " << Data->Disabled << oendl; if( A == Disable ) { if( ! Data->Disabled ) { Data->Disabled = 1; NC->setModified( 1 ); diff --git a/noncore/settings/networksettings2/usb/usbrun.cpp b/noncore/settings/networksettings2/usb/usbrun.cpp index eb439c1..de8c8a2 100644 --- a/noncore/settings/networksettings2/usb/usbrun.cpp +++ b/noncore/settings/networksettings2/usb/usbrun.cpp @@ -37,8 +37,9 @@ State_t USBRun::detectState( void ) { } } Log(("Assigned %p\n", NC->assignedInterface() )); + if( ( Run = NC->assignedInterface() ) ) { // we already have an interface assigned -> still present ? if( ! Run->IsUp ) { // usb is still free -> keep assignment @@ -49,62 +50,62 @@ State_t USBRun::detectState( void ) { // nothing (valid) assigned to us NC->assignInterface( 0 ); // find possible interface - for( QDictIterator<InterfaceInfo> It(Sys.interfaces()); - It.current(); - ++It ) { - Run = It.current(); - - Log(("%s %d %d=%d %d\n", - Run->Name.latin1(), - handlesInterface( Run->Name ), - Run->CardType, ARPHRD_ETHER, - ! Run->IsUp )); - - if( handlesInterface( Run->Name ) && - Run->CardType == ARPHRD_ETHER && - ! Run->IsUp - ) { - // proper type, and Not UP -> free - // usb cables are currently always available when requested - // until we can detect if we are plugged in - return Available; - } + if( getInterface() ) { + // proper type, and Not UP -> free + // usb cables are currently always available when requested + // until we can detect if we are plugged in + return Available; } return Unavailable; } QString USBRun::setMyState( NodeCollection * NC, Action_t A, bool ) { - // nothing needs to be done to 'activate' or 'deactivate' - // a cable + InterfaceInfo * I = getInterface(); + + if( ! I ) { + return QString("No usb device available"); + } + + Log(( "Grabbed USB interface %s\n", I->Name.latin1() )); + // grab this interface + NC->assignInterface( I ); + return QString(); } // get interface that is free or assigned to us InterfaceInfo * USBRun::getInterface( void ) { System & S = NSResources->system(); InterfaceInfo * best = 0, * Run; - QRegExp R( "usb[0-9abcdef]" ); for( QDictIterator<InterfaceInfo> It(S.interfaces()); It.current(); ++It ) { Run = It.current(); + + Log(("%s %d %d=%d %d\n", + Run->Name.latin1(), + handlesInterface( Run->Name ), + Run->CardType, ARPHRD_ETHER, + ! Run->IsUp )); + if( handlesInterface( Run->Name ) && Run->CardType == ARPHRD_ETHER ) { // this is a USB card if( Run->assignedConnection() == netNode()->connection() ) { // assigned to us return Run; - } else if( Run->assignedConnection() == 0 ) { + } else if( ! Run->IsUp && + Run->assignedConnection() == 0 ) { // free best = Run; - } + } // UP or not assigned to us } } return best; // can be 0 } |