author | paule <paule> | 2007-06-29 05:58:46 (UTC) |
---|---|---|
committer | paule <paule> | 2007-06-29 05:58:46 (UTC) |
commit | 06bcedc305af0c1fe026abde4f4cc64b12b8ed63 (patch) (unidiff) | |
tree | 455f3bbc826a3a04f970bc7d7860d9a79c5f6cef | |
parent | 703d2871544d48268e1003a5534454f79f162b16 (diff) | |
download | opie-06bcedc305af0c1fe026abde4f4cc64b12b8ed63.zip opie-06bcedc305af0c1fe026abde4f4cc64b12b8ed63.tar.gz opie-06bcedc305af0c1fe026abde4f4cc64b12b8ed63.tar.bz2 |
Palm patches:
* Reorder keys (bug #1860)
* Add key F6 as rotate screen button for Palm LifeDrive (bug #1861)
* Fix backlight on Palm Treo 650 (bug #1862)
* Rotate function of directional keys when screen rotated (bug #1863)
Patches courtesy of Marek Vasut <marek.vasut@gmail.com>
-rw-r--r-- | libopie2/opiecore/device/odevice_palm.cpp | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/libopie2/opiecore/device/odevice_palm.cpp b/libopie2/opiecore/device/odevice_palm.cpp index 892083e..6d94687 100644 --- a/libopie2/opiecore/device/odevice_palm.cpp +++ b/libopie2/opiecore/device/odevice_palm.cpp | |||
@@ -1,440 +1,445 @@ | |||
1 | /* | 1 | /* |
2 | � � � � � � � � This file is part of the Opie Project | 2 | � � � � � � � � This file is part of the Opie Project |
3 | 3 | ||
4 | Copyright (C)2002-2005 The Opie Team <opie-devel@handhelds.org> | 4 | Copyright (C)2002-2005 The Opie Team <opie-devel@handhelds.org> |
5 | =. | 5 | =. |
6 | .=l. | 6 | .=l. |
7 | � � � � � �.>+-= | 7 | � � � � � �.>+-= |
8 | �_;:, � � .> � �:=|. This program is free software; you can | 8 | �_;:, � � .> � �:=|. This program is free software; you can |
9 | .> <`_, � > �. � <= redistribute it and/or modify it under | 9 | .> <`_, � > �. � <= redistribute it and/or modify it under |
10 | :`=1 )Y*s>-.-- � : the terms of the GNU Library General Public | 10 | :`=1 )Y*s>-.-- � : the terms of the GNU Library General Public |
11 | .="- .-=="i, � � .._ License as published by the Free Software | 11 | .="- .-=="i, � � .._ License as published by the Free Software |
12 | �- . � .-<_> � � .<> Foundation; either version 2 of the License, | 12 | �- . � .-<_> � � .<> Foundation; either version 2 of the License, |
13 | � � �._= =} � � � : or (at your option) any later version. | 13 | � � �._= =} � � � : or (at your option) any later version. |
14 | � � .%`+i> � � � _;_. | 14 | � � .%`+i> � � � _;_. |
15 | � � .i_,=:_. � � �-<s. This program is distributed in the hope that | 15 | � � .i_,=:_. � � �-<s. This program is distributed in the hope that |
16 | � � �+ �. �-:. � � � = it will be useful, but WITHOUT ANY WARRANTY; | 16 | � � �+ �. �-:. � � � = it will be useful, but WITHOUT ANY WARRANTY; |
17 | : .. � �.:, � � . . . without even the implied warranty of | 17 | : .. � �.:, � � . . . without even the implied warranty of |
18 | � � =_ � � � �+ � � =;=|` MERCHANTABILITY or FITNESS FOR A | 18 | � � =_ � � � �+ � � =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | � _.=:. � � � : � �:=>`: PARTICULAR PURPOSE. See the GNU | 19 | � _.=:. � � � : � �:=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= � � � = � � � ; Library General Public License for more | 20 | ..}^=.= � � � = � � � ; Library General Public License for more |
21 | ++= � -. � � .` � � .: details. | 21 | ++= � -. � � .` � � .: details. |
22 | : � � = �...= . :.=- | 22 | : � � = �...= . :.=- |
23 | �-. � .:....=;==+<; You should have received a copy of the GNU | 23 | �-. � .:....=;==+<; You should have received a copy of the GNU |
24 | � -_. . . � )=. �= Library General Public License along with | 24 | � -_. . . � )=. �= Library General Public License along with |
25 | � � -- � � � �:-=` this library; see the file COPYING.LIB. | 25 | � � -- � � � �:-=` this library; see the file COPYING.LIB. |
26 | If not, write to the Free Software Foundation, | 26 | If not, write to the Free Software Foundation, |
27 | Inc., 59 Temple Place - Suite 330, | 27 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include "odevice_palm.h" | 31 | #include "odevice_palm.h" |
32 | 32 | ||
33 | /* QT */ | 33 | /* QT */ |
34 | #include <qapplication.h> | 34 | #include <qapplication.h> |
35 | #include <qfile.h> | 35 | #include <qfile.h> |
36 | #include <qtextstream.h> | 36 | #include <qtextstream.h> |
37 | #include <qwindowsystem_qws.h> | 37 | #include <qwindowsystem_qws.h> |
38 | #include <qgfx_qws.h> | 38 | #include <qgfx_qws.h> |
39 | 39 | ||
40 | /* OPIE */ | 40 | /* OPIE */ |
41 | #include <qpe/config.h> | 41 | #include <qpe/config.h> |
42 | #include <qpe/sound.h> | 42 | #include <qpe/sound.h> |
43 | #include <qpe/qcopenvelope_qws.h> | 43 | #include <qpe/qcopenvelope_qws.h> |
44 | 44 | ||
45 | #include <opie2/okeyfilter.h> | 45 | #include <opie2/okeyfilter.h> |
46 | #include <opie2/oresource.h> | 46 | #include <opie2/oresource.h> |
47 | 47 | ||
48 | /* STD */ | 48 | /* STD */ |
49 | #include <fcntl.h> | 49 | #include <fcntl.h> |
50 | #include <math.h> | 50 | #include <math.h> |
51 | #include <stdlib.h> | 51 | #include <stdlib.h> |
52 | #include <signal.h> | 52 | #include <signal.h> |
53 | #include <sys/ioctl.h> | 53 | #include <sys/ioctl.h> |
54 | #include <sys/time.h> | 54 | #include <sys/time.h> |
55 | #include <unistd.h> | 55 | #include <unistd.h> |
56 | #ifndef QT_NO_SOUND | 56 | #ifndef QT_NO_SOUND |
57 | #include <linux/soundcard.h> | 57 | #include <linux/soundcard.h> |
58 | #endif | 58 | #endif |
59 | 59 | ||
60 | using namespace Opie::Core; | 60 | using namespace Opie::Core; |
61 | using namespace Opie::Core::Internal; | 61 | using namespace Opie::Core::Internal; |
62 | 62 | ||
63 | struct palm_button palm_buttons [] = { | 63 | struct palm_button palm_buttons [] = { |
64 | { Model_Palm_LD, | ||
65 | Qt::Key_F6, QT_TRANSLATE_NOOP( "Button", "Rotate Button" ), | ||
66 | "devicebuttons/palm_rotate", | ||
67 | "QPE/Rotation", "flip()", | ||
68 | 0, 0 }, | ||
69 | { Model_Palm_LD | Model_Palm_Z72 | Model_Palm_T600 | Model_Palm_T650 | | ||
70 | Model_Palm_T680 | Model_Palm_T700W | Model_Palm_T700P | | ||
71 | Model_Palm_T750 | Model_Palm_T755P, | ||
72 | Qt::Key_F7, QT_TRANSLATE_NOOP( "Button", "Record Button" ), | ||
73 | "devicebuttons/palm_record", | ||
74 | "QPE/VMemo", "toggleRecord()", | ||
75 | "sound", "raise()" }, | ||
76 | { Model_Palm_TT | Model_Palm_TT2 | Model_Palm_TT3 | Model_Palm_TT5 | | ||
77 | Model_Palm_TE | Model_Palm_TE2 | Model_Palm_TC | Model_Palm_LD | | ||
78 | Model_Palm_TX | Model_Palm_Z71 | Model_Palm_Z72 | Model_Palm_T600 | | ||
79 | Model_Palm_T650 | Model_Palm_T680 | Model_Palm_T700W | | ||
80 | Model_Palm_T700P | Model_Palm_T750 | Model_Palm_T755P, | ||
81 | Qt::Key_F8, QT_TRANSLATE_NOOP( "Button", "Suspend Button" ), | ||
82 | "devicebuttons/palm_suspend", | ||
83 | "suspend", "raise()", | ||
84 | "suspend", "raise()" }, | ||
64 | { Model_Palm_TT | Model_Palm_TT2 | Model_Palm_TT3 | Model_Palm_TT5 | | 85 | { Model_Palm_TT | Model_Palm_TT2 | Model_Palm_TT3 | Model_Palm_TT5 | |
65 | Model_Palm_TE | Model_Palm_TE2 | Model_Palm_TC | Model_Palm_LD | | 86 | Model_Palm_TE | Model_Palm_TE2 | Model_Palm_TC | Model_Palm_LD | |
66 | Model_Palm_TX | Model_Palm_Z71 | Model_Palm_Z72 | Model_Palm_T600 | | 87 | Model_Palm_TX | Model_Palm_Z71 | Model_Palm_Z72 | Model_Palm_T600 | |
67 | Model_Palm_T650 | Model_Palm_T680 | Model_Palm_T700W | | 88 | Model_Palm_T650 | Model_Palm_T680 | Model_Palm_T700W | |
68 | Model_Palm_T700P | Model_Palm_T750 | Model_Palm_T755P, | 89 | Model_Palm_T700P | Model_Palm_T750 | Model_Palm_T755P, |
69 | Qt::Key_F9, QT_TRANSLATE_NOOP( "Button", "Home Button" ), | 90 | Qt::Key_F9, QT_TRANSLATE_NOOP( "Button", "Home Button" ), |
70 | "devicebuttons/palm_home", | 91 | "devicebuttons/palm_home", |
71 | "QPE/Launcher", "home()", | 92 | "QPE/Launcher", "home()", |
72 | "buttonsettings", "raise()" }, | 93 | "buttonsettings", "raise()" }, |
73 | { Model_Palm_TT | Model_Palm_TT2 | Model_Palm_TT3 | Model_Palm_TT5 | | 94 | { Model_Palm_TT | Model_Palm_TT2 | Model_Palm_TT3 | Model_Palm_TT5 | |
74 | Model_Palm_TE | Model_Palm_TE2 | Model_Palm_TC | Model_Palm_LD | | 95 | Model_Palm_TE | Model_Palm_TE2 | Model_Palm_TC | Model_Palm_LD | |
75 | Model_Palm_TX | Model_Palm_Z71 | Model_Palm_Z72 | Model_Palm_T600 | | 96 | Model_Palm_TX | Model_Palm_Z71 | Model_Palm_Z72 | Model_Palm_T600 | |
76 | Model_Palm_T650 | Model_Palm_T680 | Model_Palm_T700W | | 97 | Model_Palm_T650 | Model_Palm_T680 | Model_Palm_T700W | |
77 | Model_Palm_T700P | Model_Palm_T750 | Model_Palm_T755P, | 98 | Model_Palm_T700P | Model_Palm_T750 | Model_Palm_T755P, |
78 | Qt::Key_F10, QT_TRANSLATE_NOOP( "Button", "Calendar Button" ), | 99 | Qt::Key_F10, QT_TRANSLATE_NOOP( "Button", "Calendar Button" ), |
79 | "devicebuttons/palm_calendar", | 100 | "devicebuttons/palm_calendar", |
80 | "datebook", "nextView()", | 101 | "datebook", "nextView()", |
81 | "today", "raise()" }, | 102 | "today", "raise()" }, |
82 | { Model_Palm_TT | Model_Palm_TT2 | Model_Palm_TT3 | Model_Palm_TT5 | | 103 | { Model_Palm_TT | Model_Palm_TT2 | Model_Palm_TT3 | Model_Palm_TT5 | |
83 | Model_Palm_TE | Model_Palm_TE2 | Model_Palm_TC | Model_Palm_LD | | 104 | Model_Palm_TE | Model_Palm_TE2 | Model_Palm_TC | Model_Palm_LD | |
84 | Model_Palm_TX | Model_Palm_Z71 | Model_Palm_Z72 | Model_Palm_T600 | | 105 | Model_Palm_TX | Model_Palm_Z71 | Model_Palm_Z72 | Model_Palm_T600 | |
85 | Model_Palm_T650 | Model_Palm_T680 | Model_Palm_T700W | | 106 | Model_Palm_T650 | Model_Palm_T680 | Model_Palm_T700W | |
86 | Model_Palm_T700P | Model_Palm_T750 | Model_Palm_T755P, | 107 | Model_Palm_T700P | Model_Palm_T750 | Model_Palm_T755P, |
87 | Qt::Key_F11, QT_TRANSLATE_NOOP( "Button", "Todo Button" ), | 108 | Qt::Key_F11, QT_TRANSLATE_NOOP( "Button", "Todo Button" ), |
88 | "devicebuttons/palm_todo", | 109 | "devicebuttons/palm_todo", |
89 | "todolist", "raise()", | 110 | "todolist", "raise()", |
90 | "todolist", "create()" }, | 111 | "todolist", "create()" }, |
91 | { Model_Palm_TT | Model_Palm_TT2 | Model_Palm_TT3 | Model_Palm_TT5 | | 112 | { Model_Palm_TT | Model_Palm_TT2 | Model_Palm_TT3 | Model_Palm_TT5 | |
92 | Model_Palm_TE | Model_Palm_TE2 | Model_Palm_TC | Model_Palm_LD | | 113 | Model_Palm_TE | Model_Palm_TE2 | Model_Palm_TC | Model_Palm_LD | |
93 | Model_Palm_TX | Model_Palm_Z71 | Model_Palm_Z72 | Model_Palm_T600 | | 114 | Model_Palm_TX | Model_Palm_Z71 | Model_Palm_Z72 | Model_Palm_T600 | |
94 | Model_Palm_T650 | Model_Palm_T680 | Model_Palm_T700W | | 115 | Model_Palm_T650 | Model_Palm_T680 | Model_Palm_T700W | |
95 | Model_Palm_T700P | Model_Palm_T750 | Model_Palm_T755P, | 116 | Model_Palm_T700P | Model_Palm_T750 | Model_Palm_T755P, |
96 | Qt::Key_F12, QT_TRANSLATE_NOOP( "Button", "Mail Button" ), | 117 | Qt::Key_F12, QT_TRANSLATE_NOOP( "Button", "Mail Button" ), |
97 | "devicebuttons/palm_mail", | 118 | "devicebuttons/palm_mail", |
98 | "opiemail", "raise()", | 119 | "opiemail", "raise()", |
99 | "opiemail", "newmail()" }, | 120 | "opiemail", "newmail()" }, |
100 | { Model_Palm_LD | Model_Palm_Z72 | Model_Palm_T600 | Model_Palm_T650 | | ||
101 | Model_Palm_T680 | Model_Palm_T700W | Model_Palm_T700P | | ||
102 | Model_Palm_T750 | Model_Palm_T755P, | ||
103 | Qt::Key_F7, QT_TRANSLATE_NOOP( "Button", "Record Button" ), | ||
104 | "devicebuttons/palm_record", | ||
105 | "QPE/VMemo", "toggleRecord()", | ||
106 | "sound", "raise()" }, | ||
107 | { Model_Palm_TT | Model_Palm_TT2 | Model_Palm_TT3 | Model_Palm_TT5 | | ||
108 | Model_Palm_TE | Model_Palm_TE2 | Model_Palm_TC | Model_Palm_LD | | ||
109 | Model_Palm_TX | Model_Palm_Z71 | Model_Palm_Z72 | Model_Palm_T600 | | ||
110 | Model_Palm_T650 | Model_Palm_T680 | Model_Palm_T700W | | ||
111 | Model_Palm_T700P | Model_Palm_T750 | Model_Palm_T755P, | ||
112 | Qt::Key_F8, QT_TRANSLATE_NOOP( "Button", "Suspend Button" ), | ||
113 | "devicebuttons/palm_suspend", | ||
114 | "suspend", "raise()", | ||
115 | "suspend", "raise()" }, | ||
116 | }; | 121 | }; |
117 | 122 | ||
118 | void Palm::init(const QString& cpu_info) | 123 | void Palm::init(const QString& cpu_info) |
119 | { | 124 | { |
120 | d->m_vendorstr = "Palm"; | 125 | d->m_vendorstr = "Palm"; |
121 | d->m_vendor = Vendor_Palm; | 126 | d->m_vendor = Vendor_Palm; |
122 | 127 | ||
123 | QString model = "unknown"; | 128 | QString model = "unknown"; |
124 | 129 | ||
125 | int loc = cpu_info.find( ":" ); | 130 | int loc = cpu_info.find( ":" ); |
126 | if ( loc != -1 ) | 131 | if ( loc != -1 ) |
127 | model = cpu_info.mid( loc+2 ).simplifyWhiteSpace(); | 132 | model = cpu_info.mid( loc+2 ).simplifyWhiteSpace(); |
128 | else | 133 | else |
129 | model = cpu_info; | 134 | model = cpu_info; |
130 | 135 | ||
131 | if ( model == "Palm Tungsten T" ) { | 136 | if ( model == "Palm Tungsten T" ) { |
132 | d->m_modelstr = "Palm Tungsten|T"; | 137 | d->m_modelstr = "Palm Tungsten|T"; |
133 | d->m_model = Model_Palm_TT; | 138 | d->m_model = Model_Palm_TT; |
134 | } | 139 | } |
135 | else if ( model == "Palm Tungsten T2" ) { | 140 | else if ( model == "Palm Tungsten T2" ) { |
136 | d->m_modelstr = "Palm Tungsten|T2"; | 141 | d->m_modelstr = "Palm Tungsten|T2"; |
137 | d->m_model = Model_Palm_TT2; | 142 | d->m_model = Model_Palm_TT2; |
138 | } | 143 | } |
139 | else if ( model == "Palm Tungsten T3" ) { | 144 | else if ( model == "Palm Tungsten T3" ) { |
140 | d->m_modelstr = "Palm Tungsten|T3"; | 145 | d->m_modelstr = "Palm Tungsten|T3"; |
141 | d->m_model = Model_Palm_TT3; | 146 | d->m_model = Model_Palm_TT3; |
142 | } | 147 | } |
143 | else if ( model == "Palm Tungsten T5" ) { | 148 | else if ( model == "Palm Tungsten T5" ) { |
144 | d->m_modelstr = "Palm Tungsten|T5"; | 149 | d->m_modelstr = "Palm Tungsten|T5"; |
145 | d->m_model = Model_Palm_TT5; | 150 | d->m_model = Model_Palm_TT5; |
146 | } | 151 | } |
147 | else if ( model == "Palm Tungsten C" ) { | 152 | else if ( model == "Palm Tungsten C" ) { |
148 | d->m_modelstr = "Palm Tungsten|C"; | 153 | d->m_modelstr = "Palm Tungsten|C"; |
149 | d->m_model = Model_Palm_TC; | 154 | d->m_model = Model_Palm_TC; |
150 | } | 155 | } |
151 | else if ( model == "Palm Tungsten E" ) { | 156 | else if ( model == "Palm Tungsten E" ) { |
152 | d->m_modelstr = "Palm Tungsten|E"; | 157 | d->m_modelstr = "Palm Tungsten|E"; |
153 | d->m_model = Model_Palm_TE; | 158 | d->m_model = Model_Palm_TE; |
154 | } | 159 | } |
155 | else if ( model == "Palm Tungsten E2" ) { | 160 | else if ( model == "Palm Tungsten E2" ) { |
156 | d->m_modelstr = "Palm Tungsten|E2"; | 161 | d->m_modelstr = "Palm Tungsten|E2"; |
157 | d->m_model = Model_Palm_TE2; | 162 | d->m_model = Model_Palm_TE2; |
158 | } | 163 | } |
159 | else if ( model == "Palm LifeDrive" ) { | 164 | else if ( model == "Palm LifeDrive" ) { |
160 | d->m_modelstr = "Palm LifeDrive"; | 165 | d->m_modelstr = "Palm LifeDrive"; |
161 | d->m_model = Model_Palm_LD; | 166 | d->m_model = Model_Palm_LD; |
162 | } | 167 | } |
163 | else if ( model == "Palm TX" ) { | 168 | else if ( model == "Palm TX" ) { |
164 | d->m_modelstr = "Palm TX"; | 169 | d->m_modelstr = "Palm TX"; |
165 | d->m_model = Model_Palm_TX; | 170 | d->m_model = Model_Palm_TX; |
166 | } | 171 | } |
167 | else if ( model == "Palm Zire 71" ) { | 172 | else if ( model == "Palm Zire 71" ) { |
168 | d->m_modelstr = "Palm Zire 71"; | 173 | d->m_modelstr = "Palm Zire 71"; |
169 | d->m_model = Model_Palm_Z71; | 174 | d->m_model = Model_Palm_Z71; |
170 | } | 175 | } |
171 | else if ( model == "Palm Zire 72" ) { | 176 | else if ( model == "Palm Zire 72" ) { |
172 | d->m_modelstr = "Palm Zire 72"; | 177 | d->m_modelstr = "Palm Zire 72"; |
173 | d->m_model = Model_Palm_Z72; | 178 | d->m_model = Model_Palm_Z72; |
174 | } | 179 | } |
175 | else if ( model == "Palm Treo 600" ) { | 180 | else if ( model == "Palm Treo 600" ) { |
176 | d->m_modelstr = "Palm Treo 600"; | 181 | d->m_modelstr = "Palm Treo 600"; |
177 | d->m_model = Model_Palm_T600; | 182 | d->m_model = Model_Palm_T600; |
178 | } | 183 | } |
179 | else if ( model == "Palm Treo 650" ) { | 184 | else if ( model == "Palm Treo 650" ) { |
180 | d->m_modelstr = "Palm Treo 650"; | 185 | d->m_modelstr = "Palm Treo 650"; |
181 | d->m_model = Model_Palm_T650; | 186 | d->m_model = Model_Palm_T650; |
182 | } | 187 | } |
183 | else if ( model == "Palm Treo 680" ) { | 188 | else if ( model == "Palm Treo 680" ) { |
184 | d->m_modelstr = "Palm Treo 680"; | 189 | d->m_modelstr = "Palm Treo 680"; |
185 | d->m_model = Model_Palm_T680; | 190 | d->m_model = Model_Palm_T680; |
186 | } | 191 | } |
187 | else if ( model == "Palm Treo 700w" ) { | 192 | else if ( model == "Palm Treo 700w" ) { |
188 | d->m_modelstr = "Palm Treo 700w/700wx"; | 193 | d->m_modelstr = "Palm Treo 700w/700wx"; |
189 | d->m_model = Model_Palm_T700W; | 194 | d->m_model = Model_Palm_T700W; |
190 | } | 195 | } |
191 | else if ( model == "Palm Treo 700p" ) { | 196 | else if ( model == "Palm Treo 700p" ) { |
192 | d->m_modelstr = "Palm Treo 700p"; | 197 | d->m_modelstr = "Palm Treo 700p"; |
193 | d->m_model = Model_Palm_T700P; | 198 | d->m_model = Model_Palm_T700P; |
194 | } | 199 | } |
195 | else if ( model == "Palm Treo 750" ) { | 200 | else if ( model == "Palm Treo 750" ) { |
196 | d->m_modelstr = "Palm Treo 750"; | 201 | d->m_modelstr = "Palm Treo 750"; |
197 | d->m_model = Model_Palm_T750; | 202 | d->m_model = Model_Palm_T750; |
198 | } | 203 | } |
199 | else if ( model == "Palm Treo 755p" ) { | 204 | else if ( model == "Palm Treo 755p" ) { |
200 | d->m_modelstr= "Palm Treo 755"; | 205 | d->m_modelstr= "Palm Treo 755"; |
201 | d->m_model= Model_Palm_T755P; | 206 | d->m_model= Model_Palm_T755P; |
202 | } | 207 | } |
203 | else if ( model == "Palm Foleo" ) { | 208 | else if ( model == "Palm Foleo" ) { |
204 | d->m_modelstr= "Palm Foleo"; | 209 | d->m_modelstr= "Palm Foleo"; |
205 | d->m_model= Model_Palm_FOLEO; | 210 | d->m_model= Model_Palm_FOLEO; |
206 | } | 211 | } |
207 | else | 212 | else |
208 | d->m_model = Model_Unknown; | 213 | d->m_model = Model_Unknown; |
209 | 214 | ||
210 | switch ( d->m_model ) | 215 | switch ( d->m_model ) |
211 | { | 216 | { |
212 | case Model_Palm_TT3: | 217 | case Model_Palm_TT3: |
213 | case Model_Palm_TT5: | 218 | case Model_Palm_TT5: |
214 | case Model_Palm_TC: | 219 | case Model_Palm_TC: |
215 | case Model_Palm_LD: | 220 | case Model_Palm_LD: |
216 | case Model_Palm_TX: | 221 | case Model_Palm_TX: |
217 | case Model_Palm_TE2: | 222 | case Model_Palm_TE2: |
218 | case Model_Palm_Z72: | 223 | case Model_Palm_Z72: |
224 | case Model_Palm_T650: | ||
219 | m_backlightdev = "/sys/class/backlight/pxapwm-bl/"; | 225 | m_backlightdev = "/sys/class/backlight/pxapwm-bl/"; |
220 | d->m_rotation = Rot0; | 226 | d->m_rotation = Rot0; |
221 | d->m_direction = CCW; | 227 | d->m_direction = CCW; |
222 | d->m_qteDriver = "Transformed"; | 228 | d->m_qteDriver = "Transformed"; |
223 | break; | 229 | break; |
224 | case Model_Palm_T600: | 230 | case Model_Palm_T600: |
225 | case Model_Palm_TT: | 231 | case Model_Palm_TT: |
226 | case Model_Palm_TT2: | 232 | case Model_Palm_TT2: |
227 | case Model_Palm_TE: | 233 | case Model_Palm_TE: |
228 | case Model_Palm_Z71: | 234 | case Model_Palm_Z71: |
229 | m_backlightdev = "/sys/class/backlight/omap-bl/"; | 235 | m_backlightdev = "/sys/class/backlight/omap-bl/"; |
230 | break; | 236 | break; |
231 | case Model_Palm_T650: | ||
232 | case Model_Palm_T680: | 237 | case Model_Palm_T680: |
233 | case Model_Palm_T700W: | 238 | case Model_Palm_T700W: |
234 | case Model_Palm_T700P: | 239 | case Model_Palm_T700P: |
235 | case Model_Palm_T750: | 240 | case Model_Palm_T750: |
236 | case Model_Palm_T755P: | 241 | case Model_Palm_T755P: |
237 | m_backlightdev = "/sys/class/backlight/corgi-bl/"; | 242 | m_backlightdev = "/sys/class/backlight/corgi-bl/"; |
238 | break; | 243 | break; |
239 | 244 | ||
240 | default: | 245 | default: |
241 | m_backlightdev = ""; | 246 | m_backlightdev = ""; |
242 | } | 247 | } |
243 | 248 | ||
244 | } | 249 | } |
245 | 250 | ||
246 | 251 | ||
247 | void Palm::initButtons() | 252 | void Palm::initButtons() |
248 | { | 253 | { |
249 | 254 | ||
250 | if ( d->m_buttons ) | 255 | if ( d->m_buttons ) |
251 | return ; | 256 | return ; |
252 | 257 | ||
253 | if ( isQWS( ) ) { | 258 | if ( isQWS( ) ) { |
254 | addPreHandler(this); | 259 | addPreHandler(this); |
255 | } | 260 | } |
256 | 261 | ||
257 | d->m_buttons = new QValueList <ODeviceButton>; | 262 | d->m_buttons = new QValueList <ODeviceButton>; |
258 | 263 | ||
259 | for ( uint i = 0; i < ( sizeof( palm_buttons ) / sizeof( palm_button ) ); i++ ) | 264 | for ( uint i = 0; i < ( sizeof( palm_buttons ) / sizeof( palm_button ) ); i++ ) |
260 | { | 265 | { |
261 | palm_button *ib = palm_buttons + i; | 266 | palm_button *ib = palm_buttons + i; |
262 | ODeviceButton b; | 267 | ODeviceButton b; |
263 | 268 | ||
264 | if (( ib->model & d->m_model ) == d->m_model ) { | 269 | if (( ib->model & d->m_model ) == d->m_model ) { |
265 | b. setKeycode ( ib->code ); | 270 | b. setKeycode ( ib->code ); |
266 | b. setUserText ( QObject::tr ( "Button", ib->utext )); | 271 | b. setUserText ( QObject::tr ( "Button", ib->utext )); |
267 | b. setPixmap ( OResource::loadPixmap ( ib->pix )); | 272 | b. setPixmap ( OResource::loadPixmap ( ib->pix )); |
268 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib->fpressedservice ), ib->fpressedaction )); | 273 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib->fpressedservice ), ib->fpressedaction )); |
269 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib->fheldservice ), ib->fheldaction )); | 274 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib->fheldservice ), ib->fheldaction )); |
270 | 275 | ||
271 | d->m_buttons->append ( b ); | 276 | d->m_buttons->append ( b ); |
272 | } | 277 | } |
273 | } | 278 | } |
274 | reloadButtonMapping(); | 279 | reloadButtonMapping(); |
275 | } | 280 | } |
276 | 281 | ||
277 | 282 | ||
278 | bool Palm::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) | 283 | bool Palm::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) |
279 | { | 284 | { |
280 | int newkeycode = keycode; | 285 | int newkeycode = keycode; |
281 | 286 | ||
282 | if (qt_screen->transformOrientation() != Rot0){ | 287 | if (qt_screen->transformOrientation() != Rot0){ |
283 | 288 | ||
284 | switch ( keycode ) { | 289 | switch ( keycode ) { |
285 | case Key_Left : | 290 | case Key_Left : |
286 | case Key_Right: | 291 | case Key_Right: |
287 | case Key_Up : | 292 | case Key_Up : |
288 | case Key_Down : | 293 | case Key_Down : |
289 | newkeycode = Key_Left + ( keycode - Key_Left + (int) qt_screen->transformOrientation() ) % 4; | 294 | newkeycode = Key_Left + ( keycode - Key_Left + 4 ) % 4; |
290 | default: | 295 | default: |
291 | break; | 296 | break; |
292 | } | 297 | } |
293 | 298 | ||
294 | if (newkeycode!=keycode) { | 299 | if (newkeycode!=keycode) { |
295 | if ( newkeycode != Key_unknown ) { | 300 | if ( newkeycode != Key_unknown ) { |
296 | QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat ); | 301 | QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat ); |
297 | } | 302 | } |
298 | return true; | 303 | return true; |
299 | } | 304 | } |
300 | 305 | ||
301 | } | 306 | } |
302 | 307 | ||
303 | return false; | 308 | return false; |
304 | } | 309 | } |
305 | 310 | ||
306 | 311 | ||
307 | bool Palm::suspend() | 312 | bool Palm::suspend() |
308 | { | 313 | { |
309 | // some Palms do not implement their own power management at the moment. | 314 | // some Palms do not implement their own power management at the moment. |
310 | 315 | ||
311 | bool res = false; | 316 | bool res = false; |
312 | 317 | ||
313 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend | 318 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend |
314 | return false; | 319 | return false; |
315 | 320 | ||
316 | switch ( d->m_model ) { | 321 | switch ( d->m_model ) { |
317 | case Model_Palm_TT: | 322 | case Model_Palm_TT: |
318 | case Model_Palm_TT2: | 323 | case Model_Palm_TT2: |
319 | case Model_Palm_TT3: | 324 | case Model_Palm_TT3: |
320 | case Model_Palm_TT5: | 325 | case Model_Palm_TT5: |
321 | case Model_Palm_TE: | 326 | case Model_Palm_TE: |
322 | case Model_Palm_TE2: | 327 | case Model_Palm_TE2: |
323 | case Model_Palm_TC: | 328 | case Model_Palm_TC: |
324 | case Model_Palm_LD: | 329 | case Model_Palm_LD: |
325 | case Model_Palm_TX: | 330 | case Model_Palm_TX: |
326 | case Model_Palm_Z71: | 331 | case Model_Palm_Z71: |
327 | case Model_Palm_Z72: | 332 | case Model_Palm_Z72: |
328 | case Model_Palm_T600: | 333 | case Model_Palm_T600: |
329 | case Model_Palm_T650: | 334 | case Model_Palm_T650: |
330 | case Model_Palm_T680: | 335 | case Model_Palm_T680: |
331 | case Model_Palm_T700W: | 336 | case Model_Palm_T700W: |
332 | case Model_Palm_T700P: | 337 | case Model_Palm_T700P: |
333 | case Model_Palm_T750: | 338 | case Model_Palm_T750: |
334 | case Model_Palm_T755P: | 339 | case Model_Palm_T755P: |
335 | { | 340 | { |
336 | QCopChannel::send( "QPE/System", "aboutToSuspend()" ); | 341 | QCopChannel::send( "QPE/System", "aboutToSuspend()" ); |
337 | 342 | ||
338 | ::sync(); // flush fs caches | 343 | ::sync(); // flush fs caches |
339 | res = ( ::system ( "apm --suspend" ) == 0 ); | 344 | res = ( ::system ( "apm --suspend" ) == 0 ); |
340 | 345 | ||
341 | QCopChannel::send( "QPE/System", "returnFromSuspend()" ); | 346 | QCopChannel::send( "QPE/System", "returnFromSuspend()" ); |
342 | } | 347 | } |
343 | break; | 348 | break; |
344 | default: | 349 | default: |
345 | break; | 350 | break; |
346 | } | 351 | } |
347 | 352 | ||
348 | return res; | 353 | return res; |
349 | } | 354 | } |
350 | 355 | ||
351 | 356 | ||
352 | int Palm::displayBrightnessResolution() const | 357 | int Palm::displayBrightnessResolution() const |
353 | { | 358 | { |
354 | int res = 1; | 359 | int res = 1; |
355 | int fd = -1; | 360 | int fd = -1; |
356 | 361 | ||
357 | switch ( d->m_model ) | 362 | switch ( d->m_model ) |
358 | { | 363 | { |
359 | case Model_Palm_TT: | 364 | case Model_Palm_TT: |
360 | case Model_Palm_TT2: | 365 | case Model_Palm_TT2: |
361 | case Model_Palm_TT3: | 366 | case Model_Palm_TT3: |
362 | case Model_Palm_TT5: | 367 | case Model_Palm_TT5: |
363 | case Model_Palm_TE: | 368 | case Model_Palm_TE: |
364 | case Model_Palm_TE2: | 369 | case Model_Palm_TE2: |
365 | case Model_Palm_TC: | 370 | case Model_Palm_TC: |
366 | case Model_Palm_LD: | 371 | case Model_Palm_LD: |
367 | case Model_Palm_TX: | 372 | case Model_Palm_TX: |
368 | case Model_Palm_Z71: | 373 | case Model_Palm_Z71: |
369 | case Model_Palm_Z72: | 374 | case Model_Palm_Z72: |
370 | case Model_Palm_T600: | 375 | case Model_Palm_T600: |
371 | case Model_Palm_T650: | 376 | case Model_Palm_T650: |
372 | case Model_Palm_T680: | 377 | case Model_Palm_T680: |
373 | case Model_Palm_T700W: | 378 | case Model_Palm_T700W: |
374 | case Model_Palm_T700P: | 379 | case Model_Palm_T700P: |
375 | case Model_Palm_T750: | 380 | case Model_Palm_T750: |
376 | case Model_Palm_T755P: | 381 | case Model_Palm_T755P: |
377 | fd = ::open( m_backlightdev + "max_brightness", O_RDONLY|O_NONBLOCK ); | 382 | fd = ::open( m_backlightdev + "max_brightness", O_RDONLY|O_NONBLOCK ); |
378 | if ( fd != -1) | 383 | if ( fd != -1) |
379 | { | 384 | { |
380 | char buf[100]; | 385 | char buf[100]; |
381 | if ( ::read( fd, &buf[0], sizeof buf ) > 0 ) | 386 | if ( ::read( fd, &buf[0], sizeof buf ) > 0 ) |
382 | ::sscanf( &buf[0], "%d", &res ); | 387 | ::sscanf( &buf[0], "%d", &res ); |
383 | ::close( fd ); | 388 | ::close( fd ); |
384 | } | 389 | } |
385 | break; | 390 | break; |
386 | 391 | ||
387 | default: | 392 | default: |
388 | res = 1; | 393 | res = 1; |
389 | } | 394 | } |
390 | 395 | ||
391 | return res; | 396 | return res; |
392 | } | 397 | } |
393 | 398 | ||
394 | 399 | ||
395 | bool Palm::setDisplayBrightness( int bright ) | 400 | bool Palm::setDisplayBrightness( int bright ) |
396 | { | 401 | { |
397 | bool res = false; | 402 | bool res = false; |
398 | 403 | ||
399 | if ( bright > 255 ) bright = 255; | 404 | if ( bright > 255 ) bright = 255; |
400 | if ( bright < 0 ) bright = 0; | 405 | if ( bright < 0 ) bright = 0; |
401 | 406 | ||
402 | int numberOfSteps = displayBrightnessResolution(); | 407 | int numberOfSteps = displayBrightnessResolution(); |
403 | int val = ( bright == 1 ) ? 1 : ( bright * numberOfSteps ) / 255; | 408 | int val = ( bright == 1 ) ? 1 : ( bright * numberOfSteps ) / 255; |
404 | int fd = -1; | 409 | int fd = -1; |
405 | 410 | ||
406 | switch ( d->m_model ) | 411 | switch ( d->m_model ) |
407 | { | 412 | { |
408 | case Model_Palm_TT: | 413 | case Model_Palm_TT: |
409 | case Model_Palm_TT2: | 414 | case Model_Palm_TT2: |
410 | case Model_Palm_TT3: | 415 | case Model_Palm_TT3: |
411 | case Model_Palm_TT5: | 416 | case Model_Palm_TT5: |
412 | case Model_Palm_TE: | 417 | case Model_Palm_TE: |
413 | case Model_Palm_TE2: | 418 | case Model_Palm_TE2: |
414 | case Model_Palm_TC: | 419 | case Model_Palm_TC: |
415 | case Model_Palm_LD: | 420 | case Model_Palm_LD: |
416 | case Model_Palm_TX: | 421 | case Model_Palm_TX: |
417 | case Model_Palm_Z71: | 422 | case Model_Palm_Z71: |
418 | case Model_Palm_Z72: | 423 | case Model_Palm_Z72: |
419 | case Model_Palm_T600: | 424 | case Model_Palm_T600: |
420 | case Model_Palm_T650: | 425 | case Model_Palm_T650: |
421 | case Model_Palm_T680: | 426 | case Model_Palm_T680: |
422 | case Model_Palm_T700W: | 427 | case Model_Palm_T700W: |
423 | case Model_Palm_T700P: | 428 | case Model_Palm_T700P: |
424 | case Model_Palm_T750: | 429 | case Model_Palm_T750: |
425 | case Model_Palm_T755P: | 430 | case Model_Palm_T755P: |
426 | fd = ::open( m_backlightdev + "brightness", O_WRONLY|O_NONBLOCK ); | 431 | fd = ::open( m_backlightdev + "brightness", O_WRONLY|O_NONBLOCK ); |
427 | if ( fd != -1 ) | 432 | if ( fd != -1 ) |
428 | { | 433 | { |
429 | char buf[100]; | 434 | char buf[100]; |
430 | int len = ::snprintf( &buf[0], sizeof buf, "%d", val ); | 435 | int len = ::snprintf( &buf[0], sizeof buf, "%d", val ); |
431 | res = ( ::write( fd, &buf[0], len ) == 0 ); | 436 | res = ( ::write( fd, &buf[0], len ) == 0 ); |
432 | ::close( fd ); | 437 | ::close( fd ); |
433 | } | 438 | } |
434 | break; | 439 | break; |
435 | 440 | ||
436 | default: | 441 | default: |
437 | res = false; | 442 | res = false; |
438 | } | 443 | } |
439 | return res; | 444 | return res; |
440 | } | 445 | } |