author | mickeyl <mickeyl> | 2005-06-21 13:56:23 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-06-21 13:56:23 (UTC) |
commit | 65ea54f43ee7dcbd95ffb474c8dfbb8b076d43e5 (patch) (unidiff) | |
tree | 00439d8a397bfa4147e5fd26baec01f619f384c3 | |
parent | a1f2f34836103ef80b3e11f5183a96218f7ea215 (diff) | |
download | opie-65ea54f43ee7dcbd95ffb474c8dfbb8b076d43e5.zip opie-65ea54f43ee7dcbd95ffb474c8dfbb8b076d43e5.tar.gz opie-65ea54f43ee7dcbd95ffb474c8dfbb8b076d43e5.tar.bz2 |
- repair broken headers (tss...)
- fix logical error in ODevice::sendSuspendmsg()
- send qcop signal returnFromSuspend() after resuming from suspend
- remove debug macro from opcmciasystem; better do this from the .pro file with DEFINES +=
-rw-r--r-- | libopie2/opiecore/device/odevice.cpp | 48 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_abstractmobiledevice.cpp | 21 | ||||
-rw-r--r-- | libopie2/opiecore/linux/linux.pro | 1 | ||||
-rw-r--r-- | libopie2/opiecore/linux/opcmciasystem.cpp | 2 |
4 files changed, 36 insertions, 36 deletions
diff --git a/libopie2/opiecore/device/odevice.cpp b/libopie2/opiecore/device/odevice.cpp index dd1e2f3..5e91d8b 100644 --- a/libopie2/opiecore/device/odevice.cpp +++ b/libopie2/opiecore/device/odevice.cpp | |||
@@ -1,62 +1,62 @@ | |||
1 | /* | 1 | /* |
2 | Â Â Â Â Â Â Â Â This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | =. (C) 2002-2005 The Opie Team <opie-devel@handhelds.org> | |
4 | Copyright (C)2002-2005 The Opie Team <opie-devel@handhelds.org> | ||
5 | =. | ||
6 | .=l. | 4 | .=l. |
7 | Â Â Â Â Â Â .>+-= | 5 | .>+-= |
8 | Â _;:, Â Â .> Â Â :=|. This program is free software; you can | 6 | _;:, .> :=|. This program is free software; you can |
9 | .> <`_, Â > Â . Â <= redistribute it and/or modify it under | 7 | .> <`_, > . <= redistribute it and/or modify it under |
10 | :`=1 )Y*s>-.-- Â : the terms of the GNU Library General Public | 8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
11 | .="- .-=="i, Â Â .._ License as published by the Free Software | 9 | .="- .-=="i, .._ License as published by the Free Software |
12 | Â - . Â .-<_> Â Â .<> Foundation; either version 2 of the License, | 10 | - . .-<_> .<> Foundation; version 2 of the License. |
13 | Â Â Â ._= =} Â Â Â : or (at your option) any later version. | 11 | ._= =} : |
14 | Â Â .%`+i> Â Â Â _;_. | 12 | .%`+i> _;_. |
15 | Â Â .i_,=:_. Â Â Â -<s. This program is distributed in the hope that | 13 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | Â Â Â + Â . Â -:. Â Â Â = it will be useful, but WITHOUT ANY WARRANTY; | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | : .. Â Â .:, Â Â . . . without even the implied warranty of | 15 | : .. .:, . . . without even the implied warranty of |
18 | Â Â =_ Â Â Â Â + Â Â =;=|` MERCHANTABILITY or FITNESS FOR A | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | Â _.=:. Â Â Â : Â Â :=>`: PARTICULAR PURPOSE. See the GNU | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= Â Â Â = Â Â Â ; Library General Public License for more | 18 | ..}^=.= = ; Library General Public License for more |
21 | ++= Â -. Â Â .` Â Â .: details. | 19 | ++= -. .` .: details. |
22 | : Â Â = Â ...= . :.=- | 20 | : = ...= . :.=- |
23 | Â -. Â .:....=;==+<; You should have received a copy of the GNU | 21 | -. .:....=;==+<; You should have received a copy of the GNU |
24 | Â -_. . . Â )=. Â = Library General Public License along with | 22 | -_. . . )=. = Library General Public License along with |
25 | Â Â -- Â Â Â Â :-=` this library; see the file COPYING.LIB. | 23 | -- :-=` this library; see the file COPYING.LIB. |
26 | If not, write to the Free Software Foundation, | 24 | If not, write to the Free Software Foundation, |
27 | Inc., 59 Temple Place - Suite 330, | 25 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 26 | Boston, MA 02111-1307, USA. |
27 | |||
29 | */ | 28 | */ |
30 | 29 | ||
30 | |||
31 | #include "odevice_beagle.h" | 31 | #include "odevice_beagle.h" |
32 | #include "odevice_ipaq.h" | 32 | #include "odevice_ipaq.h" |
33 | #include "odevice_jornada.h" | 33 | #include "odevice_jornada.h" |
34 | #include "odevice_ramses.h" | 34 | #include "odevice_ramses.h" |
35 | #include "odevice_simpad.h" | 35 | #include "odevice_simpad.h" |
36 | #include "odevice_yopy.h" | 36 | #include "odevice_yopy.h" |
37 | #include "odevice_zaurus.h" | 37 | #include "odevice_zaurus.h" |
38 | #include "odevice_genuineintel.h" | 38 | #include "odevice_genuineintel.h" |
39 | 39 | ||
40 | /* QT */ | 40 | /* QT */ |
41 | #include <qapplication.h> | 41 | #include <qapplication.h> |
42 | #include <qfile.h> | 42 | #include <qfile.h> |
43 | #include <qtextstream.h> | 43 | #include <qtextstream.h> |
44 | #include <qwindowsystem_qws.h> | 44 | #include <qwindowsystem_qws.h> |
45 | 45 | ||
46 | /* OPIE */ | 46 | /* OPIE */ |
47 | #include <qpe/config.h> | 47 | #include <qpe/config.h> |
48 | #include <qpe/sound.h> | 48 | #include <qpe/sound.h> |
49 | #include <qpe/qcopenvelope_qws.h> | 49 | #include <qpe/qcopenvelope_qws.h> |
50 | #include <qpe/sound.h> | 50 | #include <qpe/sound.h> |
51 | 51 | ||
52 | #include <opie2/okeyfilter.h> | 52 | #include <opie2/okeyfilter.h> |
53 | #include <opie2/oresource.h> | 53 | #include <opie2/oresource.h> |
54 | 54 | ||
55 | /* STD */ | 55 | /* STD */ |
56 | #include <fcntl.h> | 56 | #include <fcntl.h> |
57 | #include <math.h> | 57 | #include <math.h> |
58 | #include <stdlib.h> | 58 | #include <stdlib.h> |
59 | #include <signal.h> | 59 | #include <signal.h> |
60 | #include <sys/ioctl.h> | 60 | #include <sys/ioctl.h> |
61 | #include <sys/time.h> | 61 | #include <sys/time.h> |
62 | #include <unistd.h> | 62 | #include <unistd.h> |
@@ -665,65 +665,65 @@ void ODevice::remapHeldAction ( int button, const OQCopMessage &action ) | |||
665 | b. setHeldAction ( action ); | 665 | b. setHeldAction ( action ); |
666 | 666 | ||
667 | Config buttonFile ( "ButtonSettings" ); | 667 | Config buttonFile ( "ButtonSettings" ); |
668 | buttonFile. setGroup ( "Button" + QString::number ( button )); | 668 | buttonFile. setGroup ( "Button" + QString::number ( button )); |
669 | buttonFile. writeEntry ( "HeldActionChannel", (const char *) b. heldAction(). channel()); | 669 | buttonFile. writeEntry ( "HeldActionChannel", (const char *) b. heldAction(). channel()); |
670 | buttonFile. writeEntry ( "HeldActionMessage", (const char *) b. heldAction(). message()); | 670 | buttonFile. writeEntry ( "HeldActionMessage", (const char *) b. heldAction(). message()); |
671 | 671 | ||
672 | // buttonFile. writeEntry ( "HeldActionArgs", decodeBase64 ( b. heldAction(). data())); | 672 | // buttonFile. writeEntry ( "HeldActionArgs", decodeBase64 ( b. heldAction(). data())); |
673 | 673 | ||
674 | QCopEnvelope ( "QPE/System", "deviceButtonMappingChanged()" ); | 674 | QCopEnvelope ( "QPE/System", "deviceButtonMappingChanged()" ); |
675 | } | 675 | } |
676 | 676 | ||
677 | /** | 677 | /** |
678 | * @internal | 678 | * @internal |
679 | */ | 679 | */ |
680 | void ODevice::virtual_hook(int, void* ){ | 680 | void ODevice::virtual_hook(int, void* ){ |
681 | 681 | ||
682 | } | 682 | } |
683 | 683 | ||
684 | /** | 684 | /** |
685 | * \brief Send a QCOP Message before suspending | 685 | * \brief Send a QCOP Message before suspending |
686 | * | 686 | * |
687 | * Sends a QCOP message to channel QPE/System | 687 | * Sends a QCOP message to channel QPE/System |
688 | * with the message "aboutToSuspend()" if this | 688 | * with the message "aboutToSuspend()" if this |
689 | * is the windowing server. | 689 | * is the windowing server. |
690 | * | 690 | * |
691 | * Call this in your custom \sa suspend() Method | 691 | * Call this in your custom \sa suspend() Method |
692 | * before going to suspend. | 692 | * before going to suspend. |
693 | * | 693 | * |
694 | */ | 694 | */ |
695 | void ODevice::sendSuspendmsg() | 695 | void ODevice::sendSuspendmsg() |
696 | { | 696 | { |
697 | if ( isQWS() ) | 697 | if ( !isQWS() ) |
698 | return; | 698 | return; |
699 | 699 | ||
700 | QCopEnvelope ( "QPE/System", "aboutToSuspend()" ); | 700 | QCopEnvelope ( "QPE/System", "aboutToSuspend()" ); |
701 | } | 701 | } |
702 | 702 | ||
703 | /** | 703 | /** |
704 | * \brief Prepend the QWSServer::KeyboardFilter to the list of installed KeyFilters | 704 | * \brief Prepend the QWSServer::KeyboardFilter to the list of installed KeyFilters |
705 | * | 705 | * |
706 | * Prepend a QWSServer::KeyboardFilter to the List of Keyboard | 706 | * Prepend a QWSServer::KeyboardFilter to the List of Keyboard |
707 | * Filters. This function is the only way to prepend a KeyFilter. | 707 | * Filters. This function is the only way to prepend a KeyFilter. |
708 | * | 708 | * |
709 | * @param aFilter The KeyFilter to be prepended to the list of filters | 709 | * @param aFilter The KeyFilter to be prepended to the list of filters |
710 | * | 710 | * |
711 | * @see Opie::Core::OKeyFilter | 711 | * @see Opie::Core::OKeyFilter |
712 | * @see Opie::Core::OKeyFilter::inst() | 712 | * @see Opie::Core::OKeyFilter::inst() |
713 | */ | 713 | */ |
714 | void ODevice::addPreHandler(QWSServer::KeyboardFilter*aFilter) | 714 | void ODevice::addPreHandler(QWSServer::KeyboardFilter*aFilter) |
715 | { | 715 | { |
716 | Opie::Core::OKeyFilter::inst()->addPreHandler(aFilter); | 716 | Opie::Core::OKeyFilter::inst()->addPreHandler(aFilter); |
717 | } | 717 | } |
718 | 718 | ||
719 | /** | 719 | /** |
720 | * \brief Remove the QWSServer::KeyboardFilter in the param from the list | 720 | * \brief Remove the QWSServer::KeyboardFilter in the param from the list |
721 | * | 721 | * |
722 | * Remove the QWSServer::KeyboardFilter \par aFilter from the List | 722 | * Remove the QWSServer::KeyboardFilter \par aFilter from the List |
723 | * of Keyfilters. Call this when you delete the KeyFilter! | 723 | * of Keyfilters. Call this when you delete the KeyFilter! |
724 | * | 724 | * |
725 | * @param aFilter The filter to be removed from the Opie::Core::OKeyFilter | 725 | * @param aFilter The filter to be removed from the Opie::Core::OKeyFilter |
726 | * @see Opie::Core::ODevice::addPreHandler | 726 | * @see Opie::Core::ODevice::addPreHandler |
727 | */ | 727 | */ |
728 | void ODevice::remPreHandler(QWSServer::KeyboardFilter*aFilter) | 728 | void ODevice::remPreHandler(QWSServer::KeyboardFilter*aFilter) |
729 | { | 729 | { |
diff --git a/libopie2/opiecore/device/odevice_abstractmobiledevice.cpp b/libopie2/opiecore/device/odevice_abstractmobiledevice.cpp index f3f6af5..fe5864b 100644 --- a/libopie2/opiecore/device/odevice_abstractmobiledevice.cpp +++ b/libopie2/opiecore/device/odevice_abstractmobiledevice.cpp | |||
@@ -1,118 +1,119 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) 2004, 2005 Holger Hans Peter Freyther <freyther@handhelds.org> | 3 | Copyright (C) 2004, 2005 Holger Hans Peter Freyther <freyther@handhelds.org> |
4 | Copyright (C) 2004, 2005 Michael 'mickey' Lauer <mickeyl@handhelds.org> | 4 | =. Copyright (C) 2004, 2005 Michael 'Mickey' Lauer <mickey@Vanille.de> |
5 | Copyright (C) 2002, 2003 Robert Griebl <sandman@handhelds.org> | 5 | .=l. Copyright (C) 2002, 2003 Robert Griebl <sandman@handhelds.org> |
6 | |||
7 | |||
8 | =. | ||
9 | .=l. | ||
10 | .>+-= | 6 | .>+-= |
11 | _;:, .> :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
12 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
13 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
14 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
15 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; version 2 of the License. |
16 | ._= =} : or (at your option) any later version. | 12 | ._= =} : |
17 | .%`+i> _;_. | 13 | .%`+i> _;_. |
18 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
19 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
20 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
21 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
22 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
23 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
24 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
25 | : = ...= . :.=- | 21 | : = ...= . :.=- |
26 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
27 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
28 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
29 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
30 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
31 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
32 | */ | 28 | */ |
33 | 29 | ||
34 | #include "odevice_abstractmobiledevice.h" | 30 | #include "odevice_abstractmobiledevice.h" |
35 | 31 | ||
32 | #include <qpe/qcopenvelope_qws.h> | ||
33 | |||
36 | #include <sys/time.h> | 34 | #include <sys/time.h> |
37 | #include <sys/ioctl.h> | 35 | #include <sys/ioctl.h> |
38 | 36 | ||
39 | #include <time.h> | 37 | #include <time.h> |
40 | #include <fcntl.h> | 38 | #include <fcntl.h> |
41 | #include <unistd.h> | 39 | #include <unistd.h> |
42 | #include <stdlib.h> | 40 | #include <stdlib.h> |
43 | 41 | ||
44 | namespace Opie { | 42 | namespace Opie { |
45 | namespace Core { | 43 | namespace Core { |
46 | OAbstractMobileDevice::OAbstractMobileDevice() | 44 | OAbstractMobileDevice::OAbstractMobileDevice() |
47 | : m_timeOut( 1500 ) | 45 | : m_timeOut( 1500 ) |
48 | {} | 46 | {} |
49 | 47 | ||
50 | /** | 48 | /** |
51 | * @short Time to wait for the asynchronos APM implementation to suspend | 49 | * @short Time to wait for the asynchronos APM implementation to suspend |
52 | * | 50 | * |
53 | * Milli Seconds to wait before returning from the suspend method. | 51 | * Milli Seconds to wait before returning from the suspend method. |
54 | * This is needed due asynchrnonus implementations of the APM bios. | 52 | * This is needed due asynchrnonus implementations of the APM bios. |
55 | * | 53 | * |
56 | */ | 54 | */ |
57 | void OAbstractMobileDevice::setAPMTimeOut( int time ) { | 55 | void OAbstractMobileDevice::setAPMTimeOut( int time ) { |
58 | m_timeOut = time; | 56 | m_timeOut = time; |
59 | } | 57 | } |
60 | 58 | ||
61 | 59 | ||
62 | bool OAbstractMobileDevice::suspend() { | 60 | bool OAbstractMobileDevice::suspend() { |
63 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend | 61 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend |
64 | return false; | 62 | return false; |
65 | 63 | ||
66 | bool res = false; | 64 | bool res = false; |
67 | ODevice::sendSuspendmsg(); | 65 | |
66 | QCopEnvelope( "QPE/System", "aboutToSuspend()" ); | ||
68 | 67 | ||
69 | struct timeval tvs, tvn; | 68 | struct timeval tvs, tvn; |
70 | ::gettimeofday ( &tvs, 0 ); | 69 | ::gettimeofday ( &tvs, 0 ); |
71 | 70 | ||
72 | ::sync(); // flush fs caches | 71 | ::sync(); // flush fs caches |
73 | res = ( ::system ( "apm --suspend" ) == 0 ); | 72 | res = ( ::system ( "apm --suspend" ) == 0 ); |
74 | 73 | ||
75 | // This is needed because some apm implementations are asynchronous and we | 74 | // This is needed because some apm implementations are asynchronous and we |
76 | // can not be sure when exactly the device is really suspended | 75 | // can not be sure when exactly the device is really suspended |
77 | // This can be deleted as soon as a stable familiar with a synchronous apm implementation exists. | 76 | // This can be deleted as soon as a stable familiar with a synchronous apm implementation exists. |
78 | 77 | ||
79 | if ( res ) { | 78 | if ( res ) { |
80 | do { // wait at most 1.5 sec: either suspend didn't work or the device resumed | 79 | do { // wait at most 1.5 sec: either suspend didn't work or the device resumed |
81 | ::usleep ( 200 * 1000 ); | 80 | ::usleep ( 200 * 1000 ); |
82 | ::gettimeofday ( &tvn, 0 ); | 81 | ::gettimeofday ( &tvn, 0 ); |
83 | } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < m_timeOut ); | 82 | } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < m_timeOut ); |
84 | } | 83 | } |
85 | 84 | ||
86 | return res; | 85 | return res; |
86 | |||
87 | QCopEnvelope( "QPE/System", "returnFromSuspend()" ); | ||
87 | } | 88 | } |
88 | 89 | ||
89 | //#include <linux/fb.h> better not rely on kernel headers in userspace ... | 90 | //#include <linux/fb.h> better not rely on kernel headers in userspace ... |
90 | 91 | ||
91 | // _IO and friends are only defined in kernel headers ... | 92 | // _IO and friends are only defined in kernel headers ... |
92 | #define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) | 93 | #define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) |
93 | #define OD_IO(type,number) OD_IOC(0,type,number,0) | 94 | #define OD_IO(type,number) OD_IOC(0,type,number,0) |
94 | 95 | ||
95 | #define FBIOBLANK OD_IO( 'F', 0x11 ) // 0x4611 | 96 | #define FBIOBLANK OD_IO( 'F', 0x11 ) // 0x4611 |
96 | 97 | ||
97 | /* VESA Blanking Levels */ | 98 | /* VESA Blanking Levels */ |
98 | #define VESA_NO_BLANKING 0 | 99 | #define VESA_NO_BLANKING 0 |
99 | #define VESA_VSYNC_SUSPEND 1 | 100 | #define VESA_VSYNC_SUSPEND 1 |
100 | #define VESA_HSYNC_SUSPEND 2 | 101 | #define VESA_HSYNC_SUSPEND 2 |
101 | #define VESA_POWERDOWN 3 | 102 | #define VESA_POWERDOWN 3 |
102 | 103 | ||
103 | bool OAbstractMobileDevice::setDisplayStatus ( bool on ) { | 104 | bool OAbstractMobileDevice::setDisplayStatus ( bool on ) { |
104 | bool res = false; | 105 | bool res = false; |
105 | int fd; | 106 | int fd; |
106 | 107 | ||
107 | #ifdef QT_QWS_DEVFS | 108 | #ifdef QT_QWS_DEVFS |
108 | if (( fd = ::open ( "/dev/fb/0", O_RDWR )) >= 0 ) { | 109 | if (( fd = ::open ( "/dev/fb/0", O_RDWR )) >= 0 ) { |
109 | #else | 110 | #else |
110 | if (( fd = ::open ( "/dev/fb0", O_RDWR )) >= 0 ) { | 111 | if (( fd = ::open ( "/dev/fb0", O_RDWR )) >= 0 ) { |
111 | #endif | 112 | #endif |
112 | res = ( ::ioctl ( fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN ) == 0 ); | 113 | res = ( ::ioctl ( fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN ) == 0 ); |
113 | ::close ( fd ); | 114 | ::close ( fd ); |
114 | } | 115 | } |
115 | 116 | ||
116 | return res; | 117 | return res; |
117 | } | 118 | } |
118 | } | 119 | } |
diff --git a/libopie2/opiecore/linux/linux.pro b/libopie2/opiecore/linux/linux.pro index c396e59..c0c4f7f 100644 --- a/libopie2/opiecore/linux/linux.pro +++ b/libopie2/opiecore/linux/linux.pro | |||
@@ -1,10 +1,11 @@ | |||
1 | HEADERS += \ | 1 | HEADERS += \ |
2 | linux/ofilenotify.h \ | 2 | linux/ofilenotify.h \ |
3 | linux/oinputsystem.h \ | 3 | linux/oinputsystem.h \ |
4 | linux/opcmciasystem.h | 4 | linux/opcmciasystem.h |
5 | 5 | ||
6 | SOURCES += \ | 6 | SOURCES += \ |
7 | linux/ofilenotify.cpp \ | 7 | linux/ofilenotify.cpp \ |
8 | linux/oinputsystem.cpp \ | 8 | linux/oinputsystem.cpp \ |
9 | linux/opcmciasystem.cpp | 9 | linux/opcmciasystem.cpp |
10 | 10 | ||
11 | DEFINES += OPCMCIA_DEBUG=1 | ||
diff --git a/libopie2/opiecore/linux/opcmciasystem.cpp b/libopie2/opiecore/linux/opcmciasystem.cpp index eae356e..445d903 100644 --- a/libopie2/opiecore/linux/opcmciasystem.cpp +++ b/libopie2/opiecore/linux/opcmciasystem.cpp | |||
@@ -20,66 +20,64 @@ | |||
20 | : = ...= . :.=- | 20 | : = ...= . :.=- |
21 | -. .:....=;==+<; You should have received a copy of the GNU | 21 | -. .:....=;==+<; You should have received a copy of the GNU |
22 | -_. . . )=. = Library General Public License along with | 22 | -_. . . )=. = Library General Public License along with |
23 | -- :-=` this library; see the file COPYING.LIB. | 23 | -- :-=` this library; see the file COPYING.LIB. |
24 | If not, write to the Free Software Foundation, | 24 | If not, write to the Free Software Foundation, |
25 | Inc., 59 Temple Place - Suite 330, | 25 | Inc., 59 Temple Place - Suite 330, |
26 | Boston, MA 02111-1307, USA. | 26 | Boston, MA 02111-1307, USA. |
27 | 27 | ||
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include "opcmciasystem.h" | 30 | #include "opcmciasystem.h" |
31 | using namespace Opie::Core; | 31 | using namespace Opie::Core; |
32 | 32 | ||
33 | /* OPIE */ | 33 | /* OPIE */ |
34 | #include <opie2/odebug.h> | 34 | #include <opie2/odebug.h> |
35 | 35 | ||
36 | /* QT */ | 36 | /* QT */ |
37 | #include <qfile.h> | 37 | #include <qfile.h> |
38 | #include <qtextstream.h> | 38 | #include <qtextstream.h> |
39 | 39 | ||
40 | /* STD */ | 40 | /* STD */ |
41 | #include <errno.h> | 41 | #include <errno.h> |
42 | #include <fcntl.h> | 42 | #include <fcntl.h> |
43 | #include <string.h> | 43 | #include <string.h> |
44 | #include <stdlib.h> | 44 | #include <stdlib.h> |
45 | #include <sys/ioctl.h> | 45 | #include <sys/ioctl.h> |
46 | #include <sys/types.h> | 46 | #include <sys/types.h> |
47 | #include <sys/stat.h> | 47 | #include <sys/stat.h> |
48 | #include <unistd.h> | 48 | #include <unistd.h> |
49 | 49 | ||
50 | #define PROC_DEVICES "/proc/devices" | 50 | #define PROC_DEVICES "/proc/devices" |
51 | 51 | ||
52 | // #define OPCMCIA_DEBUG 1 | ||
53 | |||
54 | /*====================================================================================== | 52 | /*====================================================================================== |
55 | * OPcmciaSystem | 53 | * OPcmciaSystem |
56 | *======================================================================================*/ | 54 | *======================================================================================*/ |
57 | 55 | ||
58 | OPcmciaSystem* OPcmciaSystem::_instance = 0; | 56 | OPcmciaSystem* OPcmciaSystem::_instance = 0; |
59 | 57 | ||
60 | OPcmciaSystem::OPcmciaSystem() | 58 | OPcmciaSystem::OPcmciaSystem() |
61 | :_major( 0 ) | 59 | :_major( 0 ) |
62 | { | 60 | { |
63 | qDebug( "OPcmciaSystem::OPcmciaSystem()" ); | 61 | qDebug( "OPcmciaSystem::OPcmciaSystem()" ); |
64 | 62 | ||
65 | // get major node number out of /proc/devices | 63 | // get major node number out of /proc/devices |
66 | QFile procfile( PROC_DEVICES ); | 64 | QFile procfile( PROC_DEVICES ); |
67 | if ( procfile.exists() && procfile.open( IO_ReadOnly ) ) | 65 | if ( procfile.exists() && procfile.open( IO_ReadOnly ) ) |
68 | { | 66 | { |
69 | QTextStream devstream( &procfile ); | 67 | QTextStream devstream( &procfile ); |
70 | devstream.readLine(); // skip header | 68 | devstream.readLine(); // skip header |
71 | while ( !devstream.atEnd() && !_major ) | 69 | while ( !devstream.atEnd() && !_major ) |
72 | { | 70 | { |
73 | int nodenumber; | 71 | int nodenumber; |
74 | QString driver; | 72 | QString driver; |
75 | devstream >> nodenumber >> driver; | 73 | devstream >> nodenumber >> driver; |
76 | if ( driver == "pcmcia" ) | 74 | if ( driver == "pcmcia" ) |
77 | { | 75 | { |
78 | qDebug( "OPcmciaSystem::OPcmciaSystem(): gotcha! pcmcia node number = %d", nodenumber ); | 76 | qDebug( "OPcmciaSystem::OPcmciaSystem(): gotcha! pcmcia node number = %d", nodenumber ); |
79 | _major = nodenumber; | 77 | _major = nodenumber; |
80 | break; | 78 | break; |
81 | } | 79 | } |
82 | } | 80 | } |
83 | } | 81 | } |
84 | else | 82 | else |
85 | { | 83 | { |