author | zecke <zecke> | 2004-08-25 21:51:13 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-08-25 21:51:13 (UTC) |
commit | df3e4c8b13c16aeb96e70dbaa2d409f83eed988e (patch) (unidiff) | |
tree | 59b12028c6e8a53b99f1686278b6e9fdc57ab18e /libopie2/opiecore/device/odevice_simpad.cpp | |
parent | e4811064703ad34f42f15c3044cd8f63c0e7583c (diff) | |
download | opie-df3e4c8b13c16aeb96e70dbaa2d409f83eed988e.zip opie-df3e4c8b13c16aeb96e70dbaa2d409f83eed988e.tar.gz opie-df3e4c8b13c16aeb96e70dbaa2d409f83eed988e.tar.bz2 |
-Have a common implementation for reading the config value
and setting the Mixer. The mixer, sound and path
is configurable
-Restore the Opie HEADER (who is guilty? probably me)
-Fix warnings
-Port Zaurus,Simpad,Ipaq to configure the mixer
Diffstat (limited to 'libopie2/opiecore/device/odevice_simpad.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | libopie2/opiecore/device/odevice_simpad.cpp | 47 |
1 files changed, 9 insertions, 38 deletions
diff --git a/libopie2/opiecore/device/odevice_simpad.cpp b/libopie2/opiecore/device/odevice_simpad.cpp index c6de614..2d0160d 100644 --- a/libopie2/opiecore/device/odevice_simpad.cpp +++ b/libopie2/opiecore/device/odevice_simpad.cpp | |||
@@ -239,8 +239,9 @@ bool SIMpad::setLedState ( OLed l, OLedState st ) | |||
239 | m_leds [0] = st; | 239 | m_leds [0] = st; |
240 | return true; | 240 | return true; |
241 | } | 241 | // } |
242 | } | 242 | // } |
243 | } | 243 | #else |
244 | 244 | Q_UNUSED( l ) | |
245 | Q_UNUSED( st ) | ||
245 | #endif | 246 | #endif |
246 | return false; | 247 | return false; |
@@ -248,5 +249,5 @@ bool SIMpad::setLedState ( OLed l, OLedState st ) | |||
248 | 249 | ||
249 | 250 | ||
250 | bool SIMpad::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) | 251 | bool SIMpad::filter ( int /*unicode*/, int /*keycode*/, int /*modifiers*/, bool /*isPress*/, bool /*autoRepeat*/ ) |
251 | { | 252 | { |
252 | //TODO | 253 | //TODO |
@@ -267,34 +268,8 @@ void SIMpad::playAlarmSound() | |||
267 | #ifndef QT_NO_SOUND | 268 | #ifndef QT_NO_SOUND |
268 | static Sound snd ( "alarm" ); | 269 | static Sound snd ( "alarm" ); |
269 | int fd; | ||
270 | int vol; | ||
271 | bool vol_reset = false; | ||
272 | |||
273 | if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) { | ||
274 | if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) { | ||
275 | Config cfg ( "qpe" ); | ||
276 | cfg. setGroup ( "Volume" ); | ||
277 | |||
278 | int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 ); | ||
279 | if ( volalarm < 0 ) | ||
280 | volalarm = 0; | ||
281 | else if ( volalarm > 100 ) | ||
282 | volalarm = 100; | ||
283 | volalarm |= ( volalarm << 8 ); | ||
284 | |||
285 | if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 ) | ||
286 | vol_reset = true; | ||
287 | } | ||
288 | } | ||
289 | 270 | ||
271 | /* save as the Sound is static! */ | ||
272 | changeMixerForAlarm( 0, "/dev/sound/mixer" , &snd); | ||
290 | snd. play(); | 273 | snd. play(); |
291 | while ( !snd. isFinished()) | ||
292 | qApp->processEvents(); | ||
293 | |||
294 | if ( fd >= 0 ) { | ||
295 | if ( vol_reset ) | ||
296 | ::ioctl ( fd, MIXER_WRITE( 0 ), &vol ); | ||
297 | ::close ( fd ); | ||
298 | } | ||
299 | #endif | 274 | #endif |
300 | } | 275 | } |
@@ -336,12 +311,8 @@ bool SIMpad::setDisplayStatus ( bool on ) | |||
336 | qDebug( "ODevice for SIMpad: setDisplayStatus(%s)", on? "on" : "off" ); | 311 | qDebug( "ODevice for SIMpad: setDisplayStatus(%s)", on? "on" : "off" ); |
337 | 312 | ||
338 | bool res = false; | ||
339 | int fd; | ||
340 | 313 | ||
341 | QString cmdline = QString().sprintf( "echo %s > /proc/cs3", on ? "0xd41a" : "0xd40a" ); //TODO make better :) | 314 | QString cmdline = QString().sprintf( "echo %s > /proc/cs3", on ? "0xd41a" : "0xd40a" ); //TODO make better :) |
342 | 315 | ||
343 | res = ( ::system( (const char*) cmdline ) == 0 ); | 316 | return ( ::system( (const char*) cmdline ) == 0 ); |
344 | |||
345 | return res; | ||
346 | } | 317 | } |
347 | 318 | ||