summaryrefslogtreecommitdiff
authorschurig <schurig>2003-06-02 11:12:03 (UTC)
committer schurig <schurig>2003-06-02 11:12:03 (UTC)
commit2d6bec942d8b9b8b50639cb4ffe58cf24d5a255b (patch) (unidiff)
tree5b917d74d600715ad1223f174a9b672d822caf47
parent68a88060627137e8cb424c758c1339f1ed5c6eac (diff)
downloadopie-2d6bec942d8b9b8b50639cb4ffe58cf24d5a255b.zip
opie-2d6bec942d8b9b8b50639cb4ffe58cf24d5a255b.tar.gz
opie-2d6bec942d8b9b8b50639cb4ffe58cf24d5a255b.tar.bz2
new Ramses target
Diffstat (more/less context) (ignore 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
@@ -25,17 +25,20 @@ choice
25 25
26 config TARGET_SHARP 26 config TARGET_SHARP
27 boolean "Sharp Zaurus SL-5x00 - stock" 27 boolean "Sharp Zaurus SL-5x00 - stock"
28 28
29# config TARGET_OZ 29# config TARGET_OZ
30# boolean "Sharp Zaurus SL-5x00 - OpenZaurus" 30# boolean "Sharp Zaurus SL-5x00 - OpenZaurus"
31 31
32 config TARGET_IPAQ 32 config TARGET_IPAQ
33 boolean "Ipaq" 33 boolean "iPAQ"
34
35 config TARGET_RAMSES
36 boolean "Ramses"
34 37
35endchoice 38endchoice
36 39
37config OPTIMIZE 40config OPTIMIZE
38 boolean "Use optimizations" 41 boolean "Use optimizations"
39 default "y" if ! TARGET_X86 42 default "y" if ! TARGET_X86
40 43
41config DEBUG 44config DEBUG
@@ -51,28 +54,32 @@ config SPECFILE
51 string 54 string
52 default "qws/linux-generic-g++" if TARGET_X86 && (! X11) 55 default "qws/linux-generic-g++" if TARGET_X86 && (! X11)
53 default "linux-g++" if TARGET_X86 && X11 56 default "linux-g++" if TARGET_X86 && X11
54 default "qws/linux-sharp-g++" if TARGET_SHARP && (! X11) 57 default "qws/linux-sharp-g++" if TARGET_SHARP && (! X11)
55 default "linux-g++" if TARGET_SHARP && X11 58 default "linux-g++" if TARGET_SHARP && X11
56# default "linux-oz-g++" if TARGET_OZ 59# default "linux-oz-g++" if TARGET_OZ
57 default "qws/linux-ipaq-g++" if TARGET_IPAQ && (! X11) 60 default "qws/linux-ipaq-g++" if TARGET_IPAQ && (! X11)
58 default "linux-g++" if TARGET_IPAQ && X11 61 default "linux-g++" if TARGET_IPAQ && X11
62 default "qws/linux-ramses-g++" if TARGET_RAMSES && (! X11)
63 default "linux-g++" if TARGET_RAMSES && X11
59 64
60config CUSTOMFILE 65config CUSTOMFILE
61 string 66 string
62 default "custom-ipaq.h" if TARGET_IPAQ 67 default "custom-ipaq.h" if TARGET_IPAQ
63 default "custom-sharp.h" if TARGET_SHARP 68 default "custom-sharp.h" if TARGET_SHARP
69 default "custom-ramses.h" if TARGET_RAMSES
64 70
65 71
66config OPTIMIZATIONS 72config OPTIMIZATIONS
67 string "Optimization flags" 73 string "Optimization flags"
68 depends OPTIMIZE 74 depends OPTIMIZE
69 default "-march=armv4 -mtune=strongarm1100 -mapcs-32 -fexpensive-optimizations -fomit-frame-pointer -O2" if TARGET_IPAQ 75 default "-march=armv4 -mtune=strongarm1100 -mapcs-32 -fexpensive-optimizations -fomit-frame-pointer -O2" if TARGET_IPAQ
70 default "-march=armv4 -mtune=strongarm1100 -mapcs-32 -fexpensive-optimizations -fomit-frame-pointer -O2" if TARGET_SHARP 76 default "-march=armv4 -mtune=strongarm1100 -mapcs-32 -fexpensive-optimizations -fomit-frame-pointer -O2" if TARGET_SHARP
77 default "-march=armv4 -mtune=strongarm1100 -mapcs-32 -fexpensive-optimizations -fomit-frame-pointer -O2" if TARGET_RAMSES
71 78
72#config CROSS 79#config CROSS
73# string "Crosscompilation prefix" 80# string "Crosscompilation prefix"
74# default "arm-linux-" 81# default "arm-linux-"
75# help 82# help
76# Crosscompilation prefix is the prefix which will be prepended 83# Crosscompilation prefix is the prefix which will be prepended
77# to all compilation commands. For example, a crosscompilation prefix 84# to all compilation commands. For example, a crosscompilation prefix
78# of arm-linux-, results in the build calling arm-linux-gcc as its CC. 85# of arm-linux-, results in the build calling arm-linux-gcc as its CC.
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp
index f0429d4..d86654e 100644
--- a/libopie/odevice.cpp
+++ b/libopie/odevice.cpp
@@ -156,16 +156,35 @@ protected:
156 virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); 156 virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat );
157 virtual void timerEvent ( QTimerEvent *te ); 157 virtual void timerEvent ( QTimerEvent *te );
158 158
159 int m_power_timer; 159 int m_power_timer;
160 160
161 OLedState m_leds [1]; //FIXME check if really only one 161 OLedState m_leds [1]; //FIXME check if really only one
162}; 162};
163 163
164class Ramses : public ODevice, public QWSServer::KeyboardFilter {
165protected:
166 virtual void init ( );
167 virtual void initButtons ( );
168
169public:
170 virtual bool setSoftSuspend ( bool soft );
171
172 virtual bool setDisplayStatus( bool on );
173 virtual bool setDisplayBrightness ( int b );
174 virtual int displayBrightnessResolution ( ) const;
175
176protected:
177 virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat );
178 virtual void timerEvent ( QTimerEvent *te );
179
180 int m_power_timer;
181};
182
164struct i_button { 183struct i_button {
165 uint model; 184 uint model;
166 Qt::Key code; 185 Qt::Key code;
167 char *utext; 186 char *utext;
168 char *pix; 187 char *pix;
169 char *fpressedservice; 188 char *fpressedservice;
170 char *fpressedaction; 189 char *fpressedaction;
171 char *fheldservice; 190 char *fheldservice;
@@ -317,16 +336,38 @@ struct s_button {
317 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, 336 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
318 Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Lower+Upper"), 337 Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Lower+Upper"),
319 "devicebuttons/simpad_upper_lower", 338 "devicebuttons/simpad_upper_lower",
320 "QPE/Launcher", "home()", 339 "QPE/Launcher", "home()",
321 "buttonsettings", "raise()" }, 340 "buttonsettings", "raise()" },
322 */ 341 */
323}; 342};
324 343
344struct r_button {
345 uint model;
346 Qt::Key code;
347 char *utext;
348 char *pix;
349 char *fpressedservice;
350 char *fpressedaction;
351 char *fheldservice;
352 char *fheldaction;
353} ramses_buttons [] = {
354 { Model_Ramses_MNCI,
355 Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
356 "devicebuttons/simpad_menu",
357 "QPE/TaskBar", "toggleMenu()",
358 "QPE/TaskBar", "toggleStartMenu()" },
359 { Model_Ramses_MNCI,
360 Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
361 "devicebuttons/ipaq_home",
362 "QPE/Launcher", "home()",
363 "buttonsettings", "raise()" },
364};
365
325static QCString makeChannel ( const char *str ) 366static QCString makeChannel ( const char *str )
326{ 367{
327 if ( str && !::strchr ( str, '/' )) 368 if ( str && !::strchr ( str, '/' ))
328 return QCString ( "QPE/Application/" ) + str; 369 return QCString ( "QPE/Application/" ) + str;
329 else 370 else
330 return str; 371 return str;
331} 372}
332 373
@@ -341,16 +382,18 @@ ODevice *ODevice::inst ( )
341 382
342 if ( !dev ) { 383 if ( !dev ) {
343 if ( QFile::exists ( "/proc/hal/model" )) 384 if ( QFile::exists ( "/proc/hal/model" ))
344 dev = new iPAQ ( ); 385 dev = new iPAQ ( );
345 else if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" )) 386 else if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" ))
346 dev = new Zaurus ( ); 387 dev = new Zaurus ( );
347 else if ( QFile::exists ( "/proc/ucb1x00" ) && QFile::exists ( "/proc/cs3" )) 388 else if ( QFile::exists ( "/proc/ucb1x00" ) && QFile::exists ( "/proc/cs3" ))
348 dev = new SIMpad ( ); 389 dev = new SIMpad ( );
390 else if ( QFile::exists ( "/proc/sys/board/name" ))
391 dev = new Ramses ( );
349 else 392 else
350 dev = new ODevice ( ); 393 dev = new ODevice ( );
351 394
352 dev-> init ( ); 395 dev-> init ( );
353 } 396 }
354 return dev; 397 return dev;
355} 398}
356 399
@@ -1839,8 +1882,162 @@ int SIMpad::displayBrightnessResolution ( ) const
1839 case Model_SIMpad_TSinus: 1882 case Model_SIMpad_TSinus:
1840 return 255; //TODO find out if this is save 1883 return 255; //TODO find out if this is save
1841 1884
1842 default: 1885 default:
1843 return 2; 1886 return 2;
1844 } 1887 }
1845} 1888}
1846 1889
1890/**************************************************
1891 *
1892 * Ramses
1893 *
1894 **************************************************/
1895
1896void Ramses::init ( )
1897{
1898 d->m_vendorstr = "M und N";
1899 d->m_vendor = Vendor_MundN;
1900
1901 QFile f( "/proc/sys/board/ramses" );
1902
1903 d->m_modelstr = "Ramses";
1904 d->m_model = Model_Ramses_MNCI;
1905
1906 d->m_rotation = Rot180;
1907 d->m_direction = CCW;
1908 d->m_holdtime = 1000;
1909
1910 f.setName( "/etc/oz_version" );
1911
1912 if ( f.open( IO_ReadOnly )) {
1913 d->m_systemstr = "OpenEmbedded/Ramses";
1914 d->m_system = System_OpenZaurus;
1915
1916 QTextStream ts ( &f );
1917 ts.setDevice ( &f );
1918 d->m_sysverstr = ts.readLine ( );
1919 f.close ( );
1920 }
1921
1922 m_power_timer = 0;
1923
1924}
1925
1926void Ramses::initButtons ( )
1927{
1928 if ( d->m_buttons )
1929 return;
1930
1931 if ( isQWS( ) )
1932 QWSServer::setKeyboardFilter ( this );
1933
1934 d->m_buttons = new QValueList <ODeviceButton>;
1935
1936 for ( uint i = 0; i < ( sizeof( ramses_buttons ) / sizeof( s_button )); i++ ) {
1937 r_button *rb = ramses_buttons + i;
1938 ODeviceButton b;
1939
1940 if (( rb->model & d->m_model ) == d->m_model ) {
1941 b.setKeycode( rb->code );
1942 b.setUserText( QObject::tr ( "Button", rb->utext ));
1943 b.setPixmap( Resource::loadPixmap ( rb->pix ));
1944 b.setFactoryPresetPressedAction( OQCopMessage ( makeChannel ( rb->fpressedservice ), rb->fpressedaction ));
1945 b.setFactoryPresetHeldAction( OQCopMessage ( makeChannel ( rb->fheldservice ), rb->fheldaction ));
1946
1947 d->m_buttons->append( b );
1948 }
1949 }
1950 reloadButtonMapping();
1951
1952 QCopChannel *sysch = new QCopChannel ( "QPE/System", this );
1953 connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & )));
1954}
1955
1956bool Ramses::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat )
1957{
1958 //TODO
1959 return false;
1960}
1961
1962void Ramses::timerEvent ( QTimerEvent * )
1963{
1964 killTimer ( m_power_timer );
1965 m_power_timer = 0;
1966 QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false );
1967 QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false );
1968}
1969
1970
1971bool Ramses::setSoftSuspend ( bool soft )
1972{
1973 bool res = false;
1974 int fd;
1975
1976 if ((( fd = ::open ( "/dev/apm_bios", O_RDWR )) >= 0 ) ||
1977 (( fd = ::open ( "/dev/misc/apm_bios",O_RDWR )) >= 0 )) {
1978
1979 int sources = ::ioctl ( fd, APM_IOCGEVTSRC, 0 ); // get current event sources
1980
1981 if ( sources >= 0 ) {
1982 if ( soft )
1983 sources &= ~APM_EVT_POWER_BUTTON;
1984 else
1985 sources |= APM_EVT_POWER_BUTTON;
1986
1987 if ( ::ioctl ( fd, APM_IOCSEVTSRC, sources ) >= 0 ) // set new event sources
1988 res = true;
1989 else
1990 perror ( "APM_IOCGEVTSRC" );
1991 }
1992 else
1993 perror ( "APM_IOCGEVTSRC" );
1994
1995 ::close ( fd );
1996 }
1997 else
1998 perror ( "/dev/apm_bios or /dev/misc/apm_bios" );
1999
2000 return res;
2001}
2002
2003/**
2004 * This sets the display on or off
2005 */
2006bool Ramses::setDisplayStatus ( bool on )
2007{
2008 bool res = false;
2009 int fd;
2010
2011 if (( fd = ::open ( "/dev/fb/0", O_RDWR )) >= 0 ) {
2012 res = ( ::ioctl ( fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN ) == 0 );
2013 ::close ( fd );
2014 }
2015 return res;
2016}
2017
2018
2019bool Ramses::setDisplayBrightness ( int bright )
2020{
2021 qDebug( "ODevice for Ramses: setDisplayBrightness( %d )", bright );
2022 bool res = false;
2023 int fd;
2024
2025 if ( bright > 255 )
2026 bright = 100;
2027 if ( bright < 0 )
2028 bright = 0;
2029
2030 if (( fd = ::open ( "/proc/sys/board/pwm0", O_WRONLY )) >= 0 ) {
2031 char writeCommand[100];
2032 const int count = sprintf( writeCommand, "%d\n", bright);
2033 res = ( ::write ( fd, writeCommand, count ) != -1 );
2034 ::close ( fd );
2035 }
2036 return res;
2037}
2038
2039
2040int Ramses::displayBrightnessResolution ( ) const
2041{
2042 return 100;
2043}
diff --git a/libopie/odevice.h b/libopie/odevice.h
index dcdd4a8..5829440 100644
--- a/libopie/odevice.h
+++ b/libopie/odevice.h
@@ -59,27 +59,33 @@ enum OModel {
59 59
60 Model_SIMpad = ( 3 << 24 ), 60 Model_SIMpad = ( 3 << 24 ),
61 61
62 Model_SIMpad_All = ( Model_SIMpad | 0xffffff ), 62 Model_SIMpad_All = ( Model_SIMpad | 0xffffff ),
63 Model_SIMpad_CL4 = ( Model_SIMpad | 0x000001 ), 63 Model_SIMpad_CL4 = ( Model_SIMpad | 0x000001 ),
64 Model_SIMpad_SL4 = ( Model_SIMpad | 0x000002 ), 64 Model_SIMpad_SL4 = ( Model_SIMpad | 0x000002 ),
65 Model_SIMpad_SLC = ( Model_SIMpad | 0x000004 ), 65 Model_SIMpad_SLC = ( Model_SIMpad | 0x000004 ),
66 Model_SIMpad_TSinus = ( Model_SIMpad | 0x000008 ), 66 Model_SIMpad_TSinus = ( Model_SIMpad | 0x000008 ),
67
68 Model_Ramses = ( 4 << 24 ),
69
70 Model_Ramses_All = ( Model_Ramses | 0xffffff ),
71 Model_Ramses_MNCI = ( Model_Ramses | 0x000001 ),
67}; 72};
68 73
69/** 74/**
70 * The vendor of the device 75 * The vendor of the device
71 */ 76 */
72enum OVendor { 77enum OVendor {
73 Vendor_Unknown, 78 Vendor_Unknown,
74 79
75 Vendor_HP, 80 Vendor_HP,
76 Vendor_Sharp, 81 Vendor_Sharp,
77 Vendor_SIEMENS, 82 Vendor_SIEMENS,
83 Vendor_MundN,
78}; 84};
79 85
80/** 86/**
81 * The System used 87 * The System used
82 */ 88 */
83enum OSystem { 89enum OSystem {
84 System_Unknown, 90 System_Unknown,
85 91