-rw-r--r-- | libopie2/opiecore/device/odevice.h | 1 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_ipaq.cpp | 8 |
2 files changed, 8 insertions, 1 deletions
diff --git a/libopie2/opiecore/device/odevice.h b/libopie2/opiecore/device/odevice.h index 492c97b..c70d2af 100644 --- a/libopie2/opiecore/device/odevice.h +++ b/libopie2/opiecore/device/odevice.h | |||
@@ -24,96 +24,97 @@ | |||
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #ifndef ODEVICE_H_ | 30 | #ifndef ODEVICE_H_ |
31 | #define ODEVICE_H_ | 31 | #define ODEVICE_H_ |
32 | 32 | ||
33 | /* OPIE */ | 33 | /* OPIE */ |
34 | #include <opie2/odevicebutton.h> | 34 | #include <opie2/odevicebutton.h> |
35 | #include <qpe/qpeapplication.h> /* for Transformation enum.. */ | 35 | #include <qpe/qpeapplication.h> /* for Transformation enum.. */ |
36 | 36 | ||
37 | /* QT */ | 37 | /* QT */ |
38 | #include <qnamespace.h> | 38 | #include <qnamespace.h> |
39 | #include <qobject.h> | 39 | #include <qobject.h> |
40 | #include <qstring.h> | 40 | #include <qstring.h> |
41 | 41 | ||
42 | 42 | ||
43 | #include <qstrlist.h> | 43 | #include <qstrlist.h> |
44 | #include <qwindowsystem_qws.h> | 44 | #include <qwindowsystem_qws.h> |
45 | 45 | ||
46 | 46 | ||
47 | class Sound; | 47 | class Sound; |
48 | 48 | ||
49 | namespace Opie{ | 49 | namespace Opie{ |
50 | namespace Core{ | 50 | namespace Core{ |
51 | 51 | ||
52 | class ODeviceData; | 52 | class ODeviceData; |
53 | /** | 53 | /** |
54 | * The available devices | 54 | * The available devices |
55 | */ | 55 | */ |
56 | enum OModel { | 56 | enum OModel { |
57 | Model_Unknown, // = 0 | 57 | Model_Unknown, // = 0 |
58 | 58 | ||
59 | Model_Series_Mask = 0xffff0000, | 59 | Model_Series_Mask = 0xffff0000, |
60 | 60 | ||
61 | Model_iPAQ = ( 1 << 16 ), | 61 | Model_iPAQ = ( 1 << 16 ), |
62 | 62 | ||
63 | Model_iPAQ_All = ( Model_iPAQ | 0xffff ), | 63 | Model_iPAQ_All = ( Model_iPAQ | 0xffff ), |
64 | Model_iPAQ_H31xx = ( Model_iPAQ | 0x0001 ), | 64 | Model_iPAQ_H31xx = ( Model_iPAQ | 0x0001 ), |
65 | Model_iPAQ_H36xx = ( Model_iPAQ | 0x0002 ), | 65 | Model_iPAQ_H36xx = ( Model_iPAQ | 0x0002 ), |
66 | Model_iPAQ_H37xx = ( Model_iPAQ | 0x0003 ), | 66 | Model_iPAQ_H37xx = ( Model_iPAQ | 0x0003 ), |
67 | Model_iPAQ_H38xx = ( Model_iPAQ | 0x0004 ), | 67 | Model_iPAQ_H38xx = ( Model_iPAQ | 0x0004 ), |
68 | Model_iPAQ_H39xx = ( Model_iPAQ | 0x0005 ), | 68 | Model_iPAQ_H39xx = ( Model_iPAQ | 0x0005 ), |
69 | Model_iPAQ_H5xxx = ( Model_iPAQ | 0x0006 ), | 69 | Model_iPAQ_H5xxx = ( Model_iPAQ | 0x0006 ), |
70 | Model_iPAQ_H22xx = ( Model_iPAQ | 0x0007 ), | 70 | Model_iPAQ_H22xx = ( Model_iPAQ | 0x0007 ), |
71 | Model_iPAQ_H191x = ( Model_iPAQ | 0x0008 ), | 71 | Model_iPAQ_H191x = ( Model_iPAQ | 0x0008 ), |
72 | Model_iPAQ_H1940 = ( Model_iPAQ | 0x0009 ), | ||
72 | 73 | ||
73 | Model_Jornada = ( 6 << 16 ), | 74 | Model_Jornada = ( 6 << 16 ), |
74 | Model_Jornada_56x = ( Model_Jornada | 0x0001 ), | 75 | Model_Jornada_56x = ( Model_Jornada | 0x0001 ), |
75 | Model_Jornada_720 = ( Model_Jornada | 0x0002 ), | 76 | Model_Jornada_720 = ( Model_Jornada | 0x0002 ), |
76 | 77 | ||
77 | Model_Zaurus = ( 2 << 16 ), | 78 | Model_Zaurus = ( 2 << 16 ), |
78 | 79 | ||
79 | Model_Zaurus_SL5000 = ( Model_Zaurus | 0x0001 ), | 80 | Model_Zaurus_SL5000 = ( Model_Zaurus | 0x0001 ), |
80 | Model_Zaurus_SL5500 = ( Model_Zaurus | 0x0002 ), | 81 | Model_Zaurus_SL5500 = ( Model_Zaurus | 0x0002 ), |
81 | Model_Zaurus_SLA300 = ( Model_Zaurus | 0x0003 ), | 82 | Model_Zaurus_SLA300 = ( Model_Zaurus | 0x0003 ), |
82 | Model_Zaurus_SLB600 = ( Model_Zaurus | 0x0004 ), | 83 | Model_Zaurus_SLB600 = ( Model_Zaurus | 0x0004 ), |
83 | Model_Zaurus_SLC7x0 = ( Model_Zaurus | 0x0005 ), | 84 | Model_Zaurus_SLC7x0 = ( Model_Zaurus | 0x0005 ), |
84 | Model_Zaurus_SL6000 = ( Model_Zaurus | 0x0006 ), | 85 | Model_Zaurus_SL6000 = ( Model_Zaurus | 0x0006 ), |
85 | Model_Zaurus_SLC3000 = ( Model_Zaurus | 0x0007 ), | 86 | Model_Zaurus_SLC3000 = ( Model_Zaurus | 0x0007 ), |
86 | Model_Zaurus_SLC1000 = ( Model_Zaurus | 0x0008 ), | 87 | Model_Zaurus_SLC1000 = ( Model_Zaurus | 0x0008 ), |
87 | Model_Zaurus_SLC3100 = ( Model_Zaurus | 0x0009 ), | 88 | Model_Zaurus_SLC3100 = ( Model_Zaurus | 0x0009 ), |
88 | 89 | ||
89 | Model_SIMpad = ( 3 << 16 ), | 90 | Model_SIMpad = ( 3 << 16 ), |
90 | 91 | ||
91 | Model_SIMpad_All = ( Model_SIMpad | 0xffff ), | 92 | Model_SIMpad_All = ( Model_SIMpad | 0xffff ), |
92 | Model_SIMpad_CL4 = ( Model_SIMpad | 0x0001 ), | 93 | Model_SIMpad_CL4 = ( Model_SIMpad | 0x0001 ), |
93 | Model_SIMpad_SL4 = ( Model_SIMpad | 0x0002 ), | 94 | Model_SIMpad_SL4 = ( Model_SIMpad | 0x0002 ), |
94 | Model_SIMpad_SLC = ( Model_SIMpad | 0x0003 ), | 95 | Model_SIMpad_SLC = ( Model_SIMpad | 0x0003 ), |
95 | Model_SIMpad_TSinus = ( Model_SIMpad | 0x0004 ), | 96 | Model_SIMpad_TSinus = ( Model_SIMpad | 0x0004 ), |
96 | 97 | ||
97 | Model_Ramses = ( 4 << 16 ), | 98 | Model_Ramses = ( 4 << 16 ), |
98 | 99 | ||
99 | Model_Ramses_All = ( Model_Ramses | 0xffff ), | 100 | Model_Ramses_All = ( Model_Ramses | 0xffff ), |
100 | Model_Ramses_MNCI = ( Model_Ramses | 0x0001 ), | 101 | Model_Ramses_MNCI = ( Model_Ramses | 0x0001 ), |
101 | Model_Ramses_MNCIRX = ( Model_Ramses | 0x0002 ), | 102 | Model_Ramses_MNCIRX = ( Model_Ramses | 0x0002 ), |
102 | 103 | ||
103 | Model_Yopy = ( 5 << 16 ), | 104 | Model_Yopy = ( 5 << 16 ), |
104 | 105 | ||
105 | Model_Yopy_All = ( Model_Yopy | 0xffff ), | 106 | Model_Yopy_All = ( Model_Yopy | 0xffff ), |
106 | Model_Yopy_3000 = ( Model_Yopy | 0x0001 ), | 107 | Model_Yopy_3000 = ( Model_Yopy | 0x0001 ), |
107 | Model_Yopy_3500 = ( Model_Yopy | 0x0002 ), | 108 | Model_Yopy_3500 = ( Model_Yopy | 0x0002 ), |
108 | Model_Yopy_3700 = ( Model_Yopy | 0x0003 ), | 109 | Model_Yopy_3700 = ( Model_Yopy | 0x0003 ), |
109 | 110 | ||
110 | Model_Beagle = ( 6 << 16 ), | 111 | Model_Beagle = ( 6 << 16 ), |
111 | 112 | ||
112 | Model_Beagle_All = ( Model_Beagle | 0xffff ), | 113 | Model_Beagle_All = ( Model_Beagle | 0xffff ), |
113 | Model_Beagle_PA100 = ( Model_Beagle | 0x0001 ), | 114 | Model_Beagle_PA100 = ( Model_Beagle | 0x0001 ), |
114 | 115 | ||
115 | Model_GenuineIntel = ( 7 << 16 ), | 116 | Model_GenuineIntel = ( 7 << 16 ), |
116 | 117 | ||
117 | Model_MyPal = ( 8 << 16 ), | 118 | Model_MyPal = ( 8 << 16 ), |
118 | 119 | ||
119 | Model_MyPal_All = ( Model_MyPal | 0xffff ), | 120 | Model_MyPal_All = ( Model_MyPal | 0xffff ), |
diff --git a/libopie2/opiecore/device/odevice_ipaq.cpp b/libopie2/opiecore/device/odevice_ipaq.cpp index 3cc6cec..52da2d9 100644 --- a/libopie2/opiecore/device/odevice_ipaq.cpp +++ b/libopie2/opiecore/device/odevice_ipaq.cpp | |||
@@ -106,107 +106,110 @@ struct i_button ipaq_buttons [] = { | |||
106 | "opiemail", "newMail()" }, | 106 | "opiemail", "newMail()" }, |
107 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx | Model_iPAQ_H191x, | 107 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx | Model_iPAQ_H191x, |
108 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), | 108 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), |
109 | "devicebuttons/ipaq_home", | 109 | "devicebuttons/ipaq_home", |
110 | "QPE/Launcher", "home()", | 110 | "QPE/Launcher", "home()", |
111 | "buttonsettings", "raise()" }, | 111 | "buttonsettings", "raise()" }, |
112 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, | 112 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, |
113 | Qt::Key_F24, QT_TRANSLATE_NOOP("Button", "Record Button"), | 113 | Qt::Key_F24, QT_TRANSLATE_NOOP("Button", "Record Button"), |
114 | "devicebuttons/ipaq_record", | 114 | "devicebuttons/ipaq_record", |
115 | "QPE/VMemo", "toggleRecord()", | 115 | "QPE/VMemo", "toggleRecord()", |
116 | "sound", "raise()" }, | 116 | "sound", "raise()" }, |
117 | 117 | ||
118 | { Model_iPAQ_H191x, | 118 | { Model_iPAQ_H191x, |
119 | Qt::Key_F8, QT_TRANSLATE_NOOP("Button", "Mail Button"), | 119 | Qt::Key_F8, QT_TRANSLATE_NOOP("Button", "Mail Button"), |
120 | "devicebuttons/ipaq_mail", | 120 | "devicebuttons/ipaq_mail", |
121 | "opiemail", "raise()", | 121 | "opiemail", "raise()", |
122 | "opiemail", "newMail()" }, | 122 | "opiemail", "newMail()" }, |
123 | { Model_iPAQ_H191x, | 123 | { Model_iPAQ_H191x, |
124 | Qt::Key_F7, QT_TRANSLATE_NOOP("Button", "Record Button"), | 124 | Qt::Key_F7, QT_TRANSLATE_NOOP("Button", "Record Button"), |
125 | "devicebuttons/ipaq_record", | 125 | "devicebuttons/ipaq_record", |
126 | "QPE/VMemo", "toggleRecord()", | 126 | "QPE/VMemo", "toggleRecord()", |
127 | "sound", "raise()" }, | 127 | "sound", "raise()" }, |
128 | 128 | ||
129 | }; | 129 | }; |
130 | 130 | ||
131 | void iPAQ::init(const QString& model) | 131 | void iPAQ::init(const QString& model) |
132 | { | 132 | { |
133 | d->m_vendorstr = "HP"; | 133 | d->m_vendorstr = "HP"; |
134 | d->m_vendor = Vendor_HP; | 134 | d->m_vendor = Vendor_HP; |
135 | 135 | ||
136 | d->m_modelstr = model.mid(model.findRev('H')); | 136 | d->m_modelstr = model.mid(model.findRev('H')); |
137 | 137 | ||
138 | if ( d->m_modelstr == "H3100" ) | 138 | if ( d->m_modelstr == "H3100" ) |
139 | d->m_model = Model_iPAQ_H31xx; | 139 | d->m_model = Model_iPAQ_H31xx; |
140 | else if ( d->m_modelstr == "H3600" ) | 140 | else if ( d->m_modelstr == "H3600" ) |
141 | d->m_model = Model_iPAQ_H36xx; | 141 | d->m_model = Model_iPAQ_H36xx; |
142 | else if ( d->m_modelstr == "H3700" ) | 142 | else if ( d->m_modelstr == "H3700" ) |
143 | d->m_model = Model_iPAQ_H37xx; | 143 | d->m_model = Model_iPAQ_H37xx; |
144 | else if ( d->m_modelstr == "H3800" ) | 144 | else if ( d->m_modelstr == "H3800" ) |
145 | d->m_model = Model_iPAQ_H38xx; | 145 | d->m_model = Model_iPAQ_H38xx; |
146 | else if ( d->m_modelstr == "H3900" ) | 146 | else if ( d->m_modelstr == "H3900" ) |
147 | d->m_model = Model_iPAQ_H39xx; | 147 | d->m_model = Model_iPAQ_H39xx; |
148 | else if ( d->m_modelstr == "H5400" ) | 148 | else if ( d->m_modelstr == "H5400" ) |
149 | d->m_model = Model_iPAQ_H5xxx; | 149 | d->m_model = Model_iPAQ_H5xxx; |
150 | else if ( d->m_modelstr == "H2200" ) | 150 | else if ( d->m_modelstr == "H2200" ) |
151 | d->m_model = Model_iPAQ_H22xx; | 151 | d->m_model = Model_iPAQ_H22xx; |
152 | else if ( d->m_modelstr == "H1910" ) | 152 | else if ( d->m_modelstr == "H1910" ) |
153 | d->m_model = Model_iPAQ_H191x; | 153 | d->m_model = Model_iPAQ_H191x; |
154 | else if ( d->m_modelstr == "H1940" ) | ||
155 | d->m_model = Model_iPAQ_H1940; | ||
154 | else | 156 | else |
155 | d->m_model = Model_Unknown; | 157 | d->m_model = Model_Unknown; |
156 | 158 | ||
157 | switch ( d->m_model ) { | 159 | switch ( d->m_model ) { |
158 | case Model_iPAQ_H31xx: | 160 | case Model_iPAQ_H31xx: |
159 | case Model_iPAQ_H38xx: | 161 | case Model_iPAQ_H38xx: |
160 | d->m_rotation = Rot90; | 162 | d->m_rotation = Rot90; |
161 | break; | 163 | break; |
162 | case Model_iPAQ_H5xxx: | 164 | case Model_iPAQ_H5xxx: |
163 | case Model_iPAQ_H22xx: | 165 | case Model_iPAQ_H22xx: |
164 | case Model_iPAQ_H191x: | 166 | case Model_iPAQ_H191x: |
167 | case Model_iPAQ_H1940: | ||
165 | d->m_rotation = Rot0; | 168 | d->m_rotation = Rot0; |
166 | break; | 169 | break; |
167 | case Model_iPAQ_H36xx: | 170 | case Model_iPAQ_H36xx: |
168 | case Model_iPAQ_H37xx: | 171 | case Model_iPAQ_H37xx: |
169 | case Model_iPAQ_H39xx: | 172 | case Model_iPAQ_H39xx: |
170 | default: | 173 | default: |
171 | d->m_rotation = Rot270; | 174 | d->m_rotation = Rot270; |
172 | break; | 175 | break; |
173 | 176 | ||
174 | } | 177 | } |
175 | 178 | ||
176 | m_leds [0] = m_leds [1] = Led_Off; | 179 | m_leds [0] = m_leds [1] = Led_Off; |
177 | 180 | ||
178 | m_power_timer = 0; | 181 | m_power_timer = 0; |
179 | 182 | ||
180 | } | 183 | } |
181 | 184 | ||
182 | void iPAQ::initButtons() | 185 | void iPAQ::initButtons() |
183 | { | 186 | { |
184 | if ( d->m_buttons ) | 187 | if ( d->m_buttons ) |
185 | return; | 188 | return; |
186 | 189 | ||
187 | if ( isQWS( ) ) { | 190 | if ( isQWS( ) ) { |
188 | addPreHandler(this); | 191 | addPreHandler(this); |
189 | } | 192 | } |
190 | 193 | ||
191 | d->m_buttons = new QValueList <ODeviceButton>; | 194 | d->m_buttons = new QValueList <ODeviceButton>; |
192 | 195 | ||
193 | for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { | 196 | for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { |
194 | i_button *ib = ipaq_buttons + i; | 197 | i_button *ib = ipaq_buttons + i; |
195 | ODeviceButton b; | 198 | ODeviceButton b; |
196 | 199 | ||
197 | if (( ib->model & d->m_model ) == d->m_model ) { | 200 | if (( ib->model & d->m_model ) == d->m_model ) { |
198 | b. setKeycode ( ib->code ); | 201 | b. setKeycode ( ib->code ); |
199 | b. setUserText ( QObject::tr ( "Button", ib->utext )); | 202 | b. setUserText ( QObject::tr ( "Button", ib->utext )); |
200 | b. setPixmap ( OResource::loadPixmap ( ib->pix )); | 203 | b. setPixmap ( OResource::loadPixmap ( ib->pix )); |
201 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib->fpressedservice ), ib->fpressedaction )); | 204 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib->fpressedservice ), ib->fpressedaction )); |
202 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib->fheldservice ), ib->fheldaction )); | 205 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib->fheldservice ), ib->fheldaction )); |
203 | 206 | ||
204 | d->m_buttons->append ( b ); | 207 | d->m_buttons->append ( b ); |
205 | } | 208 | } |
206 | } | 209 | } |
207 | reloadButtonMapping(); | 210 | reloadButtonMapping(); |
208 | } | 211 | } |
209 | 212 | ||
210 | QValueList <OLed> iPAQ::ledList() const | 213 | QValueList <OLed> iPAQ::ledList() const |
211 | { | 214 | { |
212 | QValueList <OLed> vl; | 215 | QValueList <OLed> vl; |
@@ -255,97 +258,98 @@ bool iPAQ::setLedState ( OLed l, OLedState st ) | |||
255 | leds. OffOnBlink = 2; | 258 | leds. OffOnBlink = 2; |
256 | 259 | ||
257 | switch ( st ) { | 260 | switch ( st ) { |
258 | case Led_Off : leds. OffOnBlink = 0; break; | 261 | case Led_Off : leds. OffOnBlink = 0; break; |
259 | case Led_On : leds. OffOnBlink = 1; break; | 262 | case Led_On : leds. OffOnBlink = 1; break; |
260 | case Led_BlinkSlow: leds. OnTime = 10; leds. OffTime = 10; break; | 263 | case Led_BlinkSlow: leds. OnTime = 10; leds. OffTime = 10; break; |
261 | case Led_BlinkFast: leds. OnTime = 5; leds. OffTime = 5; break; | 264 | case Led_BlinkFast: leds. OnTime = 5; leds. OffTime = 5; break; |
262 | } | 265 | } |
263 | 266 | ||
264 | if ( ::ioctl ( fd, LED_ON, &leds ) >= 0 ) { | 267 | if ( ::ioctl ( fd, LED_ON, &leds ) >= 0 ) { |
265 | m_leds [0] = st; | 268 | m_leds [0] = st; |
266 | return true; | 269 | return true; |
267 | } | 270 | } |
268 | } | 271 | } |
269 | } | 272 | } |
270 | return false; | 273 | return false; |
271 | } | 274 | } |
272 | 275 | ||
273 | 276 | ||
274 | bool iPAQ::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) | 277 | bool iPAQ::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) |
275 | { | 278 | { |
276 | int newkeycode = keycode; | 279 | int newkeycode = keycode; |
277 | 280 | ||
278 | switch ( keycode ) { | 281 | switch ( keycode ) { |
279 | // H38xx/H39xx have no "Q" key anymore - this is now the Mail key | 282 | // H38xx/H39xx have no "Q" key anymore - this is now the Mail key |
280 | case HardKey_Menu: { | 283 | case HardKey_Menu: { |
281 | if (( d->m_model == Model_iPAQ_H38xx ) || | 284 | if (( d->m_model == Model_iPAQ_H38xx ) || |
282 | ( d->m_model == Model_iPAQ_H39xx ) || | 285 | ( d->m_model == Model_iPAQ_H39xx ) || |
283 | ( d->m_model == Model_iPAQ_H5xxx)) { | 286 | ( d->m_model == Model_iPAQ_H5xxx)) { |
284 | newkeycode = HardKey_Mail; | 287 | newkeycode = HardKey_Mail; |
285 | } | 288 | } |
286 | break; | 289 | break; |
287 | } | 290 | } |
288 | 291 | ||
289 | // Rotate cursor keys 180 or 270 | 292 | // Rotate cursor keys 180 or 270 |
290 | case Key_Left : | 293 | case Key_Left : |
291 | case Key_Right: | 294 | case Key_Right: |
292 | case Key_Up : | 295 | case Key_Up : |
293 | case Key_Down : { | 296 | case Key_Down : { |
294 | if (( d->m_model == Model_iPAQ_H31xx ) || | 297 | if (( d->m_model == Model_iPAQ_H31xx ) || |
295 | ( d->m_model == Model_iPAQ_H38xx )) { | 298 | ( d->m_model == Model_iPAQ_H38xx )) { |
296 | newkeycode = Key_Left + ( keycode - Key_Left + 2 ) % 4; | 299 | newkeycode = Key_Left + ( keycode - Key_Left + 2 ) % 4; |
297 | } | 300 | } |
298 | // Rotate the cursor keys by 270 | 301 | // Rotate the cursor keys by 270 |
299 | // keycode - Key_Left = position of the button starting from left clockwise | 302 | // keycode - Key_Left = position of the button starting from left clockwise |
300 | // add the rotation to it and modolo. No we've the original offset | 303 | // add the rotation to it and modolo. No we've the original offset |
301 | // add the offset to the Key_Left key | 304 | // add the offset to the Key_Left key |
302 | if (( d->m_model == Model_iPAQ_H5xxx ) || | 305 | if (( d->m_model == Model_iPAQ_H5xxx ) || |
303 | ( d->m_model == Model_iPAQ_H191x )) | 306 | ( d->m_model == Model_iPAQ_H191x ) || |
307 | ( d->m_model == Model_iPAQ_H1940 )) | ||
304 | newkeycode = Key_Left + ( keycode - Key_Left + 3 ) % 4; | 308 | newkeycode = Key_Left + ( keycode - Key_Left + 3 ) % 4; |
305 | break; | 309 | break; |
306 | } | 310 | } |
307 | 311 | ||
308 | // map Power Button short/long press to F34/F35 | 312 | // map Power Button short/long press to F34/F35 |
309 | case Key_SysReq: { | 313 | case Key_SysReq: { |
310 | if ( isPress ) { | 314 | if ( isPress ) { |
311 | if ( m_power_timer ) | 315 | if ( m_power_timer ) |
312 | killTimer ( m_power_timer ); | 316 | killTimer ( m_power_timer ); |
313 | m_power_timer = startTimer ( 500 ); | 317 | m_power_timer = startTimer ( 500 ); |
314 | } | 318 | } |
315 | else if ( m_power_timer ) { | 319 | else if ( m_power_timer ) { |
316 | killTimer ( m_power_timer ); | 320 | killTimer ( m_power_timer ); |
317 | m_power_timer = 0; | 321 | m_power_timer = 0; |
318 | QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, true, false ); | 322 | QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, true, false ); |
319 | QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, false, false ); | 323 | QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, false, false ); |
320 | } | 324 | } |
321 | newkeycode = Key_unknown; | 325 | newkeycode = Key_unknown; |
322 | break; | 326 | break; |
323 | } | 327 | } |
324 | } | 328 | } |
325 | 329 | ||
326 | if ( newkeycode != keycode ) { | 330 | if ( newkeycode != keycode ) { |
327 | if ( newkeycode != Key_unknown ) | 331 | if ( newkeycode != Key_unknown ) |
328 | QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat ); | 332 | QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat ); |
329 | return true; | 333 | return true; |
330 | } | 334 | } |
331 | else | 335 | else |
332 | return false; | 336 | return false; |
333 | } | 337 | } |
334 | 338 | ||
335 | void iPAQ::timerEvent ( QTimerEvent * ) | 339 | void iPAQ::timerEvent ( QTimerEvent * ) |
336 | { | 340 | { |
337 | killTimer ( m_power_timer ); | 341 | killTimer ( m_power_timer ); |
338 | m_power_timer = 0; | 342 | m_power_timer = 0; |
339 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false ); | 343 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false ); |
340 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false ); | 344 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false ); |
341 | } | 345 | } |
342 | 346 | ||
343 | 347 | ||
344 | void iPAQ::playAlarmSound() | 348 | void iPAQ::playAlarmSound() |
345 | { | 349 | { |
346 | #ifndef QT_NO_SOUND | 350 | #ifndef QT_NO_SOUND |
347 | static Sound snd ( "alarm" ); | 351 | static Sound snd ( "alarm" ); |
348 | if(!snd.isFinished()) | 352 | if(!snd.isFinished()) |
349 | return; | 353 | return; |
350 | 354 | ||
351 | changeMixerForAlarm(0, "/dev/sound/mixer", &snd ); | 355 | changeMixerForAlarm(0, "/dev/sound/mixer", &snd ); |
@@ -357,96 +361,98 @@ bool iPAQ::setDisplayBrightness ( int bright ) | |||
357 | { | 361 | { |
358 | bool res = false; | 362 | bool res = false; |
359 | int fd; | 363 | int fd; |
360 | 364 | ||
361 | if ( bright > 255 ) | 365 | if ( bright > 255 ) |
362 | bright = 255; | 366 | bright = 255; |
363 | if ( bright < 0 ) | 367 | if ( bright < 0 ) |
364 | bright = 0; | 368 | bright = 0; |
365 | 369 | ||
366 | QString cmdline; | 370 | QString cmdline; |
367 | 371 | ||
368 | switch ( model()) { | 372 | switch ( model()) { |
369 | case Model_iPAQ_H191x: | 373 | case Model_iPAQ_H191x: |
370 | if ( !bright ) | 374 | if ( !bright ) |
371 | cmdline = QString::fromLatin1( "echo 4 > /sys/class/backlight/pxafb/power"); | 375 | cmdline = QString::fromLatin1( "echo 4 > /sys/class/backlight/pxafb/power"); |
372 | else | 376 | else |
373 | cmdline = QString::fromLatin1( "echo 0 > /sys/class/backlight/pxafb/power; echo %1 > /sys/class/backlight/pxafb/brightness" ).arg( bright ); | 377 | cmdline = QString::fromLatin1( "echo 0 > /sys/class/backlight/pxafb/power; echo %1 > /sys/class/backlight/pxafb/brightness" ).arg( bright ); |
374 | // No Global::shellQuote as we gurantee it to be sane | 378 | // No Global::shellQuote as we gurantee it to be sane |
375 | res = ( ::system( QFile::encodeName(cmdline) ) == 0 ); | 379 | res = ( ::system( QFile::encodeName(cmdline) ) == 0 ); |
376 | break; | 380 | break; |
377 | default: | 381 | default: |
378 | if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) { | 382 | if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) { |
379 | FLITE_IN bl; | 383 | FLITE_IN bl; |
380 | bl. mode = 1; | 384 | bl. mode = 1; |
381 | bl. pwr = bright ? 1 : 0; | 385 | bl. pwr = bright ? 1 : 0; |
382 | bl. brightness = ( bright * ( displayBrightnessResolution() - 1 ) + 127 ) / 255; | 386 | bl. brightness = ( bright * ( displayBrightnessResolution() - 1 ) + 127 ) / 255; |
383 | res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 ); | 387 | res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 ); |
384 | ::close ( fd ); | 388 | ::close ( fd ); |
385 | } | 389 | } |
386 | } | 390 | } |
387 | return res; | 391 | return res; |
388 | } | 392 | } |
389 | 393 | ||
390 | int iPAQ::displayBrightnessResolution() const | 394 | int iPAQ::displayBrightnessResolution() const |
391 | { | 395 | { |
392 | switch ( model()) { | 396 | switch ( model()) { |
393 | case Model_iPAQ_H31xx: | 397 | case Model_iPAQ_H31xx: |
394 | case Model_iPAQ_H36xx: | 398 | case Model_iPAQ_H36xx: |
395 | case Model_iPAQ_H37xx: | 399 | case Model_iPAQ_H37xx: |
396 | return 128; // really 256, but >128 could damage the LCD | 400 | return 128; // really 256, but >128 could damage the LCD |
397 | 401 | ||
398 | case Model_iPAQ_H38xx: | 402 | case Model_iPAQ_H38xx: |
399 | case Model_iPAQ_H39xx: | 403 | case Model_iPAQ_H39xx: |
400 | return 64; | 404 | return 64; |
401 | case Model_iPAQ_H5xxx: | 405 | case Model_iPAQ_H5xxx: |
402 | return 255; | 406 | return 255; |
403 | case Model_iPAQ_H191x: | 407 | case Model_iPAQ_H191x: |
404 | return 183; | 408 | return 183; |
409 | case Model_iPAQ_H191x: | ||
410 | return 44; | ||
405 | default: | 411 | default: |
406 | return 2; | 412 | return 2; |
407 | } | 413 | } |
408 | } | 414 | } |
409 | 415 | ||
410 | bool iPAQ::setDisplayStatus ( bool on ) | 416 | bool iPAQ::setDisplayStatus ( bool on ) |
411 | { | 417 | { |
412 | bool res = false; | 418 | bool res = false; |
413 | 419 | ||
414 | QString cmdline; | 420 | QString cmdline; |
415 | 421 | ||
416 | if ( model() == Model_iPAQ_H191x ) { | 422 | if ( model() == Model_iPAQ_H191x ) { |
417 | cmdline = QString::fromLatin1( "echo %1 > /sys/class/lcd/pxafb/power; echo %2 > /sys/class/backlight/pxafb/power").arg( on ? "0" : "4" ).arg( on ? "0" : "4" ); | 423 | cmdline = QString::fromLatin1( "echo %1 > /sys/class/lcd/pxafb/power; echo %2 > /sys/class/backlight/pxafb/power").arg( on ? "0" : "4" ).arg( on ? "0" : "4" ); |
418 | } else { | 424 | } else { |
419 | return OAbstractMobileDevice::setDisplayStatus(on); | 425 | return OAbstractMobileDevice::setDisplayStatus(on); |
420 | } | 426 | } |
421 | 427 | ||
422 | res = ( ::system( QFile::encodeName(cmdline) ) == 0 ); | 428 | res = ( ::system( QFile::encodeName(cmdline) ) == 0 ); |
423 | 429 | ||
424 | return res; | 430 | return res; |
425 | } | 431 | } |
426 | 432 | ||
427 | bool iPAQ::hasLightSensor() const | 433 | bool iPAQ::hasLightSensor() const |
428 | { | 434 | { |
429 | return true; | 435 | return true; |
430 | } | 436 | } |
431 | 437 | ||
432 | int iPAQ::readLightSensor() | 438 | int iPAQ::readLightSensor() |
433 | { | 439 | { |
434 | int fd; | 440 | int fd; |
435 | int val = -1; | 441 | int val = -1; |
436 | 442 | ||
437 | if (( fd = ::open ( "/proc/hal/light_sensor", O_RDONLY )) >= 0 ) { | 443 | if (( fd = ::open ( "/proc/hal/light_sensor", O_RDONLY )) >= 0 ) { |
438 | char buffer [8]; | 444 | char buffer [8]; |
439 | 445 | ||
440 | if ( ::read ( fd, buffer, 5 ) == 5 ) { | 446 | if ( ::read ( fd, buffer, 5 ) == 5 ) { |
441 | char *endptr; | 447 | char *endptr; |
442 | 448 | ||
443 | buffer [4] = 0; | 449 | buffer [4] = 0; |
444 | val = ::strtol ( buffer + 2, &endptr, 16 ); | 450 | val = ::strtol ( buffer + 2, &endptr, 16 ); |
445 | 451 | ||
446 | if ( *endptr != 0 ) | 452 | if ( *endptr != 0 ) |
447 | val = -1; | 453 | val = -1; |
448 | } | 454 | } |
449 | ::close ( fd ); | 455 | ::close ( fd ); |
450 | } | 456 | } |
451 | 457 | ||
452 | return val; | 458 | return val; |