author | erik <erik> | 2007-02-08 21:33:21 (UTC) |
---|---|---|
committer | erik <erik> | 2007-02-08 21:33:21 (UTC) |
commit | 63f64a9733d5504bb04d5f06cdf52b42a4b8006c (patch) (unidiff) | |
tree | 7101166c3fac37e2ff1fd1ce3b52bb61b9f618c9 /libopie2 | |
parent | 41dce553a418765d5075fc249c636104a2a82329 (diff) | |
download | opie-63f64a9733d5504bb04d5f06cdf52b42a4b8006c.zip opie-63f64a9733d5504bb04d5f06cdf52b42a4b8006c.tar.gz opie-63f64a9733d5504bb04d5f06cdf52b42a4b8006c.tar.bz2 |
Commit of GoXbox Live HTC Universal patch. This should make backlight
work with current kernel versions. It also changes the mixer name to the
rightful name for most modern kernels. It is rumored that the mixer in most
HTC devices does not work. But at least it points at the right device now.
Thanks GoXbox Live!
-rw-r--r-- | libopie2/opiecore/device/odevice_htc.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libopie2/opiecore/device/odevice_htc.cpp b/libopie2/opiecore/device/odevice_htc.cpp index 4e5200b..a6ade11 100644 --- a/libopie2/opiecore/device/odevice_htc.cpp +++ b/libopie2/opiecore/device/odevice_htc.cpp | |||
@@ -141,104 +141,104 @@ void HTC::init(const QString& cpu_info) | |||
141 | QString model; | 141 | QString model; |
142 | int loc = cpu_info.find( ":" ); | 142 | int loc = cpu_info.find( ":" ); |
143 | if ( loc != -1 ) | 143 | if ( loc != -1 ) |
144 | model = cpu_info.mid( loc+2 ).simplifyWhiteSpace(); | 144 | model = cpu_info.mid( loc+2 ).simplifyWhiteSpace(); |
145 | else | 145 | else |
146 | model = cpu_info; | 146 | model = cpu_info; |
147 | 147 | ||
148 | d->m_model = Model_HTC_Universal; | 148 | d->m_model = Model_HTC_Universal; |
149 | d->m_modelstr = "Unknown HTC"; | 149 | d->m_modelstr = "Unknown HTC"; |
150 | 150 | ||
151 | if ( model == "HTC Universal" ) { | 151 | if ( model == "HTC Universal" ) { |
152 | d->m_model = Model_HTC_Universal; | 152 | d->m_model = Model_HTC_Universal; |
153 | d->m_modelstr = "HTC Universal"; | 153 | d->m_modelstr = "HTC Universal"; |
154 | } | 154 | } |
155 | if ( model == "HTC Alpine" ) { | 155 | if ( model == "HTC Alpine" ) { |
156 | d->m_model = Model_HTC_Alpine; | 156 | d->m_model = Model_HTC_Alpine; |
157 | d->m_modelstr = "HTC Alpine"; | 157 | d->m_modelstr = "HTC Alpine"; |
158 | } | 158 | } |
159 | if ( model == "HTC Apache" ) { | 159 | if ( model == "HTC Apache" ) { |
160 | d->m_model = Model_HTC_Apache; | 160 | d->m_model = Model_HTC_Apache; |
161 | d->m_modelstr = "HTC Apache"; | 161 | d->m_modelstr = "HTC Apache"; |
162 | } | 162 | } |
163 | if ( model == "HTC Beetles" ) { | 163 | if ( model == "HTC Beetles" ) { |
164 | d->m_model = Model_HTC_Beetles; | 164 | d->m_model = Model_HTC_Beetles; |
165 | d->m_modelstr = "HTC Beetles"; | 165 | d->m_modelstr = "HTC Beetles"; |
166 | } | 166 | } |
167 | if ( model == "HTC Blueangel" ) { | 167 | if ( model == "HTC Blueangel" ) { |
168 | d->m_model = Model_HTC_Blueangel; | 168 | d->m_model = Model_HTC_Blueangel; |
169 | d->m_modelstr = "HTC Blueangel"; | 169 | d->m_modelstr = "HTC Blueangel"; |
170 | } | 170 | } |
171 | if ( model == "HTC Himalaya" ) { | 171 | if ( model == "HTC Himalaya" ) { |
172 | d->m_model = Model_HTC_Himalaya; | 172 | d->m_model = Model_HTC_Himalaya; |
173 | d->m_modelstr = "HTC Himalaya"; | 173 | d->m_modelstr = "HTC Himalaya"; |
174 | } | 174 | } |
175 | if ( model == "HTC Magician" ) { | 175 | if ( model == "HTC Magician" ) { |
176 | d->m_model = Model_HTC_Magician; | 176 | d->m_model = Model_HTC_Magician; |
177 | d->m_modelstr = "HTC Magician"; | 177 | d->m_modelstr = "HTC Magician"; |
178 | } | 178 | } |
179 | 179 | ||
180 | 180 | ||
181 | // set path to backlight device | 181 | // set path to backlight device |
182 | switch ( d->m_model ) | 182 | switch ( d->m_model ) |
183 | { | 183 | { |
184 | case Model_HTC_Universal: | 184 | case Model_HTC_Universal: |
185 | case Model_HTC_Magician: | 185 | case Model_HTC_Magician: |
186 | case Model_HTC_Alpine: | 186 | case Model_HTC_Alpine: |
187 | case Model_HTC_Beetles: | 187 | case Model_HTC_Beetles: |
188 | case Model_HTC_Apache: | 188 | case Model_HTC_Apache: |
189 | m_backlightdev = "/sys/class/backlight/pxa2xx-fb/"; | 189 | m_backlightdev = "/sys/class/backlight/corgi-bl/"; |
190 | break; | 190 | break; |
191 | case Model_HTC_Blueangel: | 191 | case Model_HTC_Blueangel: |
192 | case Model_HTC_Himalaya: | 192 | case Model_HTC_Himalaya: |
193 | m_backlightdev = "/sys/class/backlight/w100fb/"; | 193 | m_backlightdev = "/sys/class/backlight/w100fb/"; |
194 | break; | 194 | break; |
195 | default: | 195 | default: |
196 | m_backlightdev = "/sys/class/backlight/pxafb/"; | 196 | m_backlightdev = "/sys/class/backlight/corgi-bl/"; |
197 | } | 197 | } |
198 | 198 | ||
199 | // set initial rotation | 199 | // set initial rotation |
200 | switch( d->m_model ) | 200 | switch( d->m_model ) |
201 | { | 201 | { |
202 | case Model_HTC_Universal: | 202 | case Model_HTC_Universal: |
203 | initHingeSensor(); | 203 | initHingeSensor(); |
204 | d->m_rotation = rotation(); | 204 | d->m_rotation = rotation(); |
205 | d->m_direction = direction(); | 205 | d->m_direction = direction(); |
206 | break; | 206 | break; |
207 | default: | 207 | default: |
208 | d->m_rotation = Rot270; | 208 | d->m_rotation = Rot270; |
209 | } | 209 | } |
210 | 210 | ||
211 | // set default qte driver | 211 | // set default qte driver |
212 | switch( d->m_model ) | 212 | switch( d->m_model ) |
213 | { | 213 | { |
214 | default: | 214 | default: |
215 | d->m_qteDriver = "Transformed"; | 215 | d->m_qteDriver = "Transformed"; |
216 | } | 216 | } |
217 | 217 | ||
218 | m_leds[0] = Led_Off; | 218 | m_leds[0] = Led_Off; |
219 | 219 | ||
220 | qDebug( "HTC::init() - Using the 2.6 Xanadux on a %s", (const char*) d->m_modelstr ); | 220 | qDebug( "HTC::init() - Using the 2.6 Xanadux on a %s", (const char*) d->m_modelstr ); |
221 | } | 221 | } |
222 | 222 | ||
223 | void HTC::initButtons() | 223 | void HTC::initButtons() |
224 | { | 224 | { |
225 | qDebug( "HTC::initButtons()" ); | 225 | qDebug( "HTC::initButtons()" ); |
226 | if ( d->m_buttons ) | 226 | if ( d->m_buttons ) |
227 | return; | 227 | return; |
228 | 228 | ||
229 | d->m_buttons = new QValueList <ODeviceButton>; | 229 | d->m_buttons = new QValueList <ODeviceButton>; |
230 | 230 | ||
231 | struct htc_button * phtc_buttons; | 231 | struct htc_button * phtc_buttons; |
232 | int buttoncount; | 232 | int buttoncount; |
233 | switch ( d->m_model ) | 233 | switch ( d->m_model ) |
234 | { | 234 | { |
235 | case Model_HTC_Universal: | 235 | case Model_HTC_Universal: |
236 | if ( isQWS( ) ) | 236 | if ( isQWS( ) ) |
237 | { | 237 | { |
238 | addPreHandler(this); | 238 | addPreHandler(this); |
239 | } | 239 | } |
240 | phtc_buttons = htc_buttons_universal; | 240 | phtc_buttons = htc_buttons_universal; |
241 | buttoncount = ARRAY_SIZE(htc_buttons_universal); | 241 | buttoncount = ARRAY_SIZE(htc_buttons_universal); |
242 | break; | 242 | break; |
243 | default: | 243 | default: |
244 | phtc_buttons = htc_buttons; | 244 | phtc_buttons = htc_buttons; |
@@ -255,97 +255,97 @@ void HTC::initButtons() | |||
255 | b.setPixmap( OResource::loadPixmap( zb->pix )); | 255 | b.setPixmap( OResource::loadPixmap( zb->pix )); |
256 | b.setFactoryPresetPressedAction( OQCopMessage( makeChannel ( zb->fpressedservice ), zb->fpressedaction )); | 256 | b.setFactoryPresetPressedAction( OQCopMessage( makeChannel ( zb->fpressedservice ), zb->fpressedaction )); |
257 | b.setFactoryPresetHeldAction( OQCopMessage( makeChannel ( zb->fheldservice ), zb->fheldaction )); | 257 | b.setFactoryPresetHeldAction( OQCopMessage( makeChannel ( zb->fheldservice ), zb->fheldaction )); |
258 | d->m_buttons->append( b ); | 258 | d->m_buttons->append( b ); |
259 | } | 259 | } |
260 | 260 | ||
261 | reloadButtonMapping(); | 261 | reloadButtonMapping(); |
262 | } | 262 | } |
263 | 263 | ||
264 | 264 | ||
265 | 265 | ||
266 | typedef struct sharp_led_status { | 266 | typedef struct sharp_led_status { |
267 | int which; /* select which LED status is wanted. */ | 267 | int which; /* select which LED status is wanted. */ |
268 | int status; /* set new led status if you call SHARP_LED_SETSTATUS */ | 268 | int status; /* set new led status if you call SHARP_LED_SETSTATUS */ |
269 | } sharp_led_status; | 269 | } sharp_led_status; |
270 | 270 | ||
271 | void HTC::buzzer( int sound ) | 271 | void HTC::buzzer( int sound ) |
272 | { | 272 | { |
273 | #ifndef QT_NO_SOUND | 273 | #ifndef QT_NO_SOUND |
274 | Sound *snd = 0; | 274 | Sound *snd = 0; |
275 | 275 | ||
276 | // All devices except SL5500 have a DSP device | 276 | // All devices except SL5500 have a DSP device |
277 | if ( d->m_model == Model_HTC_Universal ) { | 277 | if ( d->m_model == Model_HTC_Universal ) { |
278 | 278 | ||
279 | switch ( sound ){ | 279 | switch ( sound ){ |
280 | case SHARP_BUZ_TOUCHSOUND: { | 280 | case SHARP_BUZ_TOUCHSOUND: { |
281 | static Sound touch_sound("touchsound"); | 281 | static Sound touch_sound("touchsound"); |
282 | snd = &touch_sound; | 282 | snd = &touch_sound; |
283 | } | 283 | } |
284 | break; | 284 | break; |
285 | case SHARP_BUZ_KEYSOUND: { | 285 | case SHARP_BUZ_KEYSOUND: { |
286 | static Sound key_sound( "keysound" ); | 286 | static Sound key_sound( "keysound" ); |
287 | snd = &key_sound; | 287 | snd = &key_sound; |
288 | } | 288 | } |
289 | break; | 289 | break; |
290 | case SHARP_BUZ_SCHEDULE_ALARM: | 290 | case SHARP_BUZ_SCHEDULE_ALARM: |
291 | default: { | 291 | default: { |
292 | static Sound alarm_sound("alarm"); | 292 | static Sound alarm_sound("alarm"); |
293 | snd = &alarm_sound; | 293 | snd = &alarm_sound; |
294 | } | 294 | } |
295 | break; | 295 | break; |
296 | } | 296 | } |
297 | } | 297 | } |
298 | 298 | ||
299 | // If a soundname is defined, we expect that this device has | 299 | // If a soundname is defined, we expect that this device has |
300 | // sound capabilities.. Otherwise we expect to have the buzzer | 300 | // sound capabilities.. Otherwise we expect to have the buzzer |
301 | // device.. | 301 | // device.. |
302 | if ( snd && snd->isFinished() ){ | 302 | if ( snd && snd->isFinished() ){ |
303 | changeMixerForAlarm( 0, "/dev/sound/mixer", snd ); | 303 | changeMixerForAlarm( 0, "/dev/mixer", snd ); |
304 | snd->play(); | 304 | snd->play(); |
305 | } else if( !snd ) { | 305 | } else if( !snd ) { |
306 | int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK ); | 306 | int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK ); |
307 | 307 | ||
308 | if ( fd >= 0 ) { | 308 | if ( fd >= 0 ) { |
309 | ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound ); | 309 | ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound ); |
310 | ::close ( fd ); | 310 | ::close ( fd ); |
311 | } | 311 | } |
312 | 312 | ||
313 | } | 313 | } |
314 | #endif | 314 | #endif |
315 | } | 315 | } |
316 | 316 | ||
317 | 317 | ||
318 | void HTC::playAlarmSound() | 318 | void HTC::playAlarmSound() |
319 | { | 319 | { |
320 | buzzer( SHARP_BUZ_SCHEDULE_ALARM ); | 320 | buzzer( SHARP_BUZ_SCHEDULE_ALARM ); |
321 | } | 321 | } |
322 | 322 | ||
323 | void HTC::playTouchSound() | 323 | void HTC::playTouchSound() |
324 | { | 324 | { |
325 | buzzer( SHARP_BUZ_TOUCHSOUND ); | 325 | buzzer( SHARP_BUZ_TOUCHSOUND ); |
326 | } | 326 | } |
327 | 327 | ||
328 | void HTC::playKeySound() | 328 | void HTC::playKeySound() |
329 | { | 329 | { |
330 | buzzer( SHARP_BUZ_KEYSOUND ); | 330 | buzzer( SHARP_BUZ_KEYSOUND ); |
331 | } | 331 | } |
332 | 332 | ||
333 | 333 | ||
334 | QValueList <OLed> HTC::ledList() const | 334 | QValueList <OLed> HTC::ledList() const |
335 | { | 335 | { |
336 | QValueList <OLed> vl; | 336 | QValueList <OLed> vl; |
337 | vl << Led_Mail; | 337 | vl << Led_Mail; |
338 | return vl; | 338 | return vl; |
339 | } | 339 | } |
340 | 340 | ||
341 | QValueList <OLedState> HTC::ledStateList( OLed l ) const | 341 | QValueList <OLedState> HTC::ledStateList( OLed l ) const |
342 | { | 342 | { |
343 | QValueList <OLedState> vl; | 343 | QValueList <OLedState> vl; |
344 | 344 | ||
345 | if ( l == Led_Mail ) | 345 | if ( l == Led_Mail ) |
346 | vl << Led_Off << Led_On << Led_BlinkSlow; | 346 | vl << Led_Off << Led_On << Led_BlinkSlow; |
347 | return vl; | 347 | return vl; |
348 | } | 348 | } |
349 | 349 | ||
350 | OLedState HTC::ledState( OLed which ) const | 350 | OLedState HTC::ledState( OLed which ) const |
351 | { | 351 | { |