summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice_zaurus.cpp39
1 files changed, 37 insertions, 2 deletions
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp
index 8369f54..7302d2c 100644
--- a/libopie2/opiecore/device/odevice_zaurus.cpp
+++ b/libopie2/opiecore/device/odevice_zaurus.cpp
@@ -69,96 +69,127 @@ struct z_button z_buttons [] = {
69 "addressbook", "beamBusinessCard()" }, 69 "addressbook", "beamBusinessCard()" },
70 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), 70 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
71 "devicebuttons/z_home", 71 "devicebuttons/z_home",
72 "QPE/Launcher", "home()", 72 "QPE/Launcher", "home()",
73 "buttonsettings", "raise()" }, 73 "buttonsettings", "raise()" },
74 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), 74 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
75 "devicebuttons/z_menu", 75 "devicebuttons/z_menu",
76 "QPE/TaskBar", "toggleMenu()", 76 "QPE/TaskBar", "toggleMenu()",
77 "QPE/TaskBar", "toggleStartMenu()" }, 77 "QPE/TaskBar", "toggleStartMenu()" },
78 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), 78 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"),
79 "devicebuttons/z_mail", 79 "devicebuttons/z_mail",
80 "opiemail", "raise()", 80 "opiemail", "raise()",
81 "opiemail", "newMail()" }, 81 "opiemail", "newMail()" },
82}; 82};
83 83
84struct z_button z_buttons_c700 [] = { 84struct z_button z_buttons_c700 [] = {
85 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), 85 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"),
86 "devicebuttons/z_calendar", 86 "devicebuttons/z_calendar",
87 "datebook", "nextView()", 87 "datebook", "nextView()",
88 "today", "raise()" }, 88 "today", "raise()" },
89 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), 89 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"),
90 "devicebuttons/z_contact", 90 "devicebuttons/z_contact",
91 "addressbook", "raise()", 91 "addressbook", "raise()",
92 "addressbook", "beamBusinessCard()" }, 92 "addressbook", "beamBusinessCard()" },
93 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), 93 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
94 "devicebuttons/z_home", 94 "devicebuttons/z_home",
95 "QPE/Launcher", "home()", 95 "QPE/Launcher", "home()",
96 "buttonsettings", "raise()" }, 96 "buttonsettings", "raise()" },
97 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), 97 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
98 "devicebuttons/z_menu", 98 "devicebuttons/z_menu",
99 "QPE/TaskBar", "toggleMenu()", 99 "QPE/TaskBar", "toggleMenu()",
100 "QPE/TaskBar", "toggleStartMenu()" }, 100 "QPE/TaskBar", "toggleStartMenu()" },
101 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), 101 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"),
102 "devicebuttons/z_mail", 102 "devicebuttons/z_mail",
103 "opiemail", "raise()", 103 "opiemail", "raise()",
104 "opiemail", "newMail()" }, 104 "opiemail", "newMail()" },
105 105
106 { Qt::Key_F15, QT_TRANSLATE_NOOP("Button", "Hinge1"), 106 { Qt::Key_F15, QT_TRANSLATE_NOOP("Button", "Hinge1"),
107 "devicebuttons/z_hinge1", 107 "devicebuttons/z_hinge1",
108 "QPE/Rotation", "rotateDefault()",0}, 108 "QPE/Rotation", "rotateDefault()",0},
109 { Qt::Key_F16, QT_TRANSLATE_NOOP("Button", "Hinge2"), 109 { Qt::Key_F16, QT_TRANSLATE_NOOP("Button", "Hinge2"),
110 "devicebuttons/z_hinge2", 110 "devicebuttons/z_hinge2",
111 "QPE/Rotation", "rotateDefault()",0}, 111 "QPE/Rotation", "rotateDefault()",0},
112 { Qt::Key_F17, QT_TRANSLATE_NOOP("Button", "Hinge3"), 112 { Qt::Key_F17, QT_TRANSLATE_NOOP("Button", "Hinge3"),
113 "devicebuttons/z_hinge3", 113 "devicebuttons/z_hinge3",
114 "QPE/Rotation", "rotateDefault()",0}, 114 "QPE/Rotation", "rotateDefault()",0},
115}; 115};
116 116
117struct z_button z_buttons_6000 [] = {
118 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"),
119 "devicebuttons/z_calendar",
120 "datebook", "nextView()",
121 "today", "raise()" },
122 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"),
123 "devicebuttons/z_contact",
124 "addressbook", "raise()",
125 "addressbook", "beamBusinessCard()" },
126 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
127 "devicebuttons/z_home",
128 "QPE/Launcher", "home()",
129 "buttonsettings", "raise()" },
130 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
131 "devicebuttons/z_menu",
132 "QPE/TaskBar", "toggleMenu()",
133 "QPE/TaskBar", "toggleStartMenu()" },
134 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"),
135 "devicebuttons/z_mail",
136 "opiemail", "raise()",
137 "opiemail", "newMail()" },
138 { Qt::Key_F15, QT_TRANSLATE_NOOP("Button", "Rotate Button"),
139 "devicebuttons/z_rotate",
140 0,
141 "QPE/Rotation", "rotateDefault()" },
142 { Qt::Key_F24, QT_TRANSLATE_NOOP("Button", "Record Button"),
143 "devicebuttons/z_hinge3",
144 "QPE/VMemo", "toggleRecord()",
145 "sound", "raise()" },
146};
147
117// FIXME This gets unnecessary complicated. We should think about splitting the Zaurus 148// FIXME This gets unnecessary complicated. We should think about splitting the Zaurus
118// class up into individual classes. We would need three classes 149// class up into individual classes. We would need three classes
119// 150//
120// Zaurus-Collie (SA-model w/ 320x240 lcd, for SL5500 and SL5000) 151// Zaurus-Collie (SA-model w/ 320x240 lcd, for SL5500 and SL5000)
121// Zaurus-Poodle (PXA-model w/ 320x240 lcd, for SL5600) 152// Zaurus-Poodle (PXA-model w/ 320x240 lcd, for SL5600)
122// Zaurus-Corgi (PXA-model w/ 640x480 lcd, for C700, C750, C760, C860, C3000, C1000, C3100) 153// Zaurus-Corgi (PXA-model w/ 640x480 lcd, for C700, C750, C760, C860, C3000, C1000, C3100)
123// Zaurus-Tosa (PXA-model w/ 480x640 lcd, for SL6000) 154// Zaurus-Tosa (PXA-model w/ 480x640 lcd, for SL6000)
124 155
125void Zaurus::init(const QString& cpu_info) 156void Zaurus::init(const QString& cpu_info)
126{ 157{
127 // Set the time to wait until the system is really suspended 158 // Set the time to wait until the system is really suspended
128 // the delta between apm --suspend and sleeping 159 // the delta between apm --suspend and sleeping
129 setAPMTimeOut( 15000 ); 160 setAPMTimeOut( 15000 );
130 161
131 // generic distribution code already scanned /etc/issue at that point - 162 // generic distribution code already scanned /etc/issue at that point -
132 // embedix releases contain "Embedix <version> | Linux for Embedded Devices" 163 // embedix releases contain "Embedix <version> | Linux for Embedded Devices"
133 if ( d->m_sysverstr.contains( "embedix", false ) ) 164 if ( d->m_sysverstr.contains( "embedix", false ) )
134 { 165 {
135 d->m_vendorstr = "Sharp"; 166 d->m_vendorstr = "Sharp";
136 d->m_vendor = Vendor_Sharp; 167 d->m_vendor = Vendor_Sharp;
137 d->m_systemstr = "Zaurus"; 168 d->m_systemstr = "Zaurus";
138 d->m_system = System_Zaurus; 169 d->m_system = System_Zaurus;
139 m_embedix = true; 170 m_embedix = true;
140 } 171 }
141 else 172 else
142 { 173 {
143 d->m_vendorstr = "OpenZaurus Team"; 174 d->m_vendorstr = "OpenZaurus Team";
144 d->m_systemstr = "OpenZaurus"; 175 d->m_systemstr = "OpenZaurus";
145 d->m_system = System_OpenZaurus; 176 d->m_system = System_OpenZaurus;
146 // sysver already gathered 177 // sysver already gathered
147 178
148 // OpenZaurus sometimes uses the 2.4 (embedix) kernel, check if this is one 179 // OpenZaurus sometimes uses the 2.4 (embedix) kernel, check if this is one
149 FILE *uname = popen("uname -r", "r"); 180 FILE *uname = popen("uname -r", "r");
150 QFile f; 181 QFile f;
151 QString line; 182 QString line;
152 if ( f.open(IO_ReadOnly, uname) ) { 183 if ( f.open(IO_ReadOnly, uname) ) {
153 QTextStream ts ( &f ); 184 QTextStream ts ( &f );
154 line = ts.readLine(); 185 line = ts.readLine();
155 m_embedix = line.startsWith( "2.4." ); 186 m_embedix = line.startsWith( "2.4." );
156 f.close(); 187 f.close();
157 } 188 }
158 pclose(uname); 189 pclose(uname);
159 } 190 }
160 191
161 // check the Zaurus model 192 // check the Zaurus model
162 QString model; 193 QString model;
163 int loc = cpu_info.find( ":" ); 194 int loc = cpu_info.find( ":" );
164 if ( loc != -1 ) 195 if ( loc != -1 )
@@ -210,102 +241,106 @@ void Zaurus::init(const QString& cpu_info)
210 break; 241 break;
211 default: 242 default:
212 m_backlightdev = "/sys/class/backlight/corgi-bl/"; 243 m_backlightdev = "/sys/class/backlight/corgi-bl/";
213 } 244 }
214 245
215 // set initial rotation 246 // set initial rotation
216 switch( d->m_model ) 247 switch( d->m_model )
217 { 248 {
218 case Model_Zaurus_SL6000: // fallthrough 249 case Model_Zaurus_SL6000: // fallthrough
219 case Model_Zaurus_SLA300: 250 case Model_Zaurus_SLA300:
220 d->m_rotation = Rot0; 251 d->m_rotation = Rot0;
221 break; 252 break;
222 case Model_Zaurus_SLC3000: // fallthrough 253 case Model_Zaurus_SLC3000: // fallthrough
223 case Model_Zaurus_SLC1000: // fallthrough 254 case Model_Zaurus_SLC1000: // fallthrough
224 case Model_Zaurus_SLC7x0: 255 case Model_Zaurus_SLC7x0:
225 d->m_rotation = rotation(); 256 d->m_rotation = rotation();
226 d->m_direction = direction(); 257 d->m_direction = direction();
227 break; 258 break;
228 case Model_Zaurus_SLB600: // fallthrough 259 case Model_Zaurus_SLB600: // fallthrough
229 case Model_Zaurus_SL5000: // fallthrough 260 case Model_Zaurus_SL5000: // fallthrough
230 case Model_Zaurus_SL5500: // fallthrough 261 case Model_Zaurus_SL5500: // fallthrough
231 default: 262 default:
232 d->m_rotation = Rot270; 263 d->m_rotation = Rot270;
233 } 264 }
234 265
235 // set default qte driver 266 // set default qte driver
236 switch( d->m_model ) 267 switch( d->m_model )
237 { 268 {
238 case Model_Zaurus_SLC7x0: 269 case Model_Zaurus_SLC7x0:
239 d->m_qteDriver = "W100"; 270 d->m_qteDriver = "W100";
240 break; 271 break;
241 default: 272 default:
242 d->m_qteDriver = "Transformed"; 273 d->m_qteDriver = "Transformed";
243 } 274 }
244 275
245 m_leds[0] = Led_Off; 276 m_leds[0] = Led_Off;
246 277
247 if ( m_embedix ) 278 if ( m_embedix )
248 qDebug( "Zaurus::init() - Using the 2.4 Embedix HAL on a %s", (const char*) d->m_modelstr ); 279 qDebug( "Zaurus::init() - Using the 2.4 Embedix HAL on a %s", (const char*) d->m_modelstr );
249 else 280 else
250 qDebug( "Zaurus::init() - Using the 2.6 OpenZaurus HAL on a %s", (const char*) d->m_modelstr ); 281 qDebug( "Zaurus::init() - Using the 2.6 OpenZaurus HAL on a %s", (const char*) d->m_modelstr );
251} 282}
252 283
253void Zaurus::initButtons() 284void Zaurus::initButtons()
254{ 285{
255 if ( d->m_buttons ) 286 if ( d->m_buttons )
256 return; 287 return;
257 288
258
259 d->m_buttons = new QValueList <ODeviceButton>; 289 d->m_buttons = new QValueList <ODeviceButton>;
260 290
261 struct z_button * pz_buttons; 291 struct z_button * pz_buttons;
262 int buttoncount; 292 int buttoncount;
263 switch ( d->m_model ) { 293 switch ( d->m_model )
294 {
295 case Model_Zaurus_SL6000:
296 pz_buttons = z_buttons_6000;
297 buttoncount = ARRAY_SIZE(z_buttons_6000);
298 break;
264 case Model_Zaurus_SLC3000: // fallthrough 299 case Model_Zaurus_SLC3000: // fallthrough
265 case Model_Zaurus_SLC1000: // fallthrough 300 case Model_Zaurus_SLC1000: // fallthrough
266 case Model_Zaurus_SLC7x0: 301 case Model_Zaurus_SLC7x0:
267 if ( isQWS( ) ) { 302 if ( isQWS( ) ) {
268 addPreHandler(this); // hinge-sensor-handler 303 addPreHandler(this); // hinge-sensor-handler
269 } 304 }
270 pz_buttons = z_buttons_c700; 305 pz_buttons = z_buttons_c700;
271 buttoncount = ARRAY_SIZE(z_buttons_c700); 306 buttoncount = ARRAY_SIZE(z_buttons_c700);
272 break; 307 break;
273 default: 308 default:
274 pz_buttons = z_buttons; 309 pz_buttons = z_buttons;
275 buttoncount = ARRAY_SIZE(z_buttons); 310 buttoncount = ARRAY_SIZE(z_buttons);
276 break; 311 break;
277 } 312 }
278 313
279 for ( int i = 0; i < buttoncount; i++ ) { 314 for ( int i = 0; i < buttoncount; i++ ) {
280 struct z_button *zb = pz_buttons + i; 315 struct z_button *zb = pz_buttons + i;
281 ODeviceButton b; 316 ODeviceButton b;
282 317
283 b.setKeycode( zb->code ); 318 b.setKeycode( zb->code );
284 b.setUserText( QObject::tr( "Button", zb->utext )); 319 b.setUserText( QObject::tr( "Button", zb->utext ));
285 b.setPixmap( OResource::loadPixmap( zb->pix )); 320 b.setPixmap( OResource::loadPixmap( zb->pix ));
286 b.setFactoryPresetPressedAction( OQCopMessage( makeChannel ( zb->fpressedservice ), zb->fpressedaction )); 321 b.setFactoryPresetPressedAction( OQCopMessage( makeChannel ( zb->fpressedservice ), zb->fpressedaction ));
287 b.setFactoryPresetHeldAction( OQCopMessage( makeChannel ( zb->fheldservice ), zb->fheldaction )); 322 b.setFactoryPresetHeldAction( OQCopMessage( makeChannel ( zb->fheldservice ), zb->fheldaction ));
288 d->m_buttons->append( b ); 323 d->m_buttons->append( b );
289 } 324 }
290 325
291 reloadButtonMapping(); 326 reloadButtonMapping();
292} 327}
293 328
294 329
295 330
296typedef struct sharp_led_status { 331typedef struct sharp_led_status {
297 int which; /* select which LED status is wanted. */ 332 int which; /* select which LED status is wanted. */
298 int status; /* set new led status if you call SHARP_LED_SETSTATUS */ 333 int status; /* set new led status if you call SHARP_LED_SETSTATUS */
299} sharp_led_status; 334} sharp_led_status;
300 335
301void Zaurus::buzzer( int sound ) 336void Zaurus::buzzer( int sound )
302{ 337{
303#ifndef QT_NO_SOUND 338#ifndef QT_NO_SOUND
304 Sound *snd = 0; 339 Sound *snd = 0;
305 340
306 // All devices except SL5500 have a DSP device 341 // All devices except SL5500 have a DSP device
307 if ( d->m_model != Model_Zaurus_SL5000 342 if ( d->m_model != Model_Zaurus_SL5000
308 && d->m_model != Model_Zaurus_SL5500 ) { 343 && d->m_model != Model_Zaurus_SL5500 ) {
309 344
310 switch ( sound ){ 345 switch ( sound ){
311 case SHARP_BUZ_TOUCHSOUND: { 346 case SHARP_BUZ_TOUCHSOUND: {