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_ipaq.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_ipaq.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | libopie2/opiecore/device/odevice_ipaq.cpp | 71 |
1 files changed, 22 insertions, 49 deletions
diff --git a/libopie2/opiecore/device/odevice_ipaq.cpp b/libopie2/opiecore/device/odevice_ipaq.cpp index 21fed99..7f5aa7b 100644 --- a/libopie2/opiecore/device/odevice_ipaq.cpp +++ b/libopie2/opiecore/device/odevice_ipaq.cpp | |||
@@ -1,36 +1,36 @@ | |||
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) 2002,2003,2004 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, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include "odevice_ipaq.h" | 30 | #include "odevice_ipaq.h" |
31 | 31 | ||
32 | /* QT */ | 32 | /* QT */ |
33 | #include <qapplication.h> | 33 | #include <qapplication.h> |
34 | #include <qfile.h> | 34 | #include <qfile.h> |
35 | #include <qtextstream.h> | 35 | #include <qtextstream.h> |
36 | #include <qwindowsystem_qws.h> | 36 | #include <qwindowsystem_qws.h> |
@@ -322,54 +322,27 @@ void iPAQ::timerEvent ( QTimerEvent * ) | |||
322 | { | 322 | { |
323 | killTimer ( m_power_timer ); | 323 | killTimer ( m_power_timer ); |
324 | m_power_timer = 0; | 324 | m_power_timer = 0; |
325 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false ); | 325 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false ); |
326 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false ); | 326 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false ); |
327 | } | 327 | } |
328 | 328 | ||
329 | 329 | ||
330 | void iPAQ::playAlarmSound() | 330 | void iPAQ::playAlarmSound() |
331 | { | 331 | { |
332 | #ifndef QT_NO_SOUND | 332 | #ifndef QT_NO_SOUND |
333 | static Sound snd ( "alarm" ); | 333 | static Sound snd ( "alarm" ); |
334 | int fd; | ||
335 | int vol; | ||
336 | bool vol_reset = false; | ||
337 | |||
338 | if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) { | ||
339 | if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) { | ||
340 | Config cfg ( "qpe" ); | ||
341 | cfg. setGroup ( "Volume" ); | ||
342 | |||
343 | int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 ); | ||
344 | if ( volalarm < 0 ) | ||
345 | volalarm = 0; | ||
346 | else if ( volalarm > 100 ) | ||
347 | volalarm = 100; | ||
348 | volalarm |= ( volalarm << 8 ); | ||
349 | |||
350 | if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 ) | ||
351 | vol_reset = true; | ||
352 | } | ||
353 | } | ||
354 | 334 | ||
335 | changeMixerForAlarm(0, "/dev/sound/mixer", &snd ); | ||
355 | snd. play(); | 336 | snd. play(); |
356 | while ( !snd. isFinished()) | ||
357 | qApp->processEvents(); | ||
358 | |||
359 | if ( fd >= 0 ) { | ||
360 | if ( vol_reset ) | ||
361 | ::ioctl ( fd, MIXER_WRITE( 0 ), &vol ); | ||
362 | ::close ( fd ); | ||
363 | } | ||
364 | #endif | 337 | #endif |
365 | } | 338 | } |
366 | 339 | ||
367 | 340 | ||
368 | bool iPAQ::setSoftSuspend ( bool soft ) | 341 | bool iPAQ::setSoftSuspend ( bool soft ) |
369 | { | 342 | { |
370 | bool res = false; | 343 | bool res = false; |
371 | int fd; | 344 | int fd; |
372 | 345 | ||
373 | if (( fd = ::open ( "/proc/sys/ts/suspend_button_mode", O_WRONLY )) >= 0 ) { | 346 | if (( fd = ::open ( "/proc/sys/ts/suspend_button_mode", O_WRONLY )) >= 0 ) { |
374 | if ( ::write ( fd, soft ? "1" : "0", 1 ) == 1 ) | 347 | if ( ::write ( fd, soft ? "1" : "0", 1 ) == 1 ) |
375 | res = true; | 348 | res = true; |