-rw-r--r-- | libopie2/opiecore/device/odevice_ipaq.cpp | 77 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_mypal.cpp | 17 |
2 files changed, 43 insertions, 51 deletions
diff --git a/libopie2/opiecore/device/odevice_ipaq.cpp b/libopie2/opiecore/device/odevice_ipaq.cpp index 00939bf..16ecc27 100644 --- a/libopie2/opiecore/device/odevice_ipaq.cpp +++ b/libopie2/opiecore/device/odevice_ipaq.cpp | |||
@@ -39,166 +39,158 @@ | |||
39 | /* OPIE */ | 39 | /* OPIE */ |
40 | #include <qpe/config.h> | 40 | #include <qpe/config.h> |
41 | #include <qpe/sound.h> | 41 | #include <qpe/sound.h> |
42 | #include <qpe/qcopenvelope_qws.h> | 42 | #include <qpe/qcopenvelope_qws.h> |
43 | 43 | ||
44 | #include <opie2/okeyfilter.h> | 44 | #include <opie2/okeyfilter.h> |
45 | #include <opie2/oresource.h> | 45 | #include <opie2/oresource.h> |
46 | 46 | ||
47 | /* STD */ | 47 | /* STD */ |
48 | #include <fcntl.h> | 48 | #include <fcntl.h> |
49 | #include <math.h> | 49 | #include <math.h> |
50 | #include <stdlib.h> | 50 | #include <stdlib.h> |
51 | #include <signal.h> | 51 | #include <signal.h> |
52 | #include <sys/ioctl.h> | 52 | #include <sys/ioctl.h> |
53 | #include <sys/time.h> | 53 | #include <sys/time.h> |
54 | #include <unistd.h> | 54 | #include <unistd.h> |
55 | #ifndef QT_NO_SOUND | 55 | #ifndef QT_NO_SOUND |
56 | #include <linux/soundcard.h> | 56 | #include <linux/soundcard.h> |
57 | #endif | 57 | #endif |
58 | 58 | ||
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 | /* KERNEL */ | 63 | /* KERNEL */ |
64 | #define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) | 64 | #define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) |
65 | 65 | ||
66 | #define OD_IO(type,number) OD_IOC(0,type,number,0) | 66 | #define OD_IO(type,number) OD_IOC(0,type,number,0) |
67 | #define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size)) | 67 | #define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size)) |
68 | #define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size)) | 68 | #define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size)) |
69 | #define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size)) | 69 | #define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size)) |
70 | 70 | ||
71 | typedef struct { | 71 | typedef struct { |
72 | unsigned char OffOnBlink; /* 0=off 1=on 2=Blink */ | 72 | unsigned char OffOnBlink; /* 0=off 1=on 2=Blink */ |
73 | unsigned char TotalTime; /* Units of 5 seconds */ | 73 | unsigned char TotalTime; /* Units of 5 seconds */ |
74 | unsigned char OnTime; /* units of 100m/s */ | 74 | unsigned char OnTime; /* units of 100m/s */ |
75 | unsigned char OffTime; /* units of 100m/s */ | 75 | unsigned char OffTime; /* units of 100m/s */ |
76 | } LED_IN; | 76 | } LED_IN; |
77 | 77 | ||
78 | typedef struct { | 78 | typedef struct { |
79 | unsigned char mode; | 79 | unsigned char mode; |
80 | unsigned char pwr; | 80 | unsigned char pwr; |
81 | unsigned char brightness; | 81 | unsigned char brightness; |
82 | } FLITE_IN; | 82 | } FLITE_IN; |
83 | 83 | ||
84 | #define LED_ON OD_IOW( 'f', 5, LED_IN ) | 84 | #define LED_ON OD_IOW( 'f', 5, LED_IN ) |
85 | #define FLITE_ON OD_IOW( 'f', 7, FLITE_IN ) | 85 | #define FLITE_ON OD_IOW( 'f', 7, FLITE_IN ) |
86 | 86 | ||
87 | #define Model_Keyboardless_2_6 (Model_iPAQ_H191x | Model_iPAQ_H22xx | Model_iPAQ_HX4700 | Model_iPAQ_H4xxx) | ||
88 | |||
87 | struct i_button ipaq_buttons [] = { | 89 | struct i_button ipaq_buttons [] = { |
88 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx | Model_iPAQ_H191x | Model_iPAQ_H22xx | Model_iPAQ_HX4700 | Model_iPAQ_H4xxx, | 90 | |
91 | // Common button map for all keyboardless devices with 2.6 kernel | ||
92 | { Model_Keyboardless_2_6, | ||
89 | Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), | 93 | Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), |
90 | "devicebuttons/ipaq_calendar", | 94 | "devicebuttons/ipaq_calendar", |
91 | "datebook", "nextView()", | 95 | "datebook", "nextView()", |
92 | "today", "raise()" }, | 96 | "today", "raise()" }, |
93 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx | Model_iPAQ_H191x | Model_iPAQ_H22xx | Model_iPAQ_HX4700 | Model_iPAQ_H4xxx, | 97 | { Model_Keyboardless_2_6, |
94 | Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), | 98 | Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), |
95 | "devicebuttons/ipaq_contact", | 99 | "devicebuttons/ipaq_contact", |
96 | "addressbook", "raise()", | 100 | "addressbook", "raise()", |
97 | "addressbook", "beamBusinessCard()" }, | 101 | "addressbook", "beamBusinessCard()" }, |
98 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx, | 102 | { Model_Keyboardless_2_6, |
99 | Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), | 103 | Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Mail Button"), |
100 | "devicebuttons/ipaq_menu", | ||
101 | "QPE/TaskBar", "toggleMenu()", | ||
102 | "QPE/TaskBar", "toggleStartMenu()" }, | ||
103 | { Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, | ||
104 | Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), | ||
105 | "devicebuttons/ipaq_mail", | 104 | "devicebuttons/ipaq_mail", |
106 | "opiemail", "raise()", | 105 | "opiemail", "raise()", |
107 | "opiemail", "newMail()" }, | 106 | "opiemail", "newMail()" }, |
108 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx | Model_iPAQ_H191x | Model_iPAQ_H4xxx, | 107 | { Model_Keyboardless_2_6, |
109 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), | 108 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), |
110 | "devicebuttons/ipaq_home", | 109 | "devicebuttons/ipaq_home", |
111 | "QPE/Launcher", "home()", | 110 | "QPE/Launcher", "home()", |
112 | "buttonsettings", "raise()" }, | 111 | "buttonsettings", "raise()" }, |
113 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, | 112 | { Model_Keyboardless_2_6, |
114 | Qt::Key_F24, QT_TRANSLATE_NOOP("Button", "Record Button"), | 113 | Qt::Key_F24, QT_TRANSLATE_NOOP("Button", "Record Button"), |
115 | "devicebuttons/ipaq_record", | 114 | "devicebuttons/ipaq_record", |
116 | "QPE/VMemo", "toggleRecord()", | 115 | "QPE/VMemo", "toggleRecord()", |
117 | "sound", "raise()" }, | 116 | "sound", "raise()" }, |
118 | 117 | ||
119 | { Model_iPAQ_H191x | Model_iPAQ_H4xxx, | 118 | // Devices with 2.4 kernel |
120 | Qt::Key_F8, QT_TRANSLATE_NOOP("Button", "Mail Button"), | 119 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, |
121 | "devicebuttons/ipaq_mail", | 120 | Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), |
122 | "opiemail", "raise()", | 121 | "devicebuttons/ipaq_calendar", |
123 | "opiemail", "newMail()" }, | 122 | "datebook", "nextView()", |
124 | { Model_iPAQ_H191x | Model_iPAQ_H4xxx, | 123 | "today", "raise()" }, |
125 | Qt::Key_F7, QT_TRANSLATE_NOOP("Button", "Record Button"), | 124 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, |
126 | "devicebuttons/ipaq_record", | 125 | Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), |
127 | "QPE/VMemo", "toggleRecord()", | 126 | "devicebuttons/ipaq_contact", |
128 | "sound", "raise()" }, | 127 | "addressbook", "raise()", |
129 | 128 | "addressbook", "beamBusinessCard()" }, | |
130 | //h2200 has different button mapping | 129 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx, |
131 | { Model_iPAQ_H22xx, | 130 | Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), |
132 | Qt::Key_NumLock, QT_TRANSLATE_NOOP("Button", "Mail Button"), | ||
133 | "devicebuttons/ipaq_mail", | ||
134 | "opiemail", "raise()", | ||
135 | "opiemail", "newMail()" }, | ||
136 | { Model_iPAQ_H22xx, | ||
137 | Qt::Key_ScrollLock, QT_TRANSLATE_NOOP("Button", "Menu Button"), | ||
138 | "devicebuttons/ipaq_menu", | 131 | "devicebuttons/ipaq_menu", |
139 | "QPE/TaskBar", "toggleMenu()", | 132 | "QPE/TaskBar", "toggleMenu()", |
140 | "QPE/TaskBar", "toggleStartMenu()" }, | 133 | "QPE/TaskBar", "toggleStartMenu()" }, |
141 | // and hx4700 has different button mapping still | 134 | { Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, |
142 | { Model_iPAQ_HX4700, | 135 | Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), |
143 | Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Mail Button"), | ||
144 | "devicebuttons/ipaq_mail", | 136 | "devicebuttons/ipaq_mail", |
145 | "opiemail", "raise()", | 137 | "opiemail", "raise()", |
146 | "opiemail", "newMail()" }, | 138 | "opiemail", "newMail()" }, |
147 | { Model_iPAQ_HX4700, | 139 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, |
148 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Record Button"), | 140 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), |
149 | "devicebuttons/ipaq_record", | ||
150 | "QPE/VMemo", "toggleRecord()", | ||
151 | "sound", "raise()" }, | ||
152 | { Model_iPAQ_HX4700, | ||
153 | Qt::Key_Home, QT_TRANSLATE_NOOP("Button", "Home Button"), | ||
154 | "devicebuttons/ipaq_home", | 141 | "devicebuttons/ipaq_home", |
155 | "QPE/Launcher", "home()", | 142 | "QPE/Launcher", "home()", |
156 | "buttonsettings", "raise()" }, | 143 | "buttonsettings", "raise()" }, |
144 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, | ||
145 | Qt::Key_F24, QT_TRANSLATE_NOOP("Button", "Record Button"), | ||
146 | "devicebuttons/ipaq_record", | ||
147 | "QPE/VMemo", "toggleRecord()", | ||
148 | "sound", "raise()" }, | ||
157 | 149 | ||
158 | }; | 150 | }; |
159 | 151 | ||
160 | void iPAQ::init(const QString& model) | 152 | void iPAQ::init(const QString& model) |
161 | { | 153 | { |
162 | d->m_vendorstr = "HP"; | 154 | d->m_vendorstr = "HP"; |
163 | d->m_vendor = Vendor_HP; | 155 | d->m_vendor = Vendor_HP; |
164 | 156 | ||
165 | d->m_modelstr = model.mid(model.findRev('H')); | 157 | d->m_modelstr = model.mid(model.findRev('H')); |
166 | 158 | ||
167 | if ( d->m_modelstr == "H3100" ) | 159 | if ( d->m_modelstr == "H3100" ) |
168 | d->m_model = Model_iPAQ_H31xx; | 160 | d->m_model = Model_iPAQ_H31xx; |
169 | else if ( d->m_modelstr == "H3600" ) | 161 | else if ( d->m_modelstr == "H3600" ) |
170 | d->m_model = Model_iPAQ_H36xx; | 162 | d->m_model = Model_iPAQ_H36xx; |
171 | else if ( d->m_modelstr == "H3700" ) | 163 | else if ( d->m_modelstr == "H3700" ) |
172 | d->m_model = Model_iPAQ_H37xx; | 164 | d->m_model = Model_iPAQ_H37xx; |
173 | else if ( d->m_modelstr == "H3800" ) | 165 | else if ( d->m_modelstr == "H3800" ) |
174 | d->m_model = Model_iPAQ_H38xx; | 166 | d->m_model = Model_iPAQ_H38xx; |
175 | else if ( d->m_modelstr == "H3900" ) | 167 | else if ( d->m_modelstr == "H3900" ) |
176 | d->m_model = Model_iPAQ_H39xx; | 168 | d->m_model = Model_iPAQ_H39xx; |
177 | else if ( d->m_modelstr == "H5400" ) | 169 | else if ( d->m_modelstr == "H5400" ) |
178 | d->m_model = Model_iPAQ_H5xxx; | 170 | d->m_model = Model_iPAQ_H5xxx; |
179 | else if ( d->m_modelstr == "H2200" ) | 171 | else if ( d->m_modelstr == "H2200" ) |
180 | d->m_model = Model_iPAQ_H22xx; | 172 | d->m_model = Model_iPAQ_H22xx; |
181 | else if ( d->m_modelstr == "H1910" ) | 173 | else if ( d->m_modelstr == "H1910" ) |
182 | d->m_model = Model_iPAQ_H191x; | 174 | d->m_model = Model_iPAQ_H191x; |
183 | else if ( d->m_modelstr == "H1940" ) | 175 | else if ( d->m_modelstr == "H1940" ) |
184 | d->m_model = Model_iPAQ_H1940; | 176 | d->m_model = Model_iPAQ_H1940; |
185 | else if ( d->m_modelstr == "HX4700" ) | 177 | else if ( d->m_modelstr == "HX4700" ) |
186 | d->m_model = Model_iPAQ_HX4700; | 178 | d->m_model = Model_iPAQ_HX4700; |
187 | else if ( d->m_modelstr == "H4000" ) | 179 | else if ( d->m_modelstr == "H4000" ) |
188 | d->m_model = Model_iPAQ_H4xxx; | 180 | d->m_model = Model_iPAQ_H4xxx; |
189 | 181 | ||
190 | else | 182 | else |
191 | d->m_model = Model_Unknown; | 183 | d->m_model = Model_Unknown; |
192 | 184 | ||
193 | switch ( d->m_model ) { | 185 | switch ( d->m_model ) { |
194 | case Model_iPAQ_H31xx: | 186 | case Model_iPAQ_H31xx: |
195 | case Model_iPAQ_H38xx: | 187 | case Model_iPAQ_H38xx: |
196 | d->m_rotation = Rot90; | 188 | d->m_rotation = Rot90; |
197 | break; | 189 | break; |
198 | case Model_iPAQ_H5xxx: | 190 | case Model_iPAQ_H5xxx: |
199 | case Model_iPAQ_H22xx: | 191 | case Model_iPAQ_H22xx: |
200 | case Model_iPAQ_H191x: | 192 | case Model_iPAQ_H191x: |
201 | case Model_iPAQ_H1940: | 193 | case Model_iPAQ_H1940: |
202 | case Model_iPAQ_HX4700: | 194 | case Model_iPAQ_HX4700: |
203 | case Model_iPAQ_H4xxx: | 195 | case Model_iPAQ_H4xxx: |
204 | d->m_rotation = Rot0; | 196 | d->m_rotation = Rot0; |
@@ -301,101 +293,98 @@ bool iPAQ::setLedState ( OLed l, OLedState st ) | |||
301 | } | 293 | } |
302 | 294 | ||
303 | if ( ::ioctl ( fd, LED_ON, &leds ) >= 0 ) { | 295 | if ( ::ioctl ( fd, LED_ON, &leds ) >= 0 ) { |
304 | m_leds [0] = st; | 296 | m_leds [0] = st; |
305 | return true; | 297 | return true; |
306 | } | 298 | } |
307 | } | 299 | } |
308 | } | 300 | } |
309 | return false; | 301 | return false; |
310 | } | 302 | } |
311 | 303 | ||
312 | 304 | ||
313 | bool iPAQ::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) | 305 | bool iPAQ::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) |
314 | { | 306 | { |
315 | int newkeycode = keycode; | 307 | int newkeycode = keycode; |
316 | 308 | ||
317 | switch ( keycode ) { | 309 | switch ( keycode ) { |
318 | // H38xx/H39xx have no "Q" key anymore - this is now the Mail key | 310 | // H38xx/H39xx have no "Q" key anymore - this is now the Mail key |
319 | case HardKey_Menu: { | 311 | case HardKey_Menu: { |
320 | if (( d->m_model == Model_iPAQ_H38xx ) || | 312 | if (( d->m_model == Model_iPAQ_H38xx ) || |
321 | ( d->m_model == Model_iPAQ_H39xx ) || | 313 | ( d->m_model == Model_iPAQ_H39xx ) || |
322 | ( d->m_model == Model_iPAQ_H5xxx)) { | 314 | ( d->m_model == Model_iPAQ_H5xxx)) { |
323 | newkeycode = HardKey_Mail; | 315 | newkeycode = HardKey_Mail; |
324 | } | 316 | } |
325 | break; | 317 | break; |
326 | } | 318 | } |
327 | 319 | ||
328 | // Rotate cursor keys 180 or 270 | 320 | // Rotate cursor keys 180 or 270 |
329 | case Key_Left : | 321 | case Key_Left : |
330 | case Key_Right: | 322 | case Key_Right: |
331 | case Key_Up : | 323 | case Key_Up : |
332 | case Key_Down : { | 324 | case Key_Down : { |
333 | if (( d->m_model == Model_iPAQ_H31xx ) || | 325 | if (( d->m_model == Model_iPAQ_H31xx ) || |
334 | ( d->m_model == Model_iPAQ_H38xx )) { | 326 | ( d->m_model == Model_iPAQ_H38xx )) { |
335 | newkeycode = Key_Left + ( keycode - Key_Left + 2 ) % 4; | 327 | newkeycode = Key_Left + ( keycode - Key_Left + 2 ) % 4; |
336 | } | 328 | } |
337 | // Rotate the cursor keys by 270 | 329 | // Rotate the cursor keys by 270 |
338 | // keycode - Key_Left = position of the button starting from left clockwise | 330 | // keycode - Key_Left = position of the button starting from left clockwise |
339 | // add the rotation to it and modolo. No we've the original offset | 331 | // add the rotation to it and modolo. No we've the original offset |
340 | // add the offset to the Key_Left key | 332 | // add the offset to the Key_Left key |
341 | if (( d->m_model == Model_iPAQ_H5xxx ) || | 333 | if (( d->m_model == Model_iPAQ_H5xxx ) || |
342 | ( d->m_model == Model_iPAQ_H191x ) || | 334 | ( d->m_model == Model_iPAQ_H191x ) || |
343 | ( d->m_model == Model_iPAQ_H4xxx ) || | 335 | ( d->m_model == Model_iPAQ_H4xxx ) || |
344 | ( d->m_model == Model_iPAQ_H1940 )) | 336 | ( d->m_model == Model_iPAQ_H1940 )) |
345 | newkeycode = Key_Left + ( keycode - Key_Left + 3 ) % 4; | 337 | newkeycode = Key_Left + ( keycode - Key_Left + 3 ) % 4; |
346 | break; | 338 | break; |
347 | } | 339 | } |
348 | 340 | ||
349 | // map Power Button short/long press to F6 for h191x | ||
350 | case Key_F6: | ||
351 | if ( d->m_model != Model_iPAQ_H191x && d->m_model != Model_iPAQ_H4xxx ) | ||
352 | break; | ||
353 | // map Power Button short/long press to F34/F35 | 341 | // map Power Button short/long press to F34/F35 |
342 | case HardKey_Suspend: // Hope we don't have infinite recursion here | ||
354 | case Key_SysReq: { | 343 | case Key_SysReq: { |
355 | if ( isPress ) { | 344 | if ( isPress ) { |
356 | if ( m_power_timer ) | 345 | if ( m_power_timer ) |
357 | killTimer ( m_power_timer ); | 346 | killTimer ( m_power_timer ); |
358 | m_power_timer = startTimer ( 500 ); | 347 | m_power_timer = startTimer ( 500 ); |
359 | } | 348 | } |
360 | else if ( m_power_timer ) { | 349 | else if ( m_power_timer ) { |
361 | killTimer ( m_power_timer ); | 350 | killTimer ( m_power_timer ); |
362 | m_power_timer = 0; | 351 | m_power_timer = 0; |
363 | QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, true, false ); | 352 | QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, true, false ); |
364 | QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, false, false ); | 353 | QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, false, false ); |
365 | } | 354 | } |
366 | newkeycode = Key_unknown; | 355 | newkeycode = Key_unknown; |
367 | break; | 356 | break; |
368 | } | 357 | } |
369 | } | 358 | } |
370 | 359 | ||
371 | if ( newkeycode != keycode ) { | 360 | if ( newkeycode != keycode ) { |
372 | if ( newkeycode != Key_unknown ) | 361 | if ( newkeycode != Key_unknown ) |
373 | QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat ); | 362 | QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat ); |
374 | return true; | 363 | return true; |
375 | } | 364 | } |
376 | else | 365 | else |
377 | return false; | 366 | return false; |
378 | } | 367 | } |
379 | 368 | ||
380 | void iPAQ::timerEvent ( QTimerEvent * ) | 369 | void iPAQ::timerEvent ( QTimerEvent * ) |
381 | { | 370 | { |
382 | killTimer ( m_power_timer ); | 371 | killTimer ( m_power_timer ); |
383 | m_power_timer = 0; | 372 | m_power_timer = 0; |
384 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false ); | 373 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false ); |
385 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false ); | 374 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false ); |
386 | } | 375 | } |
387 | 376 | ||
388 | 377 | ||
389 | void iPAQ::playAlarmSound() | 378 | void iPAQ::playAlarmSound() |
390 | { | 379 | { |
391 | #ifndef QT_NO_SOUND | 380 | #ifndef QT_NO_SOUND |
392 | static Sound snd ( "alarm" ); | 381 | static Sound snd ( "alarm" ); |
393 | if(!snd.isFinished()) | 382 | if(!snd.isFinished()) |
394 | return; | 383 | return; |
395 | 384 | ||
396 | changeMixerForAlarm(0, "/dev/sound/mixer", &snd ); | 385 | changeMixerForAlarm(0, "/dev/sound/mixer", &snd ); |
397 | snd. play(); | 386 | snd. play(); |
398 | #endif | 387 | #endif |
399 | } | 388 | } |
400 | 389 | ||
401 | bool iPAQ::setDisplayBrightness ( int bright ) | 390 | bool iPAQ::setDisplayBrightness ( int bright ) |
diff --git a/libopie2/opiecore/device/odevice_mypal.cpp b/libopie2/opiecore/device/odevice_mypal.cpp index 7eb8d1d..208be46 100644 --- a/libopie2/opiecore/device/odevice_mypal.cpp +++ b/libopie2/opiecore/device/odevice_mypal.cpp | |||
@@ -15,119 +15,122 @@ | |||
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 "odevice_mypal.h" | 30 | #include "odevice_mypal.h" |
31 | 31 | ||
32 | /* QT */ | 32 | /* QT */ |
33 | #include <qapplication.h> | 33 | #include <qapplication.h> |
34 | #include <qdir.h> | 34 | #include <qdir.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 | 38 | ||
39 | /* OPIE */ | 39 | /* OPIE */ |
40 | #include <qpe/config.h> | 40 | #include <qpe/config.h> |
41 | #include <qpe/sound.h> | 41 | #include <qpe/sound.h> |
42 | #include <qpe/qcopenvelope_qws.h> | 42 | #include <qpe/qcopenvelope_qws.h> |
43 | 43 | ||
44 | #include <opie2/okeyfilter.h> | 44 | #include <opie2/okeyfilter.h> |
45 | #include <opie2/oresource.h> | 45 | #include <opie2/oresource.h> |
46 | 46 | ||
47 | /* STD */ | 47 | /* STD */ |
48 | #include <fcntl.h> | 48 | #include <fcntl.h> |
49 | #include <math.h> | 49 | #include <math.h> |
50 | #include <stdlib.h> | 50 | #include <stdlib.h> |
51 | #include <signal.h> | 51 | #include <signal.h> |
52 | #include <sys/ioctl.h> | 52 | #include <sys/ioctl.h> |
53 | #include <sys/time.h> | 53 | #include <sys/time.h> |
54 | #include <unistd.h> | 54 | #include <unistd.h> |
55 | #ifndef QT_NO_SOUND | 55 | #ifndef QT_NO_SOUND |
56 | #include <linux/soundcard.h> | 56 | #include <linux/soundcard.h> |
57 | #endif | 57 | #endif |
58 | 58 | ||
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 | #define Model_Keyboardless_2_6 (Model_MyPal_716) | ||
64 | |||
63 | struct m_button mypal_buttons [] = { | 65 | struct m_button mypal_buttons [] = { |
64 | { Model_MyPal_716, | 66 | // Common button map for all keyboardless devices with 2.6 kernel |
67 | { Model_Keyboardless_2_6, | ||
65 | Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), | 68 | Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), |
66 | "devicebuttons/ipaq_calendar", | 69 | "devicebuttons/ipaq_calendar", |
67 | "datebook", "nextView()", | 70 | "datebook", "nextView()", |
68 | "today", "raise()" }, | 71 | "today", "raise()" }, |
69 | { Model_MyPal_716, | 72 | { Model_Keyboardless_2_6, |
70 | Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), | 73 | Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), |
71 | "devicebuttons/ipaq_contact", | 74 | "devicebuttons/ipaq_contact", |
72 | "addressbook", "raise()", | 75 | "addressbook", "raise()", |
73 | "addressbook", "beamBusinessCard()" }, | 76 | "addressbook", "beamBusinessCard()" }, |
74 | { Model_MyPal_716, | 77 | { Model_Keyboardless_2_6, |
75 | Qt::Key_F8, QT_TRANSLATE_NOOP("Button", "Mail Button"), | 78 | Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Mail Button"), |
76 | "devicebuttons/ipaq_mail", | 79 | "devicebuttons/ipaq_mail", |
77 | "opiemail", "raise()", | 80 | "opiemail", "raise()", |
78 | "opiemail", "newMail()" }, | 81 | "opiemail", "newMail()" }, |
79 | { Model_MyPal_716, | 82 | { Model_Keyboardless_2_6, |
80 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), | 83 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), |
81 | "devicebuttons/ipaq_home", | 84 | "devicebuttons/ipaq_home", |
82 | "QPE/Launcher", "home()", | 85 | "QPE/Launcher", "home()", |
83 | "buttonsettings", "raise()" }, | 86 | "buttonsettings", "raise()" }, |
84 | { Model_MyPal_716, | 87 | { Model_Keyboardless_2_6, |
85 | Qt::Key_F7, QT_TRANSLATE_NOOP("Button", "Record Button"), | 88 | Qt::Key_F24, QT_TRANSLATE_NOOP("Button", "Record Button"), |
86 | "devicebuttons/ipaq_record", | 89 | "devicebuttons/ipaq_record", |
87 | "QPE/VMemo", "toggleRecord()", | 90 | "QPE/VMemo", "toggleRecord()", |
88 | "sound", "raise()" }, | 91 | "sound", "raise()" }, |
89 | }; | 92 | }; |
90 | 93 | ||
91 | void MyPal::init(const QString& model) | 94 | void MyPal::init(const QString& model) |
92 | { | 95 | { |
93 | d->m_vendorstr = "Asus"; | 96 | d->m_vendorstr = "Asus"; |
94 | d->m_vendor = Vendor_Asus; | 97 | d->m_vendor = Vendor_Asus; |
95 | 98 | ||
96 | d->m_modelstr = model.mid(model.findRev('A')); | 99 | d->m_modelstr = model.mid(model.findRev('A')); |
97 | if ( d->m_modelstr == "A716" ) | 100 | if ( d->m_modelstr == "A716" ) |
98 | d->m_model = Model_MyPal_716; | 101 | d->m_model = Model_MyPal_716; |
99 | else | 102 | else |
100 | d->m_model = Model_Unknown; | 103 | d->m_model = Model_Unknown; |
101 | 104 | ||
102 | d->m_rotation = Rot0; | 105 | d->m_rotation = Rot0; |
103 | 106 | ||
104 | m_power_timer = 0; | 107 | m_power_timer = 0; |
105 | } | 108 | } |
106 | 109 | ||
107 | void MyPal::initButtons() | 110 | void MyPal::initButtons() |
108 | { | 111 | { |
109 | if ( d->m_buttons ) | 112 | if ( d->m_buttons ) |
110 | return; | 113 | return; |
111 | 114 | ||
112 | if ( isQWS( ) ) { | 115 | if ( isQWS( ) ) { |
113 | addPreHandler(this); | 116 | addPreHandler(this); |
114 | } | 117 | } |
115 | 118 | ||
116 | d->m_buttons = new QValueList <ODeviceButton>; | 119 | d->m_buttons = new QValueList <ODeviceButton>; |
117 | 120 | ||
118 | for ( uint i = 0; i < ( sizeof( mypal_buttons ) / sizeof( m_button )); i++ ) { | 121 | for ( uint i = 0; i < ( sizeof( mypal_buttons ) / sizeof( m_button )); i++ ) { |
119 | m_button *mb = mypal_buttons + i; | 122 | m_button *mb = mypal_buttons + i; |
120 | ODeviceButton b; | 123 | ODeviceButton b; |
121 | 124 | ||
122 | if (( mb->model & d->m_model ) == d->m_model ) { | 125 | if (( mb->model & d->m_model ) == d->m_model ) { |
123 | b. setKeycode ( mb->code ); | 126 | b. setKeycode ( mb->code ); |
124 | b. setUserText ( QObject::tr ( "Button", mb->utext )); | 127 | b. setUserText ( QObject::tr ( "Button", mb->utext )); |
125 | b. setPixmap ( OResource::loadPixmap ( mb->pix )); | 128 | b. setPixmap ( OResource::loadPixmap ( mb->pix )); |
126 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( mb->fpressedservice ), mb->fpressedaction )); | 129 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( mb->fpressedservice ), mb->fpressedaction )); |
127 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( mb->fheldservice ), mb->fheldaction )); | 130 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( mb->fheldservice ), mb->fheldaction )); |
128 | 131 | ||
129 | d->m_buttons->append ( b ); | 132 | d->m_buttons->append ( b ); |
130 | } | 133 | } |
131 | } | 134 | } |
132 | reloadButtonMapping(); | 135 | reloadButtonMapping(); |
133 | } | 136 | } |