-rw-r--r-- | noncore/tools/remote/lirchandler.cpp | 25 | ||||
-rw-r--r-- | noncore/tools/remote/lirchandler.h | 5 | ||||
-rw-r--r-- | noncore/tools/remote/remote.cpp | 28 |
3 files changed, 45 insertions, 13 deletions
diff --git a/noncore/tools/remote/lirchandler.cpp b/noncore/tools/remote/lirchandler.cpp index 263b740..ec1e275 100644 --- a/noncore/tools/remote/lirchandler.cpp +++ b/noncore/tools/remote/lirchandler.cpp | |||
@@ -21,3 +21,2 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |||
21 | #include <sys/types.h> | 21 | #include <sys/types.h> |
22 | #include <sys/un.h> | ||
23 | #include <unistd.h> | 22 | #include <unistd.h> |
@@ -29,2 +28,3 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |||
29 | #include <opie2/oprocess.h> | 28 | #include <opie2/oprocess.h> |
29 | #include <qpe/qcopenvelope_qws.h> | ||
30 | 30 | ||
@@ -270 +270,24 @@ bool LircHandler::isLircdRunning(void) | |||
270 | } | 270 | } |
271 | |||
272 | bool LircHandler::setupModules(void) | ||
273 | { | ||
274 | // Remove IrDA modules which get in the way | ||
275 | system("rmmod ircomm-tty ircomm"); | ||
276 | // Load LIRC device driver | ||
277 | system("modprobe lirc_sir"); | ||
278 | return true; | ||
279 | } | ||
280 | |||
281 | bool LircHandler::cleanupModules(void) | ||
282 | { | ||
283 | // Unload LIRC device driver | ||
284 | system("rmmod lirc_sir"); | ||
285 | // Load IrDA drivers back in | ||
286 | system("modprobe ircomm-tty"); | ||
287 | return true; | ||
288 | } | ||
289 | |||
290 | void LircHandler::disableIrDA(void) | ||
291 | { | ||
292 | QCopEnvelope e("QPE/IrDaApplet", "disableIrda()"); | ||
293 | } | ||
diff --git a/noncore/tools/remote/lirchandler.h b/noncore/tools/remote/lirchandler.h index c7665cb..4e56b6b 100644 --- a/noncore/tools/remote/lirchandler.h +++ b/noncore/tools/remote/lirchandler.h | |||
@@ -19,2 +19,4 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |||
19 | 19 | ||
20 | #include <sys/un.h> | ||
21 | |||
20 | class LircHandler | 22 | class LircHandler |
@@ -35,2 +37,5 @@ public: | |||
35 | bool isLircdRunning(void); | 37 | bool isLircdRunning(void); |
38 | bool setupModules(void); | ||
39 | bool cleanupModules(void); | ||
40 | void disableIrDA(void); | ||
36 | }; | 41 | }; |
diff --git a/noncore/tools/remote/remote.cpp b/noncore/tools/remote/remote.cpp index 67fc57d..5b756cb 100644 --- a/noncore/tools/remote/remote.cpp +++ b/noncore/tools/remote/remote.cpp | |||
@@ -42,19 +42,23 @@ int main( int argc, char **argv ) | |||
42 | QPEApplication a( argc, argv ); | 42 | QPEApplication a( argc, argv ); |
43 | MainView w; | ||
44 | a.setMainWidget( &w ); | ||
45 | QPEApplication::showWidget( &w ); | ||
46 | 43 | ||
47 | LircHandler lh; | 44 | LircHandler lh; |
48 | if(!lh.isLircdRunning()) { | ||
49 | QMessageBox mb("Error!", | ||
50 | "Lircd is not running", | ||
51 | QMessageBox::NoIcon, | ||
52 | QMessageBox::Ok, | ||
53 | QMessageBox::NoButton, | ||
54 | QMessageBox::NoButton); | ||
55 | mb.exec(); | ||
56 | 45 | ||
46 | lh.disableIrDA(); | ||
47 | lh.setupModules(); | ||
48 | lh.startLircd(); | ||
49 | if(!lh.isLircdRunning()) { | ||
50 | QMessageBox::critical(NULL, QObject::tr("Error"), | ||
51 | QObject::tr("Unable to start lircd"), | ||
52 | QMessageBox::Ok, QMessageBox::NoButton); | ||
57 | } | 53 | } |
58 | 54 | ||
59 | return a.exec(); | 55 | MainView w; |
56 | a.setMainWidget( &w ); | ||
57 | QPEApplication::showWidget( &w ); | ||
58 | int result = a.exec(); | ||
59 | |||
60 | lh.stopLircd(); | ||
61 | lh.cleanupModules(); | ||
62 | |||
63 | return result; | ||
60 | } | 64 | } |