summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/appearance2/appearance.cpp4
-rw-r--r--noncore/settings/networksettings/ppp/modem.cpp52
-rw-r--r--noncore/settings/networksettings/wlan/wlanimp2.cpp29
3 files changed, 43 insertions, 42 deletions
diff --git a/noncore/settings/appearance2/appearance.cpp b/noncore/settings/appearance2/appearance.cpp
index f918767..9638686 100644
--- a/noncore/settings/appearance2/appearance.cpp
+++ b/noncore/settings/appearance2/appearance.cpp
@@ -30,24 +30,25 @@
#include "appearance.h"
#include "editScheme.h"
#include "stylelistitem.h"
#include "decolistitem.h"
#include "colorlistitem.h"
#include "exceptlistitem.h"
#include "sample.h"
/* OPIE */
#include <opie2/odevice.h>
#include <opie2/ofiledialog.h>
#include <opie2/otabwidget.h>
+#include <opie2/odebug.h>
#include <qpe/config.h>
#include <qpe/global.h>
#include <qpe/qpeapplication.h>
#include <qpe/qpemessagebox.h>
#include <qpe/qcopenvelope_qws.h>
#include <qpe/qpestyle.h>
#include <qpe/lightstyle.h>
#include <qpe/styleinterface.h>
/* QT */
#include <qbuttongroup.h>
@@ -823,25 +824,26 @@ public:
setFrame ( false );
QRect r = it-> listView ( )-> itemRect ( it );
int x = it-> listView ( )-> header ( )-> cellPos ( 3 ) - 1;
int y = r. y ( );
int w = it-> listView ( )-> viewport ( )-> width ( ) - x;
int h = r. height ( ); // + 2;
setText ( it-> pattern ( ));
setGeometry ( x, y, w, h );
- qDebug ( "ExEdit: [%s] at %d,%d %d,%d", it->text(2).latin1(),x,y,w,h);
+ odebug << "ExEdit: [" << it->text(2).latin1() << "] at "
+ << x << "," << y << " " << w << "," << h << oendl;
m_out = true;
show ( );
setFocus ( );
selectAll ( );
end ( true );
}
virtual void focusOutEvent ( QFocusEvent * )
{
hide ( );
diff --git a/noncore/settings/networksettings/ppp/modem.cpp b/noncore/settings/networksettings/ppp/modem.cpp
index 5913a22..3bc7d43 100644
--- a/noncore/settings/networksettings/ppp/modem.cpp
+++ b/noncore/settings/networksettings/ppp/modem.cpp
@@ -161,25 +161,25 @@ speed_t Modem::modemspeed() {
return B38400;
break;
}
}
bool Modem::opentty() {
// int flags;
//begin if((modemfd = Requester::rq->openModem(gpppdata.modemDevice()))<0) {
close(modemfd);
device = _pppdata->modemDevice();
if ((modemfd = open(device, O_RDWR|O_NDELAY|O_NOCTTY)) == -1) {
- odebug << "error opening modem device !" << oendl;
+ odebug << "error opening modem device !" << oendl;
errmsg = QObject::tr("Unable to open modem.");
return false;
}
//bend if((modemfd = Requester::rq->openModem(gpppdata.modemDevice()))<0) {
//}
#if 0
if(_pppdata->UseCDLine()) {
if(ioctl(modemfd, TIOCMGET, &flags) == -1) {
errmsg = QObject::tr("Unable to detect state of CD line.");
::close(modemfd);
modemfd = -1;
@@ -302,56 +302,56 @@ void Modem::notify(const QObject *receiver, const char *member) {
void Modem::stop() {
disconnect(SIGNAL(charWaiting(unsigned char)));
stopNotifier();
}
void Modem::startNotifier() {
if(modemfd >= 0) {
if(sn == 0) {
sn = new QSocketNotifier(modemfd, QSocketNotifier::Read, this);
connect(sn, SIGNAL(activated(int)), SLOT(readtty(int)));
- odebug << "QSocketNotifier started!" << oendl;
+ odebug << "QSocketNotifier started!" << oendl;
} else {
- odebug << "QSocketNotifier re-enabled!" << oendl;
+ odebug << "QSocketNotifier re-enabled!" << oendl;
sn->setEnabled(true);
}
}
}
void Modem::stopNotifier() {
if(sn != 0) {
sn->setEnabled(false);
disconnect(sn);
delete sn;
sn = 0;
- odebug << "QSocketNotifier stopped!" << oendl;
+ odebug << "QSocketNotifier stopped!" << oendl;
}
}
void Modem::flush() {
char c;
while(read(modemfd, &c, 1) == 1);
}
bool Modem::writeChar(unsigned char c) {
int s;
do {
s = write(modemfd, &c, 1);
if (s < 0) {
- oerr << "write() in Modem::writeChar failed" << oendl;
+ oerr << "write() in Modem::writeChar failed" << oendl;
return false;
}
} while(s == 0);
return true;
}
bool Modem::writeLine(const char *buf) {
int len = strlen(buf);
char *b = new char[len+2];
memcpy(b, buf, len);
@@ -361,25 +361,25 @@ bool Modem::writeLine(const char *buf) {
b[len++]='\n';
else if(term == "CR")
b[len++]='\r';
else if(term == "CR/LF") {
b[len++]='\r';
b[len++]='\n';
}
int l = len;
while(l) {
int wr = write(modemfd, &b[len-l], l);
if(wr < 0) {
// TODO do something meaningful with the error code (or ignore it
- oerr << "write() in Modem::writeLine failed" << oendl;
+ oerr << "write() in Modem::writeLine failed" << oendl;
delete[] b;
return false;
}
l -= wr;
}
delete[] b;
return true;
}
bool Modem::hangup() {
// this should really get the modem to hang up and go into command mode
@@ -470,25 +470,25 @@ void Modem::escape_to_command_mode() {
const QString Modem::modemMessage() {
return errmsg;
}
QString Modem::parseModemSpeed(const QString &s) {
// this is a small (and bad) parser for modem speeds
int rx = -1;
int tx = -1;
int i;
QString result;
- odebug << "Modem reported result string: " << s.latin1() << "" << oendl;
+ odebug << "Modem reported result string: " << s.latin1() << "" << oendl;
const int RXMAX = 7;
const int TXMAX = 2;
QRegExp rrx[RXMAX] = {
QRegExp("[0-9]+[:/ ]RX", false),
QRegExp("[0-9]+RX", false),
QRegExp("[/: -][0-9]+[/: ]", false),
QRegExp("[/: -][0-9]+$", false),
QRegExp("CARRIER [^0-9]*[0-9]+", false),
QRegExp("CONNECT [^0-9]*[0-9]+", false),
QRegExp("[0-9]+") // panic mode
};
@@ -556,131 +556,131 @@ QString Modem::parseModemSpeed(const QString &s) {
}
}
if(rx == -1 && tx == -1)
result = QObject::tr("Unknown speed");
else if(tx == -1)
result.setNum(rx);
else if(rx == -1) // should not happen
result.setNum(tx);
else
result.sprintf("%d/%d", rx, tx);
- odebug << "The parsed result is: " << result.latin1() << "" << oendl;
+ odebug << "The parsed result is: " << result.latin1() << "" << oendl;
return result;
}
// Lock modem device. Returns 0 on success 1 if the modem is locked and -1 if
// a lock file can't be created ( permission problem )
int Modem::lockdevice() {
int fd;
char newlock[80]=""; // safe
if(!_pppdata->modemLockFile()) {
- odebug << "The user doesn't want a lockfile." << oendl;
+ odebug << "The user doesn't want a lockfile." << oendl;
return 0;
}
if (modem_is_locked)
return 1;
QString lockfile = LOCK_DIR"/LCK..";
lockfile += _pppdata->modemDevice().mid(5); // append everything after /dev/
if(access(QFile::encodeName(lockfile), F_OK) == 0) {
// if ((fd = Requester::rq->
if ((fd = openLockfile(QFile::encodeName(lockfile), O_RDONLY)) >= 0) {
// Mario: it's not necessary to read more than lets say 32 bytes. If
// file has more than 32 bytes, skip the rest
char oldlock[33]; // safe
int sz = read(fd, &oldlock, 32);
close (fd);
if (sz <= 0)
return 1;
oldlock[sz] = '\0';
- odebug << "Device is locked by: " << oldlock << "" << oendl;
+ odebug << "Device is locked by: " << oldlock << "" << oendl;
int oldpid;
int match = sscanf(oldlock, "%d", &oldpid);
// found a pid in lockfile ?
if (match < 1 || oldpid <= 0)
return 1;
// check if process exists
if (kill((pid_t)oldpid, 0) == 0 || errno != ESRCH)
return 1;
- odebug << "lockfile is stale" << oendl;
+ odebug << "lockfile is stale" << oendl;
}
}
fd = openLockfile(_pppdata->modemDevice(),O_WRONLY|O_TRUNC|O_CREAT);
if(fd >= 0) {
sprintf(newlock,"%010d\n", getpid());
- odebug << "Locking Device: " << newlock << "" << oendl;
+ odebug << "Locking Device: " << newlock << "" << oendl;
write(fd, newlock, strlen(newlock));
close(fd);
modem_is_locked=true;
return 0;
}
return -1;
}
// UnLock modem device
void Modem::unlockdevice() {
if (modem_is_locked) {
- odebug << "UnLocking Modem Device" << oendl;
+ odebug << "UnLocking Modem Device" << oendl;
close(modemfd);
modemfd = -1;
unlink(lockfile);
lockfile[0] = '\0';
modem_is_locked=false;
}
}
int Modem::openLockfile( QString lockfile, int flags)
{
int fd;
int mode;
flags = O_RDONLY;
if(flags == O_WRONLY|O_TRUNC|O_CREAT)
mode = 0644;
else
mode = 0;
lockfile = LOCK_DIR;
lockfile += "/LCK..";
lockfile += device.right( device.length() - device.findRev("/") -1 );
- odebug << "lockfile >" << lockfile.latin1() << "<" << oendl;
+ odebug << "lockfile >" << lockfile.latin1() << "<" << oendl;
// TODO:
// struct stat st;
// if(stat(lockfile.data(), &st) == -1) {
// if(errno == EBADF)
// return -1;
// } else {
// // make sure that this is a regular file
// if(!S_ISREG(st.st_mode))
// return -1;
// }
if ((fd = open(lockfile, flags, mode)) == -1) {
- odebug << "error opening lockfile!" << oendl;
+ odebug << "error opening lockfile!" << oendl;
lockfile = QString::null;
fd = open(DEVNULL, O_RDONLY);
} else
fchown(fd, 0, 0);
return fd;
}
void alarm_handler(int) {
// fprintf(stderr, "alarm_handler(): Received SIGALRM\n");
@@ -923,60 +923,60 @@ bool Modem::execpppd(const char *arguments) {
fprintf(stderr, "Kernel does not support ppp, oops.\n");
break;
case 0:
fprintf(stderr, "Kernel supports ppp alright.\n");
break;
}
execve(pppdPath(), args, 0L);
_exit(0);
break;
default:
- odebug << "In parent: pppd pid " << pppdPid << "\n" << oendl;
+ odebug << "In parent: pppd pid " << pppdPid << "\n" << oendl;
close(modemfd);
::close( m_pppdLOG[1] );
// set it to nonblocking io
int flag = ::fcntl( m_pppdLOG[0], F_GETFL );
if ( !(flag & O_NONBLOCK) ) {
- odebug << "Setting nonblocking io" << oendl;
+ odebug << "Setting nonblocking io" << oendl;
flag |= O_NONBLOCK;
::fcntl(m_pppdLOG[0], F_SETFL, flag );
}
delete m_modemDebug;
m_modemDebug = new QSocketNotifier(m_pppdLOG[0], QSocketNotifier::Read, this );
connect(m_modemDebug, SIGNAL(activated(int) ),
this, SLOT(slotModemDebug(int) ) );
modemfd = -1;
m_pppdDev = QString::fromLatin1("ppp0");
return true;
break;
}
}
bool Modem::killpppd() {
- odebug << "In killpppd and pid is " << pppdPid << "" << oendl;
+ odebug << "In killpppd and pid is " << pppdPid << "" << oendl;
if(pppdPid > 0) {
delete m_modemDebug;
m_modemDebug = 0;
- odebug << "In killpppd(): Sending SIGTERM to " << pppdPid << "\n" << oendl;
+ odebug << "In killpppd(): Sending SIGTERM to " << pppdPid << "\n" << oendl;
if(kill(pppdPid, SIGTERM) < 0) {
- odebug << "Error terminating " << pppdPid << ". Sending SIGKILL\n" << oendl;
+ odebug << "Error terminating " << pppdPid << ". Sending SIGKILL\n" << oendl;
if(kill(pppdPid, SIGKILL) < 0) {
- odebug << "Error killing " << pppdPid << "\n" << oendl;
+ odebug << "Error killing " << pppdPid << "\n" << oendl;
return false;
}
}
}
return true;
}
void Modem::parseargs(char* buf, char** args) {
int nargs = 0;
int quotes;
@@ -995,29 +995,29 @@ void Modem::parseargs(char* buf, char** args) {
quotes = *buf;
*buf++ = '\0';
}
// save the argument
if(*buf != '\0') {
*args++ = buf;
nargs++;
}
if (!quotes)
while ((*buf != '\0') && (*buf != '\n') &&
- (*buf != '\t') && (*buf != ' '))
- buf++;
+ (*buf != '\t') && (*buf != ' '))
+ buf++;
else {
while ((*buf != '\0') && (*buf != quotes))
- buf++;
+ buf++;
*buf++ = '\0';
}
}
*args = 0L;
}
bool Modem::execPPPDaemon(const QString & arguments)
{
if(execpppd(arguments)) {
_pppdata->setpppdRunning(true);
return true;
@@ -1031,46 +1031,46 @@ void Modem::killPPPDaemon()
killpppd();
}
int Modem::pppdExitStatus()
{
return _pppdExitStatus;
}
int Modem::openResolv(int flags)
{
int fd;
if ((fd = open(_PATH_RESCONF, flags)) == -1) {
- odebug << "error opening resolv.conf!" << oendl;
+ odebug << "error opening resolv.conf!" << oendl;
fd = open(DEVNULL, O_RDONLY);
}
return fd;
}
bool Modem::setHostname(const QString & name)
{
return sethostname(name, name.length()) == 0;
}
QString Modem::pppDevice()const {
return m_pppdDev;
}
void Modem::setPPPDevice( const QString& dev ) {
m_pppdDev = dev;
}
pid_t Modem::pppPID()const {
return pppdPid;
}
void Modem::setPPPDPid( pid_t pid ) {
- odebug << "Modem setting pid" << oendl;
+ odebug << "Modem setting pid" << oendl;
_pppdExitStatus = -1;
pppdPid = pid;
modemfd = -1;
}
void Modem::slotModemDebug(int fd) {
char buf[2049];
int len;
// read in pppd data look for Using interface
// then read the interface
// we limit to 10 device now 0-9
if((len = ::read(fd, buf, 2048)) > 0) {
diff --git a/noncore/settings/networksettings/wlan/wlanimp2.cpp b/noncore/settings/networksettings/wlan/wlanimp2.cpp
index 4294b12..d36a702 100644
--- a/noncore/settings/networksettings/wlan/wlanimp2.cpp
+++ b/noncore/settings/networksettings/wlan/wlanimp2.cpp
@@ -45,25 +45,25 @@ using namespace Opie::Net;
/**
* Constructor, read in the wireless.opts file for parsing later.
*/
WLANImp::WLANImp( QWidget* parent, const char* name, Interface *i, bool modal, WFlags fl) : WLAN(parent, name, modal, fl), interface(i), currentProfile("*") {
interfaces = new Interfaces();
interfaceSetup = new InterfaceSetupImp(tabWidget, "InterfaceSetupImp", i, interfaces);
tabWidget->insertTab(interfaceSetup, "TCP/IP");
// Check sanity - the existance of the wireless-tools if-pre-up script
QFile file(QString(PREUP));
if (file.exists()) {
- owarn << QString("WLANImp: Unable to open /etc/network/if-pre-up.d/wireless-tools") << oendl;
+ owarn << QString("WLANImp: Unable to open /etc/network/if-pre-up.d/wireless-tools") << oendl;
}
connect( rescanButton, SIGNAL( clicked() ), this, SLOT( rescanNeighbourhood() ) );
connect( netView, SIGNAL( clicked(QListViewItem*) ), this, SLOT( selectNetwork(QListViewItem*) ) );
netView->setColumnAlignment( col_chn, AlignCenter );
netView->setItemMargin( 3 );
netView->setAllColumnsShowFocus( true );
}
WLANImp::~WLANImp() {
//FIXME: delete interfaces;
@@ -226,25 +226,25 @@ void WLANImp::accept() {
// Close out the dialog
// FIXME: QDialog::accept();
}
void WLANImp::writeOpts() {
// eh can't really do anything about it other then return. :-D
if(!interfaces->isInterfaceSet()){
QMessageBox::warning(0,"Inface not set","should not happen!!!");
return;
}
bool error = false;
- odebug << "setting wlan interface " << interfaces->getInterfaceName( error ).latin1() << "" << oendl;
+ odebug << "setting wlan interface " << interfaces->getInterfaceName( error ).latin1() << "" << oendl;
if (error) QMessageBox::warning(0,"Inface not set","should not happen!!!");
interfaces->setInterfaceOption(QString("wireless_mode"), mode->currentText());
interfaces->setInterfaceOption(QString("wireless_essid"), essid->currentText());
if (specifyAp->isChecked()) {
interfaces->setInterfaceOption(QString("wireless_ap"), macEdit->text());
} else {
interfaces->removeInterfaceOption(QString("wireless_ap"));
}
@@ -300,83 +300,83 @@ void WLANImp::writeOpts() {
QDialog::accept();
}
/*
* Scan for possible wireless networks around...
* ... powered by Wellenreiter II technology (C) Michael 'Mickey' Lauer <mickeyl@handhelds.org>
*/
void WLANImp::rescanNeighbourhood()
{
QString name = interface->getInterfaceName();
- odebug << "rescanNeighbourhood via '" << name << "'" << oendl;
+ odebug << "rescanNeighbourhood via '" << name << "'" << oendl;
OWirelessNetworkInterface* wiface = static_cast<OWirelessNetworkInterface*>( ONetwork::instance()->interface( name ) );
assert( wiface );
// try to guess device type
QString devicetype;
QFile m( "/proc/modules" );
if ( m.open( IO_ReadOnly ) )
{
QString line;
QTextStream modules( &m );
while( !modules.atEnd() && !devicetype )
{
modules >> line;
if ( line.contains( "cisco" ) ) devicetype = "cisco";
else if ( line.contains( "hostap" ) ) devicetype = "hostap";
else if ( line.contains( "prism" ) ) devicetype = "wlan-ng"; /* puke */
else if ( line.contains( "orinoco" ) ) devicetype = "orinoco";
}
}
if ( devicetype.isEmpty() )
{
- owarn << "rescanNeighbourhood(): couldn't guess device type :(" << oendl;
+ owarn << "rescanNeighbourhood(): couldn't guess device type :(" << oendl;
return;
}
else
{
- odebug << "rescanNeighbourhood(): device type seems to be '" << devicetype << "'" << oendl;
+ odebug << "rescanNeighbourhood(): device type seems to be '" << devicetype << "'" << oendl;
}
// configure interface to receive 802.11 management frames
wiface->setUp( true );
wiface->setPromiscuousMode( true );
if ( devicetype == "cisco" ) wiface->setMonitoring( new OCiscoMonitoringInterface( wiface, false ) );
else if ( devicetype == "hostap" ) wiface->setMonitoring( new OHostAPMonitoringInterface( wiface, false ) );
else if ( devicetype == "wlan-ng" ) wiface->setMonitoring( new OWlanNGMonitoringInterface( wiface, false ) );
else if ( devicetype == "orinoco" ) wiface->setMonitoring( new OOrinocoMonitoringInterface( wiface, false ) );
else
{
- odebug << "rescanNeighbourhood(): unsupported device type for monitoring :(" << oendl;
+ odebug << "rescanNeighbourhood(): unsupported device type for monitoring :(" << oendl;
return;
}
wiface->setMode( "monitor" );
if ( wiface->mode() != "monitor" )
{
- owarn << "rescanNeighbourhood(): Unable to bring device into monitor mode (" << strerror( errno ) << ")." << oendl;
+ owarn << "rescanNeighbourhood(): Unable to bring device into monitor mode (" << strerror( errno ) << ")." << oendl;
return;
}
// open a packet capturer
OPacketCapturer* cap = new OPacketCapturer();
cap->open( name );
if ( !cap->isOpen() )
{
- owarn << "rescanNeighbourhood(): Unable to open libpcap (" << strerror( errno ) << ")." << oendl;
+ owarn << "rescanNeighbourhood(): Unable to open libpcap (" << strerror( errno ) << ")." << oendl;
return;
}
// display splash screen
QFrame* splash = new QFrame( this, "splash", false, WStyle_StaysOnTop | WStyle_DialogBorder | WStyle_Customize );
splash->setLineWidth( 2 );
splash->setFrameStyle( QFrame::Panel | QFrame::Raised );
QVBoxLayout* vbox = new QVBoxLayout( splash, 4, 4 );
QLabel* lab = new QLabel( "<center><b>Scanning...</b><br>Please Wait...</center>", splash );
QProgressBar* pb = new QProgressBar( wiface->channels(), splash );
vbox->addWidget( lab );
vbox->addWidget( pb );
@@ -391,33 +391,33 @@ void WLANImp::rescanNeighbourhood()
splash->show();
splash->raise();
qApp->processEvents();
// set capturer to non-blocking mode
cap->setBlocking( false );
for ( int i = 1; i <= wiface->channels(); ++i )
{
wiface->setChannel( i );
pb->setProgress( i );
qApp->processEvents();
- odebug << "rescanNeighbourhood(): listening on channel " << i << "..." << oendl;
+ odebug << "rescanNeighbourhood(): listening on channel " << i << "..." << oendl;
OPacket* p = cap->next( 1000 );
if ( !p )
{
- odebug << "rescanNeighbourhood(): nothing received on channel " << i << "" << oendl;
+ odebug << "rescanNeighbourhood(): nothing received on channel " << i << "" << oendl;
}
else
{
- odebug << "rescanNeighbourhood(): TADAA - something came in on channel " << i << "" << oendl;
+ odebug << "rescanNeighbourhood(): TADAA - something came in on channel " << i << "" << oendl;
handlePacket( p );
}
}
cap->close();
wiface->setMode( "managed" ); // TODO: use previous mode
wiface->setPromiscuousMode( false );
splash->hide();
delete splash;
}
@@ -432,44 +432,43 @@ void WLANImp::handlePacket( OPacket* p )
QString type;
if ( beacon->canIBSS() )
{
type = "adhoc";
}
else if ( beacon->canESS() )
{
type = "managed";
}
else
{
- owarn << "handlePacket(): invalid frame [possibly noise] detected!" << oendl;
+ owarn << "handlePacket(): invalid frame [possibly noise] detected!" << oendl;
return;
}
OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) );
QString essid = ssid ? ssid->ID() : QString("<unknown>");
OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) );
int channel = ds ? ds->channel() : -1;
OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) );
displayFoundNetwork( type, channel, essid, header->macAddress2() );
}
}
void WLANImp::displayFoundNetwork( const QString& mode, int channel, const QString& ssid, const OMacAddress& mac )
{
- qDebug( "found network: <%s>, chn %d, ssid '%s', mac '%s'", (const char*) mode, channel,
- (const char*) ssid,
- (const char*) mac.toString() );
+ odebug << "found network: <" << (const char*) mode << ">, chn " << channel
+ << ", ssid '" << (const char*) ssid << "', mac '" << (const char*) mac.toString() << "'" << oendl;
QListViewItemIterator it( netView );
while ( it.current() && it.current()->text( col_ssid ) != ssid ) ++it;
if ( !it.current() ) // ssid didn't show up yet
{
QListViewItem* item = new QListViewItem( netView, mode.left( 1 ).upper(), ssid, QString::number( channel ), mac.toString() );
QString name;
name.sprintf( "networksettings/%s", (const char*) mode );
item->setPixmap( col_mode, Resource::loadPixmap( name ) );
qApp->processEvents();
}