summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--config.in9
-rw-r--r--libopie/odevice.cpp197
-rw-r--r--libopie/odevice.h6
3 files changed, 211 insertions, 1 deletions
diff --git a/config.in b/config.in
index 6b63da1..57036a9 100644
--- a/config.in
+++ b/config.in
@@ -27,13 +27,16 @@ choice
boolean "Sharp Zaurus SL-5x00 - stock"
# config TARGET_OZ
# boolean "Sharp Zaurus SL-5x00 - OpenZaurus"
config TARGET_IPAQ
- boolean "Ipaq"
+ boolean "iPAQ"
+
+ config TARGET_RAMSES
+ boolean "Ramses"
endchoice
config OPTIMIZE
boolean "Use optimizations"
default "y" if ! TARGET_X86
@@ -53,24 +56,28 @@ config SPECFILE
default "linux-g++" if TARGET_X86 && X11
default "qws/linux-sharp-g++" if TARGET_SHARP && (! X11)
default "linux-g++" if TARGET_SHARP && X11
# default "linux-oz-g++" if TARGET_OZ
default "qws/linux-ipaq-g++" if TARGET_IPAQ && (! X11)
default "linux-g++" if TARGET_IPAQ && X11
+ default "qws/linux-ramses-g++" if TARGET_RAMSES && (! X11)
+ default "linux-g++" if TARGET_RAMSES && X11
config CUSTOMFILE
string
default "custom-ipaq.h" if TARGET_IPAQ
default "custom-sharp.h" if TARGET_SHARP
+ default "custom-ramses.h" if TARGET_RAMSES
config OPTIMIZATIONS
string "Optimization flags"
depends OPTIMIZE
default "-march=armv4 -mtune=strongarm1100 -mapcs-32 -fexpensive-optimizations -fomit-frame-pointer -O2" if TARGET_IPAQ
default "-march=armv4 -mtune=strongarm1100 -mapcs-32 -fexpensive-optimizations -fomit-frame-pointer -O2" if TARGET_SHARP
+ default "-march=armv4 -mtune=strongarm1100 -mapcs-32 -fexpensive-optimizations -fomit-frame-pointer -O2" if TARGET_RAMSES
#config CROSS
# string "Crosscompilation prefix"
# default "arm-linux-"
# help
# Crosscompilation prefix is the prefix which will be prepended
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp
index f0429d4..d86654e 100644
--- a/libopie/odevice.cpp
+++ b/libopie/odevice.cpp
@@ -158,12 +158,31 @@ protected:
int m_power_timer;
OLedState m_leds [1]; //FIXME check if really only one
};
+class Ramses : public ODevice, public QWSServer::KeyboardFilter {
+protected:
+ virtual void init ( );
+ virtual void initButtons ( );
+
+public:
+ virtual bool setSoftSuspend ( bool soft );
+
+ virtual bool setDisplayStatus( bool on );
+ virtual bool setDisplayBrightness ( int b );
+ virtual int displayBrightnessResolution ( ) const;
+
+protected:
+ virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat );
+ virtual void timerEvent ( QTimerEvent *te );
+
+ int m_power_timer;
+};
+
struct i_button {
uint model;
Qt::Key code;
char *utext;
char *pix;
char *fpressedservice;
@@ -319,12 +338,34 @@ struct s_button {
"devicebuttons/simpad_upper_lower",
"QPE/Launcher", "home()",
"buttonsettings", "raise()" },
*/
};
+struct r_button {
+ uint model;
+ Qt::Key code;
+ char *utext;
+ char *pix;
+ char *fpressedservice;
+ char *fpressedaction;
+ char *fheldservice;
+ char *fheldaction;
+} ramses_buttons [] = {
+ { Model_Ramses_MNCI,
+ Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
+ "devicebuttons/simpad_menu",
+ "QPE/TaskBar", "toggleMenu()",
+ "QPE/TaskBar", "toggleStartMenu()" },
+ { Model_Ramses_MNCI,
+ Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
+ "devicebuttons/ipaq_home",
+ "QPE/Launcher", "home()",
+ "buttonsettings", "raise()" },
+};
+
static QCString makeChannel ( const char *str )
{
if ( str && !::strchr ( str, '/' ))
return QCString ( "QPE/Application/" ) + str;
else
return str;
@@ -343,12 +384,14 @@ ODevice *ODevice::inst ( )
if ( QFile::exists ( "/proc/hal/model" ))
dev = new iPAQ ( );
else if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" ))
dev = new Zaurus ( );
else if ( QFile::exists ( "/proc/ucb1x00" ) && QFile::exists ( "/proc/cs3" ))
dev = new SIMpad ( );
+ else if ( QFile::exists ( "/proc/sys/board/name" ))
+ dev = new Ramses ( );
else
dev = new ODevice ( );
dev-> init ( );
}
return dev;
@@ -1841,6 +1884,160 @@ int SIMpad::displayBrightnessResolution ( ) const
default:
return 2;
}
}
+/**************************************************
+ *
+ * Ramses
+ *
+ **************************************************/
+
+void Ramses::init ( )
+{
+ d->m_vendorstr = "M und N";
+ d->m_vendor = Vendor_MundN;
+
+ QFile f( "/proc/sys/board/ramses" );
+
+ d->m_modelstr = "Ramses";
+ d->m_model = Model_Ramses_MNCI;
+
+ d->m_rotation = Rot180;
+ d->m_direction = CCW;
+ d->m_holdtime = 1000;
+
+ f.setName( "/etc/oz_version" );
+
+ if ( f.open( IO_ReadOnly )) {
+ d->m_systemstr = "OpenEmbedded/Ramses";
+ d->m_system = System_OpenZaurus;
+
+ QTextStream ts ( &f );
+ ts.setDevice ( &f );
+ d->m_sysverstr = ts.readLine ( );
+ f.close ( );
+ }
+
+ m_power_timer = 0;
+
+}
+
+void Ramses::initButtons ( )
+{
+ if ( d->m_buttons )
+ return;
+
+ if ( isQWS( ) )
+ QWSServer::setKeyboardFilter ( this );
+
+ d->m_buttons = new QValueList <ODeviceButton>;
+
+ for ( uint i = 0; i < ( sizeof( ramses_buttons ) / sizeof( s_button )); i++ ) {
+ r_button *rb = ramses_buttons + i;
+ ODeviceButton b;
+
+ if (( rb->model & d->m_model ) == d->m_model ) {
+ b.setKeycode( rb->code );
+ b.setUserText( QObject::tr ( "Button", rb->utext ));
+ b.setPixmap( Resource::loadPixmap ( rb->pix ));
+ b.setFactoryPresetPressedAction( OQCopMessage ( makeChannel ( rb->fpressedservice ), rb->fpressedaction ));
+ b.setFactoryPresetHeldAction( OQCopMessage ( makeChannel ( rb->fheldservice ), rb->fheldaction ));
+
+ d->m_buttons->append( b );
+ }
+ }
+ reloadButtonMapping();
+
+ QCopChannel *sysch = new QCopChannel ( "QPE/System", this );
+ connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & )));
+}
+
+bool Ramses::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat )
+{
+ //TODO
+ return false;
+}
+
+void Ramses::timerEvent ( QTimerEvent * )
+{
+ killTimer ( m_power_timer );
+ m_power_timer = 0;
+ QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false );
+ QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false );
+}
+
+
+bool Ramses::setSoftSuspend ( bool soft )
+{
+ bool res = false;
+ int fd;
+
+ if ((( fd = ::open ( "/dev/apm_bios", O_RDWR )) >= 0 ) ||
+ (( fd = ::open ( "/dev/misc/apm_bios",O_RDWR )) >= 0 )) {
+
+ int sources = ::ioctl ( fd, APM_IOCGEVTSRC, 0 ); // get current event sources
+
+ if ( sources >= 0 ) {
+ if ( soft )
+ sources &= ~APM_EVT_POWER_BUTTON;
+ else
+ sources |= APM_EVT_POWER_BUTTON;
+
+ if ( ::ioctl ( fd, APM_IOCSEVTSRC, sources ) >= 0 ) // set new event sources
+ res = true;
+ else
+ perror ( "APM_IOCGEVTSRC" );
+ }
+ else
+ perror ( "APM_IOCGEVTSRC" );
+
+ ::close ( fd );
+ }
+ else
+ perror ( "/dev/apm_bios or /dev/misc/apm_bios" );
+
+ return res;
+}
+
+/**
+ * This sets the display on or off
+ */
+bool Ramses::setDisplayStatus ( bool on )
+{
+ bool res = false;
+ int fd;
+
+ if (( fd = ::open ( "/dev/fb/0", O_RDWR )) >= 0 ) {
+ res = ( ::ioctl ( fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN ) == 0 );
+ ::close ( fd );
+ }
+ return res;
+}
+
+
+bool Ramses::setDisplayBrightness ( int bright )
+{
+ qDebug( "ODevice for Ramses: setDisplayBrightness( %d )", bright );
+ bool res = false;
+ int fd;
+
+ if ( bright > 255 )
+ bright = 100;
+ if ( bright < 0 )
+ bright = 0;
+
+ if (( fd = ::open ( "/proc/sys/board/pwm0", O_WRONLY )) >= 0 ) {
+ char writeCommand[100];
+ const int count = sprintf( writeCommand, "%d\n", bright);
+ res = ( ::write ( fd, writeCommand, count ) != -1 );
+ ::close ( fd );
+ }
+ return res;
+}
+
+
+int Ramses::displayBrightnessResolution ( ) const
+{
+ return 100;
+}
diff --git a/libopie/odevice.h b/libopie/odevice.h
index dcdd4a8..5829440 100644
--- a/libopie/odevice.h
+++ b/libopie/odevice.h
@@ -61,23 +61,29 @@ enum OModel {
Model_SIMpad_All = ( Model_SIMpad | 0xffffff ),
Model_SIMpad_CL4 = ( Model_SIMpad | 0x000001 ),
Model_SIMpad_SL4 = ( Model_SIMpad | 0x000002 ),
Model_SIMpad_SLC = ( Model_SIMpad | 0x000004 ),
Model_SIMpad_TSinus = ( Model_SIMpad | 0x000008 ),
+
+ Model_Ramses = ( 4 << 24 ),
+
+ Model_Ramses_All = ( Model_Ramses | 0xffffff ),
+ Model_Ramses_MNCI = ( Model_Ramses | 0x000001 ),
};
/**
* The vendor of the device
*/
enum OVendor {
Vendor_Unknown,
Vendor_HP,
Vendor_Sharp,
Vendor_SIEMENS,
+ Vendor_MundN,
};
/**
* The System used
*/
enum OSystem {