00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #include "odevice_ramses.h"
00032
00033
00034 #include <qapplication.h>
00035 #include <qfile.h>
00036 #include <qtextstream.h>
00037 #include <qwindowsystem_qws.h>
00038
00039
00040 #include <qpe/config.h>
00041 #include <qpe/sound.h>
00042 #include <qpe/qcopenvelope_qws.h>
00043
00044
00045 #include <fcntl.h>
00046 #include <math.h>
00047 #include <stdlib.h>
00048 #include <signal.h>
00049 #include <sys/ioctl.h>
00050 #include <sys/time.h>
00051 #include <unistd.h>
00052 #ifndef QT_NO_SOUND
00053 #include <linux/soundcard.h>
00054 #endif
00055
00056 using namespace Opie::Core;
00057 using namespace Opie::Core::Internal;
00058
00059
00060 void Ramses::init(const QString&)
00061 {
00062 d->m_vendorstr = "M und N";
00063 d->m_vendor = Vendor_MundN;
00064
00065
00066
00067
00068
00069
00070
00071 d->m_modelstr = "MNCIRX";
00072 d->m_model = Model_Ramses_MNCIRX;
00073 d->m_rotation = Rot90;
00074
00075 d->m_holdtime = 500;
00076
00077
00078
00079
00080 #ifdef QT_QWS_ALLOW_OVERCLOCK
00081 #define OC(x...) x
00082 #else
00083 #define OC(x...)
00084 #endif
00085
00086 d->m_cpu_frequencies->append("99000");
00087 OC(d->m_cpu_frequencies->append("118000"); )
00088 d->m_cpu_frequencies->append("199100");
00089 OC(d->m_cpu_frequencies->append("236000"); )
00090 d->m_cpu_frequencies->append("298600");
00091 OC(d->m_cpu_frequencies->append("354000"); )
00092 d->m_cpu_frequencies->append("398099");
00093 d->m_cpu_frequencies->append("398100");
00094 OC(d->m_cpu_frequencies->append("471000"); )
00095 }
00096
00097
00098 void Ramses::playAlarmSound()
00099 {
00100 #ifndef QT_NO_SOUND
00101 static Sound snd ( "alarm" );
00102 if(!snd.isFinished())
00103 return;
00104
00105 changeMixerForAlarm( 0, "/dev/sound/mixer" , &snd);
00106 snd.play();
00107 #endif
00108 }
00109
00110
00111 bool Ramses::suspend()
00112 {
00113 if ( !isQWS( ) )
00114 return false;
00115
00116 sendSuspendmsg();
00117 ::sync();
00118
00119 int fd;
00120 if ((fd = ::open("/proc/sys/pm/suspend", O_WRONLY)) >= 0) {
00121 char writeCommand[] = "1\n";
00122 ::write(fd, writeCommand, sizeof(writeCommand) );
00123 ::close(fd);
00124 }
00125
00126 ::usleep ( 200 * 1000 );
00127 return true;
00128 }
00129
00130
00131 bool Ramses::setDisplayBrightness(int bright)
00132 {
00133
00134 bool res = false;
00135 int fd;
00136
00137
00138
00139 if (bright > 255 )
00140 bright = 255;
00141 if (bright < 0)
00142 bright = 0;
00143
00144
00145 if ((fd = ::open("/proc/sys/board/lcd_backlight", O_WRONLY)) >= 0) {
00146 char writeCommand[10];
00147 const int count = sprintf(writeCommand, "%d\n", bright ? 1 : 0);
00148 res = (::write(fd, writeCommand, count) != -1);
00149 ::close(fd);
00150 }
00151
00152 if ((fd = ::open("/proc/sys/board/lcd_brightness", O_WRONLY)) >= 0) {
00153 char writeCommand[10];
00154 const int count = sprintf(writeCommand, "%d\n", bright);
00155 res = (::write(fd, writeCommand, count) != -1);
00156 ::close(fd);
00157 }
00158 return res;
00159 }
00160
00161
00162 int Ramses::displayBrightnessResolution() const
00163 {
00164 return 32;
00165 }
00166
00167
00168