-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 | |||
@@ -94,34 +94,40 @@ int IrdaApplet::setIrdaStatus(int c) { | |||
94 | if (c) | 94 | if (c) |
95 | ifr.ifr_flags |= IFF_UP; | 95 | ifr.ifr_flags |= IFF_UP; |
96 | else | 96 | else |
97 | ifr.ifr_flags &= ~IFF_UP; | 97 | ifr.ifr_flags &= ~IFF_UP; |
98 | 98 | ||
99 | if (ioctl(sockfd, SIOCSIFFLAGS, &ifr)) | 99 | if (ioctl(sockfd, SIOCSIFFLAGS, &ifr)) |
100 | return -1; | 100 | return -1; |
101 | 101 | ||
102 | return 0; | 102 | return 0; |
103 | } | 103 | } |
104 | 104 | ||
105 | int IrdaApplet::checkIrdaDiscoveryStatus() { | 105 | int IrdaApplet::checkIrdaDiscoveryStatus() { |
106 | |||
106 | QFile discovery("/proc/sys/net/irda/discovery"); | 107 | QFile discovery("/proc/sys/net/irda/discovery"); |
107 | char status; | ||
108 | 108 | ||
109 | discovery.open( IO_ReadOnly|IO_Raw ); | 109 | QString streamIn = "0"; |
110 | discovery.readBlock (&status, 1); | 110 | |
111 | if (discovery.open(IO_ReadOnly) ) { | ||
112 | QTextStream stream ( &discovery ); | ||
113 | streamIn = stream.read(); | ||
114 | } | ||
115 | |||
111 | discovery.close(); | 116 | discovery.close(); |
112 | 117 | ||
113 | return atoi(&status); | 118 | return( streamIn.toInt() ); |
114 | } | 119 | } |
115 | 120 | ||
121 | |||
116 | int IrdaApplet::setIrdaDiscoveryStatus(int d) { | 122 | int IrdaApplet::setIrdaDiscoveryStatus(int d) { |
117 | QFile discovery("/proc/sys/net/irda/discovery"); | 123 | QFile discovery("/proc/sys/net/irda/discovery"); |
118 | 124 | ||
119 | discovery.open( IO_WriteOnly|IO_Raw ); | 125 | discovery.open( IO_WriteOnly|IO_Raw ); |
120 | 126 | ||
121 | if (d) | 127 | if (d) |
122 | discovery.putch('1'); | 128 | discovery.putch('1'); |
123 | else | 129 | else |
124 | discovery.putch('0'); | 130 | discovery.putch('0'); |
125 | 131 | ||
126 | discovery.close(); | 132 | discovery.close(); |
127 | 133 | ||