-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,94 +1,94 @@ | |||
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> |
63 | #ifndef QT_NO_SOUND | 63 | #ifndef QT_NO_SOUND |
64 | #include <linux/soundcard.h> | 64 | #include <linux/soundcard.h> |
65 | #endif | 65 | #endif |
66 | 66 | ||
67 | namespace Opie { | 67 | namespace Opie { |
68 | namespace Core { | 68 | namespace Core { |
69 | 69 | ||
70 | static const char* PATH_PROC_CPUINFO = "/proc/cpuinfo"; | 70 | static const char* PATH_PROC_CPUINFO = "/proc/cpuinfo"; |
71 | 71 | ||
72 | 72 | ||
73 | /* STATIC and common implementation */ | 73 | /* STATIC and common implementation */ |
74 | /* EXPORT */ ODistribution distributions[] = { | 74 | /* EXPORT */ ODistribution distributions[] = { |
75 | { System_Familiar, "FamiliarLinux", "/etc/familiar-version" }, | 75 | { System_Familiar, "FamiliarLinux", "/etc/familiar-version" }, |
76 | { System_OpenZaurus, "OpenZaurus", "/etc/oz_version" }, | 76 | { System_OpenZaurus, "OpenZaurus", "/etc/oz_version" }, |
77 | { System_OpenEmbedded, "OpenEmbedded", "/etc/oe-version" }, | 77 | { System_OpenEmbedded, "OpenEmbedded", "/etc/oe-version" }, |
78 | { System_Unknown, "Linux", "/etc/issue" }, | 78 | { System_Unknown, "Linux", "/etc/issue" }, |
79 | }; | 79 | }; |
80 | 80 | ||
81 | 81 | ||
82 | /* EXPORT */ bool isQWS(){ | 82 | /* EXPORT */ bool isQWS(){ |
83 | return qApp ? ( qApp->type() == QApplication::GuiServer ) : false; | 83 | return qApp ? ( qApp->type() == QApplication::GuiServer ) : false; |
84 | } | 84 | } |
85 | 85 | ||
86 | /* EXPORT */ QCString makeChannel ( const char *str ){ | 86 | /* EXPORT */ QCString makeChannel ( const char *str ){ |
87 | if ( str && !::strchr ( str, '/' )) | 87 | if ( str && !::strchr ( str, '/' )) |
88 | return QCString ( "QPE/Application/" ) + str; | 88 | return QCString ( "QPE/Application/" ) + str; |
89 | else | 89 | else |
90 | return str; | 90 | return str; |
91 | } | 91 | } |
92 | 92 | ||
93 | 93 | ||
94 | 94 | ||
@@ -633,129 +633,129 @@ void ODevice::reloadButtonMapping() | |||
633 | void ODevice::remapPressedAction ( int button, const OQCopMessage &action ) | 633 | void ODevice::remapPressedAction ( int button, const OQCopMessage &action ) |
634 | { | 634 | { |
635 | initButtons(); | 635 | initButtons(); |
636 | 636 | ||
637 | QString mb_chan; | 637 | QString mb_chan; |
638 | 638 | ||
639 | if ( button >= (int) d->m_buttons->count()) | 639 | if ( button >= (int) d->m_buttons->count()) |
640 | return; | 640 | return; |
641 | 641 | ||
642 | ODeviceButton &b = ( *d->m_buttons ) [button]; | 642 | ODeviceButton &b = ( *d->m_buttons ) [button]; |
643 | b. setPressedAction ( action ); | 643 | b. setPressedAction ( action ); |
644 | 644 | ||
645 | mb_chan=b. pressedAction(). channel(); | 645 | mb_chan=b. pressedAction(). channel(); |
646 | 646 | ||
647 | Config buttonFile ( "ButtonSettings" ); | 647 | Config buttonFile ( "ButtonSettings" ); |
648 | buttonFile. setGroup ( "Button" + QString::number ( button )); | 648 | buttonFile. setGroup ( "Button" + QString::number ( button )); |
649 | buttonFile. writeEntry ( "PressedActionChannel", (const char*) mb_chan); | 649 | buttonFile. writeEntry ( "PressedActionChannel", (const char*) mb_chan); |
650 | buttonFile. writeEntry ( "PressedActionMessage", (const char*) b. pressedAction(). message()); | 650 | buttonFile. writeEntry ( "PressedActionMessage", (const char*) b. pressedAction(). message()); |
651 | 651 | ||
652 | // buttonFile. writeEntry ( "PressedActionArgs", encodeBase64 ( b. pressedAction(). data())); | 652 | // buttonFile. writeEntry ( "PressedActionArgs", encodeBase64 ( b. pressedAction(). data())); |
653 | 653 | ||
654 | QCopEnvelope ( "QPE/System", "deviceButtonMappingChanged()" ); | 654 | QCopEnvelope ( "QPE/System", "deviceButtonMappingChanged()" ); |
655 | } | 655 | } |
656 | 656 | ||
657 | void ODevice::remapHeldAction ( int button, const OQCopMessage &action ) | 657 | void ODevice::remapHeldAction ( int button, const OQCopMessage &action ) |
658 | { | 658 | { |
659 | initButtons(); | 659 | initButtons(); |
660 | 660 | ||
661 | if ( button >= (int) d->m_buttons->count()) | 661 | if ( button >= (int) d->m_buttons->count()) |
662 | return; | 662 | return; |
663 | 663 | ||
664 | ODeviceButton &b = ( *d->m_buttons ) [button]; | 664 | ODeviceButton &b = ( *d->m_buttons ) [button]; |
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 | { |
730 | Opie::Core::OKeyFilter::inst()->remPreHandler(aFilter); | 730 | Opie::Core::OKeyFilter::inst()->remPreHandler(aFilter); |
731 | } | 731 | } |
732 | 732 | ||
733 | 733 | ||
734 | /** | 734 | /** |
735 | * @internal | 735 | * @internal |
736 | * | 736 | * |
737 | * @see changeMixerForAlarm | 737 | * @see changeMixerForAlarm |
738 | */ | 738 | */ |
739 | void ODevice::playingStopped() { | 739 | void ODevice::playingStopped() { |
740 | if ( sender() ) | 740 | if ( sender() ) |
741 | const_cast<QObject*>(sender())->disconnect( this ); | 741 | const_cast<QObject*>(sender())->disconnect( this ); |
742 | 742 | ||
743 | #ifndef QT_NO_SOUND | 743 | #ifndef QT_NO_SOUND |
744 | if ( d->m_sound >= 0 ) { | 744 | if ( d->m_sound >= 0 ) { |
745 | ::ioctl ( d->m_sound, MIXER_WRITE( d->m_mixer ), &d->m_vol ); | 745 | ::ioctl ( d->m_sound, MIXER_WRITE( d->m_mixer ), &d->m_vol ); |
746 | ::close ( d->m_sound ); | 746 | ::close ( d->m_sound ); |
747 | } | 747 | } |
748 | #endif | 748 | #endif |
749 | } | 749 | } |
750 | 750 | ||
751 | 751 | ||
752 | /** | 752 | /** |
753 | * \brief Change the Volume for the Alarm and set it back after playing is finished | 753 | * \brief Change the Volume for the Alarm and set it back after playing is finished |
754 | * | 754 | * |
755 | * If you play an Alarm Sound you might want to change the Mixer to | 755 | * If you play an Alarm Sound you might want to change the Mixer to |
756 | * full volume and ignore the user setting. After it \sa Sound::isFinished | 756 | * full volume and ignore the user setting. After it \sa Sound::isFinished |
757 | * you would turn the volume back to the user preference. | 757 | * you would turn the volume back to the user preference. |
758 | * The problem is that we used to enter the event loop while waiting | 758 | * The problem is that we used to enter the event loop while waiting |
759 | * for the sound to be finished triggering all kind of reentrance | 759 | * for the sound to be finished triggering all kind of reentrance |
760 | * problems what a library shouldn't introduce. | 760 | * problems what a library shouldn't introduce. |
761 | * Instead of manually waiting for the sound to be finished use | 761 | * Instead of manually waiting for the sound to be finished use |
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,119 +1,120 @@ | |||
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 | } |
119 | } | 120 | } |
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 | |||
@@ -1,117 +1,115 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | =. (C) 2005 Michael 'Mickey' Lauer <mickey@Vanille.de> | 3 | =. (C) 2005 Michael 'Mickey' Lauer <mickey@Vanille.de> |
4 | .=l. | 4 | .=l. |
5 | .>+-= | 5 | .>+-= |
6 | _;:, .> :=|. This program is free software; you can | 6 | _;:, .> :=|. This program is free software; you can |
7 | .> <`_, > . <= redistribute it and/or modify it under | 7 | .> <`_, > . <= redistribute it and/or modify it under |
8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
9 | .="- .-=="i, .._ License as published by the Free Software | 9 | .="- .-=="i, .._ License as published by the Free Software |
10 | - . .-<_> .<> Foundation; version 2 of the License. | 10 | - . .-<_> .<> Foundation; version 2 of the License. |
11 | ._= =} : | 11 | ._= =} : |
12 | .%`+i> _;_. | 12 | .%`+i> _;_. |
13 | .i_,=:_. -<s. This program is distributed in the hope that | 13 | .i_,=:_. -<s. This program is distributed in the hope that |
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
15 | : .. .:, . . . without even the implied warranty of | 15 | : .. .:, . . . without even the implied warranty of |
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
18 | ..}^=.= = ; Library General Public License for more | 18 | ..}^=.= = ; Library General Public License for more |
19 | ++= -. .` .: details. | 19 | ++= -. .` .: details. |
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 | { |
86 | qWarning( "OPcmciaSystem::OPcmciaSystem() - can't open /proc/devices - continuing with limited functionality." ); | 84 | qWarning( "OPcmciaSystem::OPcmciaSystem() - can't open /proc/devices - continuing with limited functionality." ); |
87 | } | 85 | } |
88 | 86 | ||
89 | synchronize(); | 87 | synchronize(); |
90 | } | 88 | } |
91 | 89 | ||
92 | void OPcmciaSystem::synchronize() | 90 | void OPcmciaSystem::synchronize() |
93 | { | 91 | { |
94 | qDebug( "OPcmciaSystem::synchronize()" ); | 92 | qDebug( "OPcmciaSystem::synchronize()" ); |
95 | _interfaces.clear(); | 93 | _interfaces.clear(); |
96 | 94 | ||
97 | //NOTE: We _could_ use ioctl's here as well, however we want to know if | 95 | //NOTE: We _could_ use ioctl's here as well, however we want to know if |
98 | // the card is recognized by the cardmgr (hence has a valid binding) | 96 | // the card is recognized by the cardmgr (hence has a valid binding) |
99 | // If it is not recognized yet, userland may want to provide a configuration dialog | 97 | // If it is not recognized yet, userland may want to provide a configuration dialog |
100 | //TODO: Revise for pcmciautils | 98 | //TODO: Revise for pcmciautils |
101 | 99 | ||
102 | QString fileName; | 100 | QString fileName; |
103 | if ( QFile::exists( "/var/run/stab" ) ) { fileName = "/var/run/stab"; } | 101 | if ( QFile::exists( "/var/run/stab" ) ) { fileName = "/var/run/stab"; } |
104 | else if ( QFile::exists( "/var/state/pcmcia/stab" ) ) { fileName = "/var/state/pcmcia/stab"; } | 102 | else if ( QFile::exists( "/var/state/pcmcia/stab" ) ) { fileName = "/var/state/pcmcia/stab"; } |
105 | else { fileName = "/var/lib/pcmcia/stab"; } | 103 | else { fileName = "/var/lib/pcmcia/stab"; } |
106 | QFile cardinfofile( fileName ); | 104 | QFile cardinfofile( fileName ); |
107 | if ( !cardinfofile.exists() || !cardinfofile.open( IO_ReadOnly ) ) | 105 | if ( !cardinfofile.exists() || !cardinfofile.open( IO_ReadOnly ) ) |
108 | { | 106 | { |
109 | qWarning( "pcmcia info file not found or unaccessible" ); | 107 | qWarning( "pcmcia info file not found or unaccessible" ); |
110 | return; | 108 | return; |
111 | } | 109 | } |
112 | QTextStream cardinfo( &cardinfofile ); | 110 | QTextStream cardinfo( &cardinfofile ); |
113 | while ( !cardinfo.atEnd() ) | 111 | while ( !cardinfo.atEnd() ) |
114 | { | 112 | { |
115 | QString strSocket; | 113 | QString strSocket; |
116 | int numSocket; | 114 | int numSocket; |
117 | char colon; | 115 | char colon; |