Diffstat (limited to 'libopie2/opiecore/device/odevice_beagle.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiecore/device/odevice_beagle.cpp | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/libopie2/opiecore/device/odevice_beagle.cpp b/libopie2/opiecore/device/odevice_beagle.cpp index ac12ca6..8735c63 100644 --- a/libopie2/opiecore/device/odevice_beagle.cpp +++ b/libopie2/opiecore/device/odevice_beagle.cpp | |||
@@ -1,57 +1,58 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | Â Â Â Â Â Â Â Â This file is part of the Opie Project |
3 | Copyright (C) 2004 The Opie Team <opie-devel@handhelds.org> | 3 | |
4 | Copyright (C)2004 The Opie Team <opie-devel@handhelds.org> | ||
4 | =. | 5 | =. |
5 | .=l. | 6 | .=l. |
6 | .>+-= | 7 | Â Â Â Â Â Â .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 8 | Â _;:, Â Â .> Â Â :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 9 | .> <`_, Â > Â . Â <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 10 | :`=1 )Y*s>-.-- Â : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 11 | .="- .-=="i, Â Â .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 12 | Â - . Â .-<_> Â Â .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 13 | Â Â Â ._= =} Â Â Â : or (at your option) any later version. |
13 | .%`+i> _;_. | 14 | Â Â .%`+i> Â Â Â _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 15 | Â Â .i_,=:_. Â Â Â -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 16 | Â Â Â + Â . Â -:. Â Â Â = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 17 | : .. Â Â .:, Â Â . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 18 | Â Â =_ Â Â Â Â + Â Â =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 19 | Â _.=:. Â Â Â : Â Â :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 20 | ..}^=.= Â Â Â = Â Â Â ; Library General Public License for more |
20 | ++= -. .` .: details. | 21 | ++= Â -. Â Â .` Â Â .: details. |
21 | : = ...= . :.=- | 22 | : Â Â = Â ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 23 | Â -. Â .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 24 | Â -_. . . Â )=. Â = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 25 | Â Â -- Â Â Â Â :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 26 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 27 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
28 | */ | 29 | */ |
29 | 30 | ||
30 | #include "odevicebutton.h" | 31 | #include "odevicebutton.h" |
31 | #include "odevice_beagle.h" | 32 | #include "odevice_beagle.h" |
32 | 33 | ||
33 | #include <qpe/resource.h> | 34 | #include <opie2/oresource.h> |
34 | 35 | ||
35 | #include <sys/types.h> | 36 | #include <sys/types.h> |
36 | #include <sys/ioctl.h> | 37 | #include <sys/ioctl.h> |
37 | #include <fcntl.h> | 38 | #include <fcntl.h> |
38 | #include <unistd.h> | 39 | #include <unistd.h> |
39 | 40 | ||
40 | 41 | ||
41 | /* | 42 | /* |
42 | * Intel Assabat FrontLight Control | 43 | * Intel Assabat FrontLight Control |
43 | */ | 44 | */ |
44 | #define _SA1100_FL_IOCTL_ON 1 | 45 | #define _SA1100_FL_IOCTL_ON 1 |
45 | #define _SA1100_FL_IOCTL_OFF 2 | 46 | #define _SA1100_FL_IOCTL_OFF 2 |
46 | #define _SA1100_FL_IOCTL_INTENSITY3 | 47 | #define _SA1100_FL_IOCTL_INTENSITY3 |
47 | #define _SA1100_FL_IOCTL_BACKLIGHT 4 | 48 | #define _SA1100_FL_IOCTL_BACKLIGHT 4 |
48 | #define _SA1100_FL_IOCTL_CONTRAST5 | 49 | #define _SA1100_FL_IOCTL_CONTRAST5 |
49 | #define _SA1100_FL_IOCTL_GET_BACKLIGHT 6 | 50 | #define _SA1100_FL_IOCTL_GET_BACKLIGHT 6 |
50 | #define _SA1100_FL_IOCTL_GET_CONTRAST 7 | 51 | #define _SA1100_FL_IOCTL_GET_CONTRAST 7 |
51 | // added by Sean Hsieh | 52 | // added by Sean Hsieh |
52 | #define _SA1100_FL_IOCTL_PWR_TOGGLE 8 | 53 | #define _SA1100_FL_IOCTL_PWR_TOGGLE 8 |
53 | #define _SA1100_FL_IOCTL_AUTOLIGHT 10 | 54 | #define _SA1100_FL_IOCTL_AUTOLIGHT 10 |
54 | 55 | ||
55 | /* | 56 | /* |
56 | * The device | 57 | * The device |
57 | */ | 58 | */ |
@@ -125,49 +126,49 @@ void Beagle::init( const QString&) { | |||
125 | d->m_rotation = Rot0; | 126 | d->m_rotation = Rot0; |
126 | d->m_model = Model_Beagle_PA100; | 127 | d->m_model = Model_Beagle_PA100; |
127 | } | 128 | } |
128 | 129 | ||
129 | 130 | ||
130 | /* | 131 | /* |
131 | * Initialize the Buttons. We only do it | 132 | * Initialize the Buttons. We only do it |
132 | * if not yet initialized. | 133 | * if not yet initialized. |
133 | * We go through our hardware button array | 134 | * We go through our hardware button array |
134 | * and set the 'Factory' Pressed and Held Action | 135 | * and set the 'Factory' Pressed and Held Action |
135 | * reloadButtonMapping will then apply the user | 136 | * reloadButtonMapping will then apply the user |
136 | * configuration to the buttons | 137 | * configuration to the buttons |
137 | */ | 138 | */ |
138 | void Beagle::initButtons() { | 139 | void Beagle::initButtons() { |
139 | if ( d->m_buttons ) | 140 | if ( d->m_buttons ) |
140 | return; | 141 | return; |
141 | 142 | ||
142 | d->m_buttons = new QValueList<ODeviceButton>; | 143 | d->m_buttons = new QValueList<ODeviceButton>; |
143 | uint length = sizeof( beagle_buttons )/ sizeof( b_button ); | 144 | uint length = sizeof( beagle_buttons )/ sizeof( b_button ); |
144 | for ( uint i = 0; i < length; ++i ) { | 145 | for ( uint i = 0; i < length; ++i ) { |
145 | b_button *bb = &beagle_buttons[i]; | 146 | b_button *bb = &beagle_buttons[i]; |
146 | ODeviceButton b; | 147 | ODeviceButton b; |
147 | b.setKeycode( bb->code ); | 148 | b.setKeycode( bb->code ); |
148 | b.setUserText( QObject::tr( "Button", bb->utext ) ); | 149 | b.setUserText( QObject::tr( "Button", bb->utext ) ); |
149 | b.setPixmap( Resource::loadPixmap( bb->pix ) ); | 150 | b.setPixmap( OResource::loadPixmap( bb->pix ) ); |
150 | b.setFactoryPresetPressedAction( OQCopMessage( makeChannel( bb->fpressedservice ), bb->fpressedaction ) ); | 151 | b.setFactoryPresetPressedAction( OQCopMessage( makeChannel( bb->fpressedservice ), bb->fpressedaction ) ); |
151 | b.setFactoryPresetHeldAction( OQCopMessage( makeChannel( bb->fheldservice ), bb->fheldaction ) ); | 152 | b.setFactoryPresetHeldAction( OQCopMessage( makeChannel( bb->fheldservice ), bb->fheldaction ) ); |
152 | d->m_buttons->append( b ); | 153 | d->m_buttons->append( b ); |
153 | } | 154 | } |
154 | 155 | ||
155 | reloadButtonMapping(); | 156 | reloadButtonMapping(); |
156 | } | 157 | } |
157 | 158 | ||
158 | /* | 159 | /* |
159 | * Turn the display on. We do it by ioctl on FL_FILE | 160 | * Turn the display on. We do it by ioctl on FL_FILE |
160 | */ | 161 | */ |
161 | bool Beagle::setDisplayStatus( bool on ) { | 162 | bool Beagle::setDisplayStatus( bool on ) { |
162 | int fd = ::open(FL_FILE, O_WRONLY); | 163 | int fd = ::open(FL_FILE, O_WRONLY); |
163 | 164 | ||
164 | if ( fd < 0 ) | 165 | if ( fd < 0 ) |
165 | return false; | 166 | return false; |
166 | 167 | ||
167 | return ( ::ioctl(fd, on ? _SA1100_FL_IOCTL_ON : _SA1100_FL_IOCTL_OFF, 0 ) == 0 ); | 168 | return ( ::ioctl(fd, on ? _SA1100_FL_IOCTL_ON : _SA1100_FL_IOCTL_OFF, 0 ) == 0 ); |
168 | } | 169 | } |
169 | 170 | ||
170 | /* | 171 | /* |
171 | * 0-100 are legal steps of the frontlight. | 172 | * 0-100 are legal steps of the frontlight. |
172 | */ | 173 | */ |
173 | int Beagle::displayBrightnessResolution()const { | 174 | int Beagle::displayBrightnessResolution()const { |