summaryrefslogtreecommitdiff
authoreilers <eilers>2003-08-08 15:13:30 (UTC)
committer eilers <eilers>2003-08-08 15:13:30 (UTC)
commitc6d96c514c58b288ac0bc8f844db35123bcaf2ad (patch) (side-by-side diff)
tree67941875720aeb94ea306e94ed36610cea3022fb
parentb87b33dc1f6e8e1276a7035ab7a3e53b8ed4bd16 (diff)
downloadopie-c6d96c514c58b288ac0bc8f844db35123bcaf2ad.zip
opie-c6d96c514c58b288ac0bc8f844db35123bcaf2ad.tar.gz
opie-c6d96c514c58b288ac0bc8f844db35123bcaf2ad.tar.bz2
Added support for C 750 (Shepherd):
Device is detected and sounds for keypress, screentap and alarm is working (using the sound device) Attention: Please don't activate the screentab sound. It has some quirks..
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/odevice.cpp87
1 files changed, 78 insertions, 9 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp
index 17ae389..a134810 100644
--- a/libopie/odevice.cpp
+++ b/libopie/odevice.cpp
@@ -1329,6 +1329,13 @@ void Zaurus::init ( )
- QFile f ( "/proc/filesystems" );
+ // QFile f ( "/proc/filesystems" );
QString model;
- if ( f. open ( IO_ReadOnly ) && ( QTextStream ( &f ). read ( ). find ( "\tjffs2\n" ) >= 0 )) {
+ // It isn't a good idea to check the system configuration to
+ // detect the distribution !
+ // Otherwise it may happen that any other distribution is detected as openzaurus, just
+ // because it uses a jffs2 filesystem..
+ // (eilers)
+ // if ( f. open ( IO_ReadOnly ) && ( QTextStream ( &f ). read ( ). find ( "\tjffs2\n" ) >= 0 )) {
+ QFile f ("/etc/oz_version");
+ if ( f.exists() ){
d-> m_vendorstr = "OpenZaurus Team";
@@ -1337,5 +1344,5 @@ void Zaurus::init ( )
- f. close ( );
+ // f. close ( );
- f. setName ( "/etc/oz_version" );
+ // f. setName ( "/etc/oz_version" );
if ( f. open ( IO_ReadOnly )) {
@@ -1367,3 +1374,6 @@ void Zaurus::init ( )
d-> m_modelstr = "Zaurus SL-C700";
- } else if ( model == "SHARP Poodle" ) {
+ } else if ( model == "SHARP Shepherd" ) {
+ d-> m_model = Model_Zaurus_SLC700; // Do we need a special type for the C750 ? (eilers)
+ d-> m_modelstr = "Zaurus SL-C750";
+ }else if ( model == "SHARP Poodle" ) {
d-> m_model = Model_Zaurus_SLB600;
@@ -1516,8 +1526,67 @@ void Zaurus::buzzer ( int sound )
{
- int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK );
+ // Not all devices have real sound.
+#ifndef QT_NO_SOUND
+ switch ( d-> m_model ) {
+ case Model_Zaurus_SLC700:{
+ int fd;
+ int vol;
+ bool vol_reset = false;
+
+ QString soundname;
+
+ switch ( sound ){
+ case SHARP_BUZ_SCHEDULE_ALARM:
+ soundname = "alarm";
+ break;
+ case SHARP_BUZ_TOUCHSOUND:
+ soundname = "touchsound";
+ break;
+ case SHARP_BUZ_KEYSOUND:
+ soundname = "keysound";
+ break;
+ default:
+ soundname = "alarm";
+
+ }
- if ( fd >= 0 ) {
- ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound );
- ::close ( fd );
+ Sound snd ( soundname );
+
+ if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) {
+ if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) {
+ Config cfg ( "qpe" );
+ cfg. setGroup ( "Volume" );
+
+ int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 );
+ if ( volalarm < 0 )
+ volalarm = 0;
+ else if ( volalarm > 100 )
+ volalarm = 100;
+ volalarm |= ( volalarm << 8 );
+
+ if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 )
+ vol_reset = true;
+ }
+ }
+
+ snd. play ( );
+ while ( !snd. isFinished ( ))
+ qApp-> processEvents ( );
+
+ if ( fd >= 0 ) {
+ if ( vol_reset )
+ ::ioctl ( fd, MIXER_WRITE( 0 ), &vol );
+ ::close ( fd );
+ }
+ break;
}
+ default:{ // Devices with buzzer
+ int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK );
+
+ if ( fd >= 0 ) {
+ ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound );
+ ::close ( fd );
+ }
+ }
+ }
+#endif
}