-rw-r--r-- | core/applets/irdaapplet/irda.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/core/applets/irdaapplet/irda.cpp b/core/applets/irdaapplet/irda.cpp index e21f191..5b23330 100644 --- a/core/applets/irdaapplet/irda.cpp +++ b/core/applets/irdaapplet/irda.cpp @@ -90,42 +90,48 @@ int IrdaApplet::setIrdaStatus(int c) { if (ioctl(sockfd, SIOCGIFFLAGS, &ifr)) return -1; if (c) ifr.ifr_flags |= IFF_UP; else ifr.ifr_flags &= ~IFF_UP; if (ioctl(sockfd, SIOCSIFFLAGS, &ifr)) return -1; return 0; } int IrdaApplet::checkIrdaDiscoveryStatus() { + QFile discovery("/proc/sys/net/irda/discovery"); - char status; - discovery.open( IO_ReadOnly|IO_Raw ); - discovery.readBlock (&status, 1); + QString streamIn = "0"; + + if (discovery.open(IO_ReadOnly) ) { + QTextStream stream ( &discovery ); + streamIn = stream.read(); + } + discovery.close(); - return atoi(&status); + return( streamIn.toInt() ); } + int IrdaApplet::setIrdaDiscoveryStatus(int d) { QFile discovery("/proc/sys/net/irda/discovery"); discovery.open( IO_WriteOnly|IO_Raw ); if (d) discovery.putch('1'); else discovery.putch('0'); discovery.close(); return 0; } |