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_zaurus.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_zaurus.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | libopie2/opiecore/device/odevice_zaurus.cpp | 99 |
1 files changed, 34 insertions, 65 deletions
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp index 47682bb..127fee9 100644 --- a/libopie2/opiecore/device/odevice_zaurus.cpp +++ b/libopie2/opiecore/device/odevice_zaurus.cpp | |||
@@ -1,26 +1,26 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) The Opie Team <opie-devel@handhelds.org> | 3 | Copyright (C) The Opie Team <opie-devel@handhelds.org> |
4 | =. | 4 | =. |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
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, |
@@ -184,6 +184,4 @@ void Zaurus::init(const QString& cpu_info) | |||
184 | 184 | ||
185 | // set initial rotation | 185 | // set initial rotation |
186 | |||
187 | bool flipstate = false; | ||
188 | switch ( d->m_model ) { | 186 | switch ( d->m_model ) { |
189 | case Model_Zaurus_SL6000: | 187 | case Model_Zaurus_SL6000: |
@@ -319,5 +317,5 @@ void Zaurus::buzzer ( int sound ) | |||
319 | { | 317 | { |
320 | #ifndef QT_NO_SOUND | 318 | #ifndef QT_NO_SOUND |
321 | QString soundname; | 319 | Sound *snd = 0; |
322 | 320 | ||
323 | // Not all devices have real sound | 321 | // Not all devices have real sound |
@@ -326,16 +324,17 @@ void Zaurus::buzzer ( int sound ) | |||
326 | 324 | ||
327 | switch ( sound ){ | 325 | switch ( sound ){ |
328 | case SHARP_BUZ_SCHEDULE_ALARM: | ||
329 | soundname = "alarm"; | ||
330 | break; | ||
331 | case SHARP_BUZ_TOUCHSOUND: | 326 | case SHARP_BUZ_TOUCHSOUND: |
332 | soundname = "touchsound"; | 327 | static Sound touch_sound("touchsound"); |
328 | snd = &touch_sound; | ||
333 | break; | 329 | break; |
334 | case SHARP_BUZ_KEYSOUND: | 330 | case SHARP_BUZ_KEYSOUND: |
335 | soundname = "keysound"; | 331 | static Sound key_sound( "keysound" ); |
332 | snd = &key_sound; | ||
336 | break; | 333 | break; |
334 | case SHARP_BUZ_SCHEDULE_ALARM: | ||
337 | default: | 335 | default: |
338 | soundname = "alarm"; | 336 | static Sound alarm_sound("alarm"); |
339 | 337 | snd = &alarm_sound; | |
338 | break; | ||
340 | } | 339 | } |
341 | } | 340 | } |
@@ -344,37 +343,7 @@ void Zaurus::buzzer ( int sound ) | |||
344 | // sound capabilities.. Otherwise we expect to have the buzzer | 343 | // sound capabilities.. Otherwise we expect to have the buzzer |
345 | // device.. | 344 | // device.. |
346 | if ( !soundname.isEmpty() ){ | 345 | if ( snd ){ |
347 | int fd; | 346 | changeMixerForAlarm( 0, "/dev/sound/mixer", snd ); |
348 | int vol; | 347 | snd-> play(); |
349 | bool vol_reset = false; | ||
350 | |||
351 | Sound snd ( soundname ); | ||
352 | |||
353 | if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) { | ||
354 | if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) { | ||
355 | Config cfg ( "qpe" ); | ||
356 | cfg. setGroup ( "Volume" ); | ||
357 | |||
358 | int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 ); | ||
359 | if ( volalarm < 0 ) | ||
360 | volalarm = 0; | ||
361 | else if ( volalarm > 100 ) | ||
362 | volalarm = 100; | ||
363 | volalarm |= ( volalarm << 8 ); | ||
364 | |||
365 | if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 ) | ||
366 | vol_reset = true; | ||
367 | } | ||
368 | } | ||
369 | |||
370 | snd. play(); | ||
371 | while ( !snd. isFinished()) | ||
372 | qApp->processEvents(); | ||
373 | |||
374 | if ( fd >= 0 ) { | ||
375 | if ( vol_reset ) | ||
376 | ::ioctl ( fd, MIXER_WRITE( 0 ), &vol ); | ||
377 | ::close ( fd ); | ||
378 | } | ||
379 | } else { | 348 | } else { |
380 | int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK ); | 349 | int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK ); |
@@ -515,5 +484,5 @@ bool Zaurus::setDisplayBrightness ( int bright ) | |||
515 | if (( fd = ::open ( "/proc/driver/fl/corgi-bl", O_WRONLY )) >= 0 ) | 484 | if (( fd = ::open ( "/proc/driver/fl/corgi-bl", O_WRONLY )) >= 0 ) |
516 | { | 485 | { |
517 | int value = ( bright == 1 ) ? 1 : bright * ( 17.0 / 255.0 ); | 486 | int value = ( bright == 1 ) ? 1 : static_cast<int>( bright * ( 17.0 / 255.0 ) ); |
518 | char writeCommand[100]; | 487 | char writeCommand[100]; |
519 | const int count = sprintf( writeCommand, "0x%x\n", value ); | 488 | const int count = sprintf( writeCommand, "0x%x\n", value ); |