summaryrefslogtreecommitdiff
path: root/libopie2/opiecore/device/odevice_htc.cpp
Unidiff
Diffstat (limited to 'libopie2/opiecore/device/odevice_htc.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice_htc.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/libopie2/opiecore/device/odevice_htc.cpp b/libopie2/opiecore/device/odevice_htc.cpp
index 44b33c0..7f82369 100644
--- a/libopie2/opiecore/device/odevice_htc.cpp
+++ b/libopie2/opiecore/device/odevice_htc.cpp
@@ -261,97 +261,99 @@ void HTC::initButtons()
261 reloadButtonMapping(); 261 reloadButtonMapping();
262} 262}
263 263
264 264
265 265
266typedef struct sharp_led_status { 266typedef 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
271void HTC::buzzer( int sound ) 271void 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/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 if (::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound ) == -1)
310 qWarning( "HTC::buzzer() - Couldn't make the buzzer buzz (%s)",
311 strerror( errno ) );
310 ::close ( fd ); 312 ::close ( fd );
311 } 313 }
312 314
313 } 315 }
314#endif 316#endif
315} 317}
316 318
317 319
318void HTC::playAlarmSound() 320void HTC::playAlarmSound()
319{ 321{
320 buzzer( SHARP_BUZ_SCHEDULE_ALARM ); 322 buzzer( SHARP_BUZ_SCHEDULE_ALARM );
321} 323}
322 324
323void HTC::playTouchSound() 325void HTC::playTouchSound()
324{ 326{
325 buzzer( SHARP_BUZ_TOUCHSOUND ); 327 buzzer( SHARP_BUZ_TOUCHSOUND );
326} 328}
327 329
328void HTC::playKeySound() 330void HTC::playKeySound()
329{ 331{
330 buzzer( SHARP_BUZ_KEYSOUND ); 332 buzzer( SHARP_BUZ_KEYSOUND );
331} 333}
332 334
333 335
334QValueList <OLed> HTC::ledList() const 336QValueList <OLed> HTC::ledList() const
335{ 337{
336 QValueList <OLed> vl; 338 QValueList <OLed> vl;
337 vl << Led_Mail; 339 vl << Led_Mail;
338 return vl; 340 return vl;
339} 341}
340 342
341QValueList <OLedState> HTC::ledStateList( OLed l ) const 343QValueList <OLedState> HTC::ledStateList( OLed l ) const
342{ 344{
343 QValueList <OLedState> vl; 345 QValueList <OLedState> vl;
344 346
345 if ( l == Led_Mail ) 347 if ( l == Led_Mail )
346 vl << Led_Off << Led_On << Led_BlinkSlow; 348 vl << Led_Off << Led_On << Led_BlinkSlow;
347 return vl; 349 return vl;
348} 350}
349 351
350OLedState HTC::ledState( OLed which ) const 352OLedState HTC::ledState( OLed which ) const
351{ 353{
352 if ( which == Led_Mail ) 354 if ( which == Led_Mail )
353 return m_leds [0]; 355 return m_leds [0];
354 else 356 else
355 return Led_Off; 357 return Led_Off;
356} 358}
357 359