summaryrefslogtreecommitdiff
path: root/libopie2/opiecore/device/odevice_htc.cpp
authorerik <erik>2007-02-09 21:12:35 (UTC)
committer erik <erik>2007-02-09 21:12:35 (UTC)
commit2695f72652956e94e24611539579e7ff7899811e (patch) (side-by-side diff)
tree0a2e73775f5b04da5950465f1c31e067256a266c /libopie2/opiecore/device/odevice_htc.cpp
parent9abe862308081155837512dd5e6c581752c9ddb2 (diff)
downloadopie-2695f72652956e94e24611539579e7ff7899811e.zip
opie-2695f72652956e94e24611539579e7ff7899811e.tar.gz
opie-2695f72652956e94e24611539579e7ff7899811e.tar.bz2
This commit fixes an issue where an ioctl call is made but the return
value is not checked. It isn't a big deal. But it would be nice if the user knew that an ioctl to a device tanked.
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()
reloadButtonMapping();
}
typedef struct sharp_led_status {
int which; /* select which LED status is wanted. */
int status; /* set new led status if you call SHARP_LED_SETSTATUS */
} sharp_led_status;
void HTC::buzzer( int sound )
{
#ifndef QT_NO_SOUND
Sound *snd = 0;
// All devices except SL5500 have a DSP device
if ( d->m_model == Model_HTC_Universal ) {
switch ( sound ){
case SHARP_BUZ_TOUCHSOUND: {
static Sound touch_sound("touchsound");
snd = &touch_sound;
}
break;
case SHARP_BUZ_KEYSOUND: {
static Sound key_sound( "keysound" );
snd = &key_sound;
}
break;
case SHARP_BUZ_SCHEDULE_ALARM:
default: {
static Sound alarm_sound("alarm");
snd = &alarm_sound;
}
break;
}
}
// If a soundname is defined, we expect that this device has
// sound capabilities.. Otherwise we expect to have the buzzer
// device..
if ( snd && snd->isFinished() ){
changeMixerForAlarm( 0, "/dev/mixer", snd );
snd->play();
} else if( !snd ) {
int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK );
if ( fd >= 0 ) {
- ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound );
+ if (::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound ) == -1)
+ qWarning( "HTC::buzzer() - Couldn't make the buzzer buzz (%s)",
+ strerror( errno ) );
::close ( fd );
}
}
#endif
}
void HTC::playAlarmSound()
{
buzzer( SHARP_BUZ_SCHEDULE_ALARM );
}
void HTC::playTouchSound()
{
buzzer( SHARP_BUZ_TOUCHSOUND );
}
void HTC::playKeySound()
{
buzzer( SHARP_BUZ_KEYSOUND );
}
QValueList <OLed> HTC::ledList() const
{
QValueList <OLed> vl;
vl << Led_Mail;
return vl;
}
QValueList <OLedState> HTC::ledStateList( OLed l ) const
{
QValueList <OLedState> vl;
if ( l == Led_Mail )
vl << Led_Off << Led_On << Led_BlinkSlow;
return vl;
}
OLedState HTC::ledState( OLed which ) const
{
if ( which == Led_Mail )
return m_leds [0];
else
return Led_Off;
}