-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 | |||
@@ -48,32 +48,53 @@ | |||
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", |
@@ -84,48 +105,32 @@ struct palm_button palm_buttons [] = { | |||
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" ) { |
@@ -203,45 +208,45 @@ void Palm::init(const QString& cpu_info) | |||
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() |
@@ -273,33 +278,33 @@ void Palm::initButtons() | |||
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 | ||