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
@@ -1,166 +1,173 @@
1mainmenu "Opie Configuration" 1mainmenu "Opie Configuration"
2menu "Build Parameters" 2menu "Build Parameters"
3 3
4#choice 4#choice
5# prompt "Build Processor family" 5# prompt "Build Processor family"
6# default BUILD_X86 6# default BUILD_X86
7# help 7# help
8# Please select the architecture of the machine you will be 8# Please select the architecture of the machine you will be
9# building the OpenZaurus buildroot on. 9# building the OpenZaurus buildroot on.
10# 10#
11# config BUILD_X86 11# config BUILD_X86
12# boolean "X86 Architecture" 12# boolean "X86 Architecture"
13# 13#
14#endchoice 14#endchoice
15 15
16choice 16choice
17 prompt "Target Machine" 17 prompt "Target Machine"
18 default TARGET_X86 18 default TARGET_X86
19 help 19 help
20 Please select the architecture of the machine you will be 20 Please select the architecture of the machine you will be
21 building the OpenZaurus buildroot for. 21 building the OpenZaurus buildroot for.
22 22
23 config TARGET_X86 23 config TARGET_X86
24 boolean "Intel X86" 24 boolean "Intel X86"
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
42 boolean "Enable debug builds" 45 boolean "Enable debug builds"
43 default n 46 default n
44 47
45 config RELEASE 48 config RELEASE
46 bool 49 bool
47 default y 50 default y
48 depends ! DEBUG 51 depends ! DEBUG
49 52
50config SPECFILE 53config 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.
79 86
80config EXPERIMENTAL 87config EXPERIMENTAL
81 bool "Prompt for development and/or incomplete items" 88 bool "Prompt for development and/or incomplete items"
82 default y 89 default y
83 90
84endmenu 91endmenu
85 92
86menu "Base" 93menu "Base"
87 choice 94 choice
88 prompt "Qpe Library Selection" 95 prompt "Qpe Library Selection"
89 default LIBQPE 96 default LIBQPE
90 97
91 source library/config.in 98 source library/config.in
92 source x11/config.in 99 source x11/config.in
93 endchoice 100 endchoice
94 source libopie/config.in 101 source libopie/config.in
95 source core/opie-login/config.in 102 source core/opie-login/config.in
96 source core/opiealarm/config.in 103 source core/opiealarm/config.in
97 source core/launcher/config.in 104 source core/launcher/config.in
98 source core/qws/config.in 105 source core/qws/config.in
99endmenu 106endmenu
100 107
101comment "" 108comment ""
102 109
103#config APPLETS 110#config APPLETS
104# bool "Applets" 111# bool "Applets"
105# default "y" 112# default "y"
106 113
107menu "Applets" 114menu "Applets"
108# depends APPLETS 115# depends APPLETS
109 116
110 source core/applets/config.in 117 source core/applets/config.in
111 source noncore/applets/config.in 118 source noncore/applets/config.in
112endmenu 119endmenu
113 120
114#config APPS 121#config APPS
115# bool "Apps" 122# bool "Apps"
116# default "y" 123# default "y"
117 124
118menu "Apps" 125menu "Apps"
119# depends APPS 126# depends APPS
120 127
121 source core/apps/config.in 128 source core/apps/config.in
122 source noncore/apps/config.in 129 source noncore/apps/config.in
123endmenu 130endmenu
124 131
125menu "Communications and Networking" 132menu "Communications and Networking"
126 source noncore/comm/config.in 133 source noncore/comm/config.in
127 source noncore/mail/config.in 134 source noncore/mail/config.in
128 source noncore/net/config.in 135 source noncore/net/config.in
129endmenu 136endmenu
130menu "Games" 137menu "Games"
131 source noncore/games/config.in 138 source noncore/games/config.in
132endmenu 139endmenu
133menu "Graphics and Multimedia" 140menu "Graphics and Multimedia"
134 source freetype/config.in 141 source freetype/config.in
135 source noncore/graphics/config.in 142 source noncore/graphics/config.in
136 source core/multimedia/config.in 143 source core/multimedia/config.in
137 source noncore/multimedia/config.in 144 source noncore/multimedia/config.in
138endmenu 145endmenu
139menu "Input methods" 146menu "Input methods"
140 source inputmethods/config.in 147 source inputmethods/config.in
141endmenu 148endmenu
142menu "Pim" 149menu "Pim"
143 source core/pim/config.in 150 source core/pim/config.in
144 menu "Today Plugins" 151 menu "Today Plugins"
145 source noncore/todayplugins/config.in 152 source noncore/todayplugins/config.in
146 source core/pim/today/plugins/config.in 153 source core/pim/today/plugins/config.in
147 endmenu 154 endmenu
148endmenu 155endmenu
149menu "Settings" 156menu "Settings"
150 source core/settings/config.in 157 source core/settings/config.in
151 source noncore/settings/config.in 158 source noncore/settings/config.in
152endmenu 159endmenu
153menu "Theming" 160menu "Theming"
154 source noncore/decorations/config.in 161 source noncore/decorations/config.in
155 source noncore/styles/config.in 162 source noncore/styles/config.in
156endmenu 163endmenu
157menu "Tools" 164menu "Tools"
158 source noncore/tools/config.in 165 source noncore/tools/config.in
159 source development/config.in 166 source development/config.in
160endmenu 167endmenu
161comment "" 168comment ""
162 depends on EXPERIMENTAL 169 depends on EXPERIMENTAL
163menu "Experimental" 170menu "Experimental"
164 depends on EXPERIMENTAL 171 depends on EXPERIMENTAL
165 source libopie2/config.in 172 source libopie2/config.in
166endmenu 173endmenu
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp
index f0429d4..d86654e 100644
--- a/libopie/odevice.cpp
+++ b/libopie/odevice.cpp
@@ -68,377 +68,420 @@ public:
68 QString m_sysverstr; 68 QString m_sysverstr;
69 69
70 Transformation m_rotation; 70 Transformation m_rotation;
71 ODirection m_direction; 71 ODirection m_direction;
72 72
73 QValueList <ODeviceButton> *m_buttons; 73 QValueList <ODeviceButton> *m_buttons;
74 uint m_holdtime; 74 uint m_holdtime;
75}; 75};
76 76
77 77
78class iPAQ : public ODevice, public QWSServer::KeyboardFilter { 78class iPAQ : public ODevice, public QWSServer::KeyboardFilter {
79protected: 79protected:
80 virtual void init ( ); 80 virtual void init ( );
81 virtual void initButtons ( ); 81 virtual void initButtons ( );
82 82
83public: 83public:
84 virtual bool setSoftSuspend ( bool soft ); 84 virtual bool setSoftSuspend ( bool soft );
85 85
86 virtual bool setDisplayBrightness ( int b ); 86 virtual bool setDisplayBrightness ( int b );
87 virtual int displayBrightnessResolution ( ) const; 87 virtual int displayBrightnessResolution ( ) const;
88 88
89 virtual void alarmSound ( ); 89 virtual void alarmSound ( );
90 90
91 virtual QValueList <OLed> ledList ( ) const; 91 virtual QValueList <OLed> ledList ( ) const;
92 virtual QValueList <OLedState> ledStateList ( OLed led ) const; 92 virtual QValueList <OLedState> ledStateList ( OLed led ) const;
93 virtual OLedState ledState ( OLed led ) const; 93 virtual OLedState ledState ( OLed led ) const;
94 virtual bool setLedState ( OLed led, OLedState st ); 94 virtual bool setLedState ( OLed led, OLedState st );
95 95
96 virtual bool hasLightSensor ( ) const; 96 virtual bool hasLightSensor ( ) const;
97 virtual int readLightSensor ( ); 97 virtual int readLightSensor ( );
98 virtual int lightSensorResolution ( ) const; 98 virtual int lightSensorResolution ( ) const;
99 99
100protected: 100protected:
101 virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); 101 virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat );
102 virtual void timerEvent ( QTimerEvent *te ); 102 virtual void timerEvent ( QTimerEvent *te );
103 103
104 int m_power_timer; 104 int m_power_timer;
105 105
106 OLedState m_leds [2]; 106 OLedState m_leds [2];
107}; 107};
108 108
109class Zaurus : public ODevice { 109class Zaurus : public ODevice {
110protected: 110protected:
111 virtual void init ( ); 111 virtual void init ( );
112 virtual void initButtons ( ); 112 virtual void initButtons ( );
113 113
114public: 114public:
115 virtual bool setSoftSuspend ( bool soft ); 115 virtual bool setSoftSuspend ( bool soft );
116 116
117 virtual bool setDisplayBrightness ( int b ); 117 virtual bool setDisplayBrightness ( int b );
118 virtual int displayBrightnessResolution ( ) const; 118 virtual int displayBrightnessResolution ( ) const;
119 119
120 virtual void alarmSound ( ); 120 virtual void alarmSound ( );
121 virtual void keySound ( ); 121 virtual void keySound ( );
122 virtual void touchSound ( ); 122 virtual void touchSound ( );
123 123
124 virtual QValueList <OLed> ledList ( ) const; 124 virtual QValueList <OLed> ledList ( ) const;
125 virtual QValueList <OLedState> ledStateList ( OLed led ) const; 125 virtual QValueList <OLedState> ledStateList ( OLed led ) const;
126 virtual OLedState ledState ( OLed led ) const; 126 virtual OLedState ledState ( OLed led ) const;
127 virtual bool setLedState ( OLed led, OLedState st ); 127 virtual bool setLedState ( OLed led, OLedState st );
128 128
129protected: 129protected:
130 virtual void buzzer ( int snd ); 130 virtual void buzzer ( int snd );
131 131
132 OLedState m_leds [1]; 132 OLedState m_leds [1];
133}; 133};
134 134
135class SIMpad : public ODevice, public QWSServer::KeyboardFilter { 135class SIMpad : public ODevice, public QWSServer::KeyboardFilter {
136protected: 136protected:
137 virtual void init ( ); 137 virtual void init ( );
138 virtual void initButtons ( ); 138 virtual void initButtons ( );
139 139
140public: 140public:
141 virtual bool setSoftSuspend ( bool soft ); 141 virtual bool setSoftSuspend ( bool soft );
142 virtual bool suspend(); 142 virtual bool suspend();
143 143
144 virtual bool setDisplayStatus( bool on ); 144 virtual bool setDisplayStatus( bool on );
145 virtual bool setDisplayBrightness ( int b ); 145 virtual bool setDisplayBrightness ( int b );
146 virtual int displayBrightnessResolution ( ) const; 146 virtual int displayBrightnessResolution ( ) const;
147 147
148 virtual void alarmSound ( ); 148 virtual void alarmSound ( );
149 149
150 virtual QValueList <OLed> ledList ( ) const; 150 virtual QValueList <OLed> ledList ( ) const;
151 virtual QValueList <OLedState> ledStateList ( OLed led ) const; 151 virtual QValueList <OLedState> ledStateList ( OLed led ) const;
152 virtual OLedState ledState ( OLed led ) const; 152 virtual OLedState ledState ( OLed led ) const;
153 virtual bool setLedState ( OLed led, OLedState st ); 153 virtual bool setLedState ( OLed led, OLedState st );
154 154
155protected: 155protected:
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;
172 char *fheldaction; 191 char *fheldaction;
173} ipaq_buttons [] = { 192} ipaq_buttons [] = {
174 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx, 193 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx,
175 Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), 194 Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"),
176 "devicebuttons/ipaq_calendar", 195 "devicebuttons/ipaq_calendar",
177 "datebook", "nextView()", 196 "datebook", "nextView()",
178 "today", "raise()" }, 197 "today", "raise()" },
179 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx, 198 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx,
180 Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), 199 Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"),
181 "devicebuttons/ipaq_contact", 200 "devicebuttons/ipaq_contact",
182 "addressbook", "raise()", 201 "addressbook", "raise()",
183 "addressbook", "beamBusinessCard()" }, 202 "addressbook", "beamBusinessCard()" },
184 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx, 203 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx,
185 Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), 204 Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
186 "devicebuttons/ipaq_menu", 205 "devicebuttons/ipaq_menu",
187 "QPE/TaskBar", "toggleMenu()", 206 "QPE/TaskBar", "toggleMenu()",
188 "QPE/TaskBar", "toggleStartMenu()" }, 207 "QPE/TaskBar", "toggleStartMenu()" },
189 { Model_iPAQ_H38xx | Model_iPAQ_H39xx, 208 { Model_iPAQ_H38xx | Model_iPAQ_H39xx,
190 Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), 209 Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"),
191 "devicebuttons/ipaq_mail", 210 "devicebuttons/ipaq_mail",
192 "mail", "raise()", 211 "mail", "raise()",
193 "mail", "newMail()" }, 212 "mail", "newMail()" },
194 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx, 213 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx,
195 Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), 214 Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
196 "devicebuttons/ipaq_home", 215 "devicebuttons/ipaq_home",
197 "QPE/Launcher", "home()", 216 "QPE/Launcher", "home()",
198 "buttonsettings", "raise()" }, 217 "buttonsettings", "raise()" },
199 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx, 218 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx,
200 Qt::Key_F24, QT_TRANSLATE_NOOP("Button", "Record Button"), 219 Qt::Key_F24, QT_TRANSLATE_NOOP("Button", "Record Button"),
201 "devicebuttons/ipaq_record", 220 "devicebuttons/ipaq_record",
202 "QPE/VMemo", "toggleRecord()", 221 "QPE/VMemo", "toggleRecord()",
203 "sound", "raise()" }, 222 "sound", "raise()" },
204}; 223};
205 224
206struct z_button { 225struct z_button {
207 Qt::Key code; 226 Qt::Key code;
208 char *utext; 227 char *utext;
209 char *pix; 228 char *pix;
210 char *fpressedservice; 229 char *fpressedservice;
211 char *fpressedaction; 230 char *fpressedaction;
212 char *fheldservice; 231 char *fheldservice;
213 char *fheldaction; 232 char *fheldaction;
214} z_buttons [] = { 233} z_buttons [] = {
215 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), 234 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"),
216 "devicebuttons/z_calendar", 235 "devicebuttons/z_calendar",
217 "datebook", "nextView()", 236 "datebook", "nextView()",
218 "today", "raise()" }, 237 "today", "raise()" },
219 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), 238 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"),
220 "devicebuttons/z_contact", 239 "devicebuttons/z_contact",
221 "addressbook", "raise()", 240 "addressbook", "raise()",
222 "addressbook", "beamBusinessCard()" }, 241 "addressbook", "beamBusinessCard()" },
223 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), 242 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
224 "devicebuttons/z_home", 243 "devicebuttons/z_home",
225 "QPE/Launcher", "home()", 244 "QPE/Launcher", "home()",
226 "buttonsettings", "raise()" }, 245 "buttonsettings", "raise()" },
227 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), 246 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
228 "devicebuttons/z_menu", 247 "devicebuttons/z_menu",
229 "QPE/TaskBar", "toggleMenu()", 248 "QPE/TaskBar", "toggleMenu()",
230 "QPE/TaskBar", "toggleStartMenu()" }, 249 "QPE/TaskBar", "toggleStartMenu()" },
231 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), 250 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"),
232 "devicebuttons/z_mail", 251 "devicebuttons/z_mail",
233 "mail", "raise()", 252 "mail", "raise()",
234 "mail", "newMail()" }, 253 "mail", "newMail()" },
235}; 254};
236 255
237struct z_button z_buttons_c700 [] = { 256struct z_button z_buttons_c700 [] = {
238 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), 257 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"),
239 "devicebuttons/z_calendar", 258 "devicebuttons/z_calendar",
240 "datebook", "nextView()", 259 "datebook", "nextView()",
241 "today", "raise()" }, 260 "today", "raise()" },
242 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), 261 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"),
243 "devicebuttons/z_contact", 262 "devicebuttons/z_contact",
244 "addressbook", "raise()", 263 "addressbook", "raise()",
245 "addressbook", "beamBusinessCard()" }, 264 "addressbook", "beamBusinessCard()" },
246 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), 265 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
247 "devicebuttons/z_home", 266 "devicebuttons/z_home",
248 "QPE/Launcher", "home()", 267 "QPE/Launcher", "home()",
249 "buttonsettings", "raise()" }, 268 "buttonsettings", "raise()" },
250 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), 269 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
251 "devicebuttons/z_menu", 270 "devicebuttons/z_menu",
252 "QPE/TaskBar", "toggleMenu()", 271 "QPE/TaskBar", "toggleMenu()",
253 "QPE/TaskBar", "toggleStartMenu()" }, 272 "QPE/TaskBar", "toggleStartMenu()" },
254 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Display Rotate"), 273 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Display Rotate"),
255 "", 274 "",
256 "QPE/Rotation", "flip()", 275 "QPE/Rotation", "flip()",
257 "QPE/Rotation", "flip()" }, 276 "QPE/Rotation", "flip()" },
258}; 277};
259 278
260struct s_button { 279struct s_button {
261 uint model; 280 uint model;
262 Qt::Key code; 281 Qt::Key code;
263 char *utext; 282 char *utext;
264 char *pix; 283 char *pix;
265 char *fpressedservice; 284 char *fpressedservice;
266 char *fpressedaction; 285 char *fpressedaction;
267 char *fheldservice; 286 char *fheldservice;
268 char *fheldaction; 287 char *fheldaction;
269} simpad_buttons [] = { 288} simpad_buttons [] = {
270 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, 289 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
271 Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Lower+Up"), 290 Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Lower+Up"),
272 "devicebuttons/simpad_lower_up", 291 "devicebuttons/simpad_lower_up",
273 "datebook", "nextView()", 292 "datebook", "nextView()",
274 "today", "raise()" }, 293 "today", "raise()" },
275 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, 294 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
276 Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Lower+Down"), 295 Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Lower+Down"),
277 "devicebuttons/simpad_lower_down", 296 "devicebuttons/simpad_lower_down",
278 "addressbook", "raise()", 297 "addressbook", "raise()",
279 "addressbook", "beamBusinessCard()" }, 298 "addressbook", "beamBusinessCard()" },
280 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, 299 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
281 Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Lower+Right"), 300 Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Lower+Right"),
282 "devicebuttons/simpad_lower_right", 301 "devicebuttons/simpad_lower_right",
283 "QPE/TaskBar", "toggleMenu()", 302 "QPE/TaskBar", "toggleMenu()",
284 "QPE/TaskBar", "toggleStartMenu()" }, 303 "QPE/TaskBar", "toggleStartMenu()" },
285 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, 304 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
286 Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Lower+Left"), 305 Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Lower+Left"),
287 "devicebuttons/simpad_lower_left", 306 "devicebuttons/simpad_lower_left",
288 "mail", "raise()", 307 "mail", "raise()",
289 "mail", "newMail()" }, 308 "mail", "newMail()" },
290 309
291 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, 310 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
292 Qt::Key_F5, QT_TRANSLATE_NOOP("Button", "Upper+Up"), 311 Qt::Key_F5, QT_TRANSLATE_NOOP("Button", "Upper+Up"),
293 "devicebuttons/simpad_upper_up", 312 "devicebuttons/simpad_upper_up",
294 "QPE/Launcher", "home()", 313 "QPE/Launcher", "home()",
295 "buttonsettings", "raise()" }, 314 "buttonsettings", "raise()" },
296 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, 315 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
297 Qt::Key_F6, QT_TRANSLATE_NOOP("Button", "Upper+Down"), 316 Qt::Key_F6, QT_TRANSLATE_NOOP("Button", "Upper+Down"),
298 "devicebuttons/simpad_upper_down", 317 "devicebuttons/simpad_upper_down",
299 "addressbook", "raise()", 318 "addressbook", "raise()",
300 "addressbook", "beamBusinessCard()" }, 319 "addressbook", "beamBusinessCard()" },
301 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, 320 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
302 Qt::Key_F7, QT_TRANSLATE_NOOP("Button", "Upper+Right"), 321 Qt::Key_F7, QT_TRANSLATE_NOOP("Button", "Upper+Right"),
303 "devicebuttons/simpad_upper_right", 322 "devicebuttons/simpad_upper_right",
304 "QPE/TaskBar", "toggleMenu()", 323 "QPE/TaskBar", "toggleMenu()",
305 "QPE/TaskBar", "toggleStartMenu()" }, 324 "QPE/TaskBar", "toggleStartMenu()" },
306 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, 325 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
307 Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Upper+Left"), 326 Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Upper+Left"),
308 "devicebuttons/simpad_upper_left", 327 "devicebuttons/simpad_upper_left",
309 "QPE/Rotation", "flip()", 328 "QPE/Rotation", "flip()",
310 "QPE/Rotation", "flip()" }, 329 "QPE/Rotation", "flip()" },
311 /* 330 /*
312 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, 331 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
313 Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Lower+Upper"), 332 Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Lower+Upper"),
314 "devicebuttons/simpad_lower_upper", 333 "devicebuttons/simpad_lower_upper",
315 "QPE/Launcher", "home()", 334 "QPE/Launcher", "home()",
316 "buttonsettings", "raise()" }, 335 "buttonsettings", "raise()" },
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
333static inline bool isQWS() 374static inline bool isQWS()
334{ 375{
335 return qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false; 376 return qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false;
336} 377}
337 378
338ODevice *ODevice::inst ( ) 379ODevice *ODevice::inst ( )
339{ 380{
340 static ODevice *dev = 0; 381 static ODevice *dev = 0;
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
357 400
358/************************************************** 401/**************************************************
359 * 402 *
360 * common 403 * common
361 * 404 *
362 **************************************************/ 405 **************************************************/
363 406
364 407
365ODevice::ODevice ( ) 408ODevice::ODevice ( )
366{ 409{
367 d = new ODeviceData; 410 d = new ODeviceData;
368 411
369 d-> m_modelstr = "Unknown"; 412 d-> m_modelstr = "Unknown";
370 d-> m_model = Model_Unknown; 413 d-> m_model = Model_Unknown;
371 d-> m_vendorstr = "Unknown"; 414 d-> m_vendorstr = "Unknown";
372 d-> m_vendor = Vendor_Unknown; 415 d-> m_vendor = Vendor_Unknown;
373 d-> m_systemstr = "Unknown"; 416 d-> m_systemstr = "Unknown";
374 d-> m_system = System_Unknown; 417 d-> m_system = System_Unknown;
375 d-> m_sysverstr = "0.0"; 418 d-> m_sysverstr = "0.0";
376 d-> m_rotation = Rot0; 419 d-> m_rotation = Rot0;
377 d-> m_direction = CW; 420 d-> m_direction = CW;
378 421
379 d-> m_holdtime = 1000; // 1000ms 422 d-> m_holdtime = 1000; // 1000ms
380 d-> m_buttons = 0; 423 d-> m_buttons = 0;
381} 424}
382 425
383void ODevice::systemMessage ( const QCString &msg, const QByteArray & ) 426void ODevice::systemMessage ( const QCString &msg, const QByteArray & )
384{ 427{
385 if ( msg == "deviceButtonMappingChanged()" ) { 428 if ( msg == "deviceButtonMappingChanged()" ) {
386 reloadButtonMapping ( ); 429 reloadButtonMapping ( );
387 } 430 }
388} 431}
389 432
390void ODevice::init ( ) 433void ODevice::init ( )
391{ 434{
392} 435}
393 436
394/** 437/**
395 * This method initialises the button mapping 438 * This method initialises the button mapping
396 */ 439 */
397void ODevice::initButtons ( ) 440void ODevice::initButtons ( )
398{ 441{
399 if ( d-> m_buttons ) 442 if ( d-> m_buttons )
400 return; 443 return;
401 444
402 // Simulation uses iPAQ 3660 device buttons 445 // Simulation uses iPAQ 3660 device buttons
403 446
404 qDebug ( "init Buttons" ); 447 qDebug ( "init Buttons" );
405 d-> m_buttons = new QValueList <ODeviceButton>; 448 d-> m_buttons = new QValueList <ODeviceButton>;
406 449
407 for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { 450 for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) {
408 i_button *ib = ipaq_buttons + i; 451 i_button *ib = ipaq_buttons + i;
409 ODeviceButton b; 452 ODeviceButton b;
410 453
411 if (( ib-> model & Model_iPAQ_H36xx ) == Model_iPAQ_H36xx ) { 454 if (( ib-> model & Model_iPAQ_H36xx ) == Model_iPAQ_H36xx ) {
412 b. setKeycode ( ib-> code ); 455 b. setKeycode ( ib-> code );
413 b. setUserText ( QObject::tr ( "Button", ib-> utext )); 456 b. setUserText ( QObject::tr ( "Button", ib-> utext ));
414 b. setPixmap ( Resource::loadPixmap ( ib-> pix )); 457 b. setPixmap ( Resource::loadPixmap ( ib-> pix ));
415 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction )); 458 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction ));
416 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction )); 459 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction ));
417 d-> m_buttons-> append ( b ); 460 d-> m_buttons-> append ( b );
418 } 461 }
419 } 462 }
420 reloadButtonMapping ( ); 463 reloadButtonMapping ( );
421 464
422 QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); 465 QCopChannel *sysch = new QCopChannel ( "QPE/System", this );
423 connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); 466 connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & )));
424} 467}
425 468
426ODevice::~ODevice ( ) 469ODevice::~ODevice ( )
427{ 470{
428 delete d; 471 delete d;
429} 472}
430 473
431bool ODevice::setSoftSuspend ( bool /*soft*/ ) 474bool ODevice::setSoftSuspend ( bool /*soft*/ )
432{ 475{
433 return false; 476 return false;
434} 477}
435 478
436//#include <linux/apm_bios.h> 479//#include <linux/apm_bios.h>
437 480
438#define APM_IOC_SUSPEND OD_IO( 'A', 2 ) 481#define APM_IOC_SUSPEND OD_IO( 'A', 2 )
439 482
440/** 483/**
441 * This method will try to suspend the device 484 * This method will try to suspend the device
442 * It only works if the user is the QWS Server and the apm application 485 * It only works if the user is the QWS Server and the apm application
443 * is installed. 486 * is installed.
444 * It tries to suspend and then waits some time cause some distributions 487 * It tries to suspend and then waits some time cause some distributions
@@ -1751,96 +1794,250 @@ void SIMpad::alarmSound ( )
1751 } 1794 }
1752 1795
1753 snd. play ( ); 1796 snd. play ( );
1754 while ( !snd. isFinished ( )) 1797 while ( !snd. isFinished ( ))
1755 qApp-> processEvents ( ); 1798 qApp-> processEvents ( );
1756 1799
1757 if ( fd >= 0 ) { 1800 if ( fd >= 0 ) {
1758 if ( vol_reset ) 1801 if ( vol_reset )
1759 ::ioctl ( fd, MIXER_WRITE( 0 ), &vol ); 1802 ::ioctl ( fd, MIXER_WRITE( 0 ), &vol );
1760 ::close ( fd ); 1803 ::close ( fd );
1761 } 1804 }
1762#endif 1805#endif
1763} 1806}
1764 1807
1765 1808
1766bool SIMpad::suspend ( ) // Must override because SIMpad does NOT have apm 1809bool SIMpad::suspend ( ) // Must override because SIMpad does NOT have apm
1767{ 1810{
1768 qDebug( "ODevice for SIMpad: suspend()" ); 1811 qDebug( "ODevice for SIMpad: suspend()" );
1769 if ( !isQWS( ) ) // only qwsserver is allowed to suspend 1812 if ( !isQWS( ) ) // only qwsserver is allowed to suspend
1770 return false; 1813 return false;
1771 1814
1772 bool res = false; 1815 bool res = false;
1773 1816
1774 struct timeval tvs, tvn; 1817 struct timeval tvs, tvn;
1775 ::gettimeofday ( &tvs, 0 ); 1818 ::gettimeofday ( &tvs, 0 );
1776 1819
1777 ::sync ( ); // flush fs caches 1820 ::sync ( ); // flush fs caches
1778 res = ( ::system ( "echo > /proc/sys/pm/suspend" ) == 0 ); //TODO make better :) 1821 res = ( ::system ( "echo > /proc/sys/pm/suspend" ) == 0 ); //TODO make better :)
1779 1822
1780 return res; 1823 return res;
1781} 1824}
1782 1825
1783 1826
1784bool SIMpad::setSoftSuspend ( bool soft ) 1827bool SIMpad::setSoftSuspend ( bool soft )
1785{ 1828{
1786 qDebug( "ODevice for SIMpad: UNHANDLED setSoftSuspend(%s)", soft? "on" : "off" ); 1829 qDebug( "ODevice for SIMpad: UNHANDLED setSoftSuspend(%s)", soft? "on" : "off" );
1787 return false; 1830 return false;
1788} 1831}
1789 1832
1790 1833
1791bool SIMpad::setDisplayStatus ( bool on ) 1834bool SIMpad::setDisplayStatus ( bool on )
1792{ 1835{
1793 qDebug( "ODevice for SIMpad: setDisplayStatus(%s)", on? "on" : "off" ); 1836 qDebug( "ODevice for SIMpad: setDisplayStatus(%s)", on? "on" : "off" );
1794 1837
1795 bool res = false; 1838 bool res = false;
1796 int fd; 1839 int fd;
1797 1840
1798 QString cmdline = QString().sprintf( "echo %s > /proc/cs3", on ? "0xd41a" : "0xd40a" ); //TODO make better :) 1841 QString cmdline = QString().sprintf( "echo %s > /proc/cs3", on ? "0xd41a" : "0xd40a" ); //TODO make better :)
1799 1842
1800 if (( fd = ::open ( "/dev/fb0", O_RDWR )) >= 0 ) { 1843 if (( fd = ::open ( "/dev/fb0", O_RDWR )) >= 0 ) {
1801 res = ( ::system( (const char*) cmdline ) == 0 ); 1844 res = ( ::system( (const char*) cmdline ) == 0 );
1802 ::close ( fd ); 1845 ::close ( fd );
1803 } 1846 }
1804 return res; 1847 return res;
1805} 1848}
1806 1849
1807 1850
1808bool SIMpad::setDisplayBrightness ( int bright ) 1851bool SIMpad::setDisplayBrightness ( int bright )
1809{ 1852{
1810 qDebug( "ODevice for SIMpad: setDisplayBrightness( %d )", bright ); 1853 qDebug( "ODevice for SIMpad: setDisplayBrightness( %d )", bright );
1811 bool res = false; 1854 bool res = false;
1812 int fd; 1855 int fd;
1813 1856
1814 if ( bright > 255 ) 1857 if ( bright > 255 )
1815 bright = 255; 1858 bright = 255;
1816 if ( bright < 0 ) 1859 if ( bright < 0 )
1817 bright = 0; 1860 bright = 0;
1818 1861
1819 if (( fd = ::open ( SIMPAD_BACKLIGHT_CONTROL, O_WRONLY )) >= 0 ) { 1862 if (( fd = ::open ( SIMPAD_BACKLIGHT_CONTROL, O_WRONLY )) >= 0 ) {
1820 int value = 255 - bright; 1863 int value = 255 - bright;
1821 const int mask = SIMPAD_BACKLIGHT_MASK; 1864 const int mask = SIMPAD_BACKLIGHT_MASK;
1822 value = value << 8; 1865 value = value << 8;
1823 value += mask; 1866 value += mask;
1824 char writeCommand[100]; 1867 char writeCommand[100];
1825 const int count = sprintf( writeCommand, "0x%x\n", value ); 1868 const int count = sprintf( writeCommand, "0x%x\n", value );
1826 res = ( ::write ( fd, writeCommand, count ) != -1 ); 1869 res = ( ::write ( fd, writeCommand, count ) != -1 );
1827 ::close ( fd ); 1870 ::close ( fd );
1828 } 1871 }
1829 return res; 1872 return res;
1830} 1873}
1831 1874
1832 1875
1833int SIMpad::displayBrightnessResolution ( ) const 1876int SIMpad::displayBrightnessResolution ( ) const
1834{ 1877{
1835 switch ( model ( )) { 1878 switch ( model ( )) {
1836 case Model_SIMpad_CL4: 1879 case Model_SIMpad_CL4:
1837 case Model_SIMpad_SL4: 1880 case Model_SIMpad_SL4:
1838 case Model_SIMpad_SLC: 1881 case Model_SIMpad_SLC:
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
@@ -1,173 +1,179 @@
1/* This file is part of the OPIE libraries 1/* This file is part of the OPIE libraries
2 Copyright (C) 2002 Robert Griebl (sandman@handhelds.org) 2 Copyright (C) 2002 Robert Griebl (sandman@handhelds.org)
3 3
4 This library is free software; you can redistribute it and/or 4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public 5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either 6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version. 7 version 2 of the License, or (at your option) any later version.
8 8
9 This library is distributed in the hope that it will be useful, 9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of 10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details. 12 Library General Public License for more details.
13 13
14 You should have received a copy of the GNU Library General Public License 14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to 15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 16 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. 17 Boston, MA 02111-1307, USA.
18*/ 18*/
19 19
20#ifndef _LIBOPIE_ODEVICE_H_ 20#ifndef _LIBOPIE_ODEVICE_H_
21#define _LIBOPIE_ODEVICE_H_ 21#define _LIBOPIE_ODEVICE_H_
22 22
23#include <qobject.h> 23#include <qobject.h>
24#include <qstring.h> 24#include <qstring.h>
25#include <qnamespace.h> 25#include <qnamespace.h>
26 26
27#include <opie/odevicebutton.h> 27#include <opie/odevicebutton.h>
28 28
29#include <qpe/qpeapplication.h> /* for Transformation enum.. */ 29#include <qpe/qpeapplication.h> /* for Transformation enum.. */
30 30
31class ODeviceData; 31class ODeviceData;
32 32
33namespace Opie { 33namespace Opie {
34 34
35/** 35/**
36 * The available devices 36 * The available devices
37 */ 37 */
38enum OModel { 38enum OModel {
39 Model_Unknown, // = 0 39 Model_Unknown, // = 0
40 40
41 Model_Series_Mask = 0xff000000, 41 Model_Series_Mask = 0xff000000,
42 42
43 Model_iPAQ = ( 1 << 24 ), 43 Model_iPAQ = ( 1 << 24 ),
44 44
45 Model_iPAQ_All = ( Model_iPAQ | 0xffffff ), 45 Model_iPAQ_All = ( Model_iPAQ | 0xffffff ),
46 Model_iPAQ_H31xx = ( Model_iPAQ | 0x000001 ), 46 Model_iPAQ_H31xx = ( Model_iPAQ | 0x000001 ),
47 Model_iPAQ_H36xx = ( Model_iPAQ | 0x000002 ), 47 Model_iPAQ_H36xx = ( Model_iPAQ | 0x000002 ),
48 Model_iPAQ_H37xx = ( Model_iPAQ | 0x000004 ), 48 Model_iPAQ_H37xx = ( Model_iPAQ | 0x000004 ),
49 Model_iPAQ_H38xx = ( Model_iPAQ | 0x000008 ), 49 Model_iPAQ_H38xx = ( Model_iPAQ | 0x000008 ),
50 Model_iPAQ_H39xx = ( Model_iPAQ | 0x000010 ), 50 Model_iPAQ_H39xx = ( Model_iPAQ | 0x000010 ),
51 51
52 Model_Zaurus = ( 2 << 24 ), 52 Model_Zaurus = ( 2 << 24 ),
53 53
54 Model_Zaurus_SL5000 = ( Model_Zaurus | 0x000001 ), 54 Model_Zaurus_SL5000 = ( Model_Zaurus | 0x000001 ),
55 Model_Zaurus_SL5500 = ( Model_Zaurus | 0x000002 ), 55 Model_Zaurus_SL5500 = ( Model_Zaurus | 0x000002 ),
56 Model_Zaurus_SLA300 = ( Model_Zaurus | 0x000003 ), 56 Model_Zaurus_SLA300 = ( Model_Zaurus | 0x000003 ),
57 Model_Zaurus_SLB600 = ( Model_Zaurus | 0x000004 ), 57 Model_Zaurus_SLB600 = ( Model_Zaurus | 0x000004 ),
58 Model_Zaurus_SLC700 = ( Model_Zaurus | 0x000005 ), 58 Model_Zaurus_SLC700 = ( Model_Zaurus | 0x000005 ),
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
86 System_Familiar, 92 System_Familiar,
87 System_Zaurus, 93 System_Zaurus,
88 System_OpenZaurus 94 System_OpenZaurus
89}; 95};
90 96
91enum OLedState { 97enum OLedState {
92 Led_Off, 98 Led_Off,
93 Led_On, 99 Led_On,
94 Led_BlinkSlow, 100 Led_BlinkSlow,
95 Led_BlinkFast 101 Led_BlinkFast
96}; 102};
97 103
98enum OLed { 104enum OLed {
99 Led_Mail, 105 Led_Mail,
100 Led_Power, 106 Led_Power,
101 Led_BlueTooth 107 Led_BlueTooth
102}; 108};
103 109
104enum OHardKey { 110enum OHardKey {
105 HardKey_Datebook = Qt::Key_F9, 111 HardKey_Datebook = Qt::Key_F9,
106 HardKey_Contacts = Qt::Key_F10, 112 HardKey_Contacts = Qt::Key_F10,
107 HardKey_Menu = Qt::Key_F11, 113 HardKey_Menu = Qt::Key_F11,
108 HardKey_Home = Qt::Key_F12, 114 HardKey_Home = Qt::Key_F12,
109 HardKey_Mail = Qt::Key_F13, 115 HardKey_Mail = Qt::Key_F13,
110 HardKey_Record = Qt::Key_F24, 116 HardKey_Record = Qt::Key_F24,
111 HardKey_Suspend = Qt::Key_F34, 117 HardKey_Suspend = Qt::Key_F34,
112 HardKey_Backlight = Qt::Key_F35, 118 HardKey_Backlight = Qt::Key_F35,
113}; 119};
114 120
115enum ODirection { 121enum ODirection {
116 CW = 0, 122 CW = 0,
117 CCW = 1, 123 CCW = 1,
118 Flip = 2, 124 Flip = 2,
119}; 125};
120 126
121/** 127/**
122 * A singleton which gives informations about device specefic option 128 * A singleton which gives informations about device specefic option
123 * like the Hardware used, LEDs, the Base Distribution and 129 * like the Hardware used, LEDs, the Base Distribution and
124 * hardware key mappings. 130 * hardware key mappings.
125 * 131 *
126 * 132 *
127 * @short A small class for device specefic options 133 * @short A small class for device specefic options
128 * @see QObject 134 * @see QObject
129 * @author Robert Griebl 135 * @author Robert Griebl
130 * @version 1.0 136 * @version 1.0
131 */ 137 */
132class ODevice : public QObject { 138class ODevice : public QObject {
133 Q_OBJECT 139 Q_OBJECT
134 140
135private: 141private:
136 /* disable copy */ 142 /* disable copy */
137 ODevice ( const ODevice & ); 143 ODevice ( const ODevice & );
138 144
139protected: 145protected:
140 ODevice ( ); 146 ODevice ( );
141 virtual void init ( ); 147 virtual void init ( );
142 virtual void initButtons ( ); 148 virtual void initButtons ( );
143 149
144 ODeviceData *d; 150 ODeviceData *d;
145 151
146public: 152public:
147 // sandman do we want to allow destructions? -zecke? 153 // sandman do we want to allow destructions? -zecke?
148 virtual ~ODevice ( ); 154 virtual ~ODevice ( );
149 155
150 156
151 static ODevice *inst ( ); 157 static ODevice *inst ( );
152 158
153// information 159// information
154 160
155 QString modelString ( ) const; 161 QString modelString ( ) const;
156 OModel model ( ) const; 162 OModel model ( ) const;
157 inline OModel series ( ) const { return (OModel) ( model ( ) & Model_Series_Mask ); } 163 inline OModel series ( ) const { return (OModel) ( model ( ) & Model_Series_Mask ); }
158 164
159 QString vendorString ( ) const; 165 QString vendorString ( ) const;
160 OVendor vendor ( ) const; 166 OVendor vendor ( ) const;
161 167
162 QString systemString ( ) const; 168 QString systemString ( ) const;
163 OSystem system ( ) const; 169 OSystem system ( ) const;
164 170
165 QString systemVersionString ( ) const; 171 QString systemVersionString ( ) const;
166 172
167 Transformation rotation ( ) const; 173 Transformation rotation ( ) const;
168 ODirection direction ( ) const; 174 ODirection direction ( ) const;
169 175
170// system 176// system
171 177
172 virtual bool setSoftSuspend ( bool on ); 178 virtual bool setSoftSuspend ( bool on );
173 virtual bool suspend ( ); 179 virtual bool suspend ( );