summaryrefslogtreecommitdiff
authoralwin <alwin>2005-03-15 18:58:53 (UTC)
committer alwin <alwin>2005-03-15 18:58:53 (UTC)
commit8e5d27f4155e38d8278161c29b2d721a1de44430 (patch) (unidiff)
tree5c55a30b907c7b422ea351fab5f4d401ecf4c53b
parentcb3b52896e39a594fd7ba825abd95817349fb55f (diff)
downloadopie-8e5d27f4155e38d8278161c29b2d721a1de44430.zip
opie-8e5d27f4155e38d8278161c29b2d721a1de44430.tar.gz
opie-8e5d27f4155e38d8278161c29b2d721a1de44430.tar.bz2
ok. the hinge button must have held-action set to 0.
ToDo: make it sure that it will not set to any - otherwise it runs into trouble with autorepeat.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice_zaurus.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp
index 59d4eb0..72378ff 100644
--- a/libopie2/opiecore/device/odevice_zaurus.cpp
+++ b/libopie2/opiecore/device/odevice_zaurus.cpp
@@ -1,372 +1,369 @@
1/* 1/*
2                 This file is part of the Opie Project 2                 This file is part of the Opie Project
3              Copyright (C) 2002,2003,2004 The Opie Team <opie-devel@handhelds.org> 3              Copyright (C) 2002,2003,2004 The Opie Team <opie-devel@handhelds.org>
4 =. 4 =.
5 .=l. 5 .=l.
6           .>+-= 6           .>+-=
7 _;:,     .>    :=|. This program is free software; you can 7 _;:,     .>    :=|. This program is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under 8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
10.="- .-=="i,     .._ License as published by the Free Software 10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License, 11 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version. 12     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_. 13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This program is distributed in the hope that 14    .i_,=:_.      -<s. This program is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of 16    : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more 19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details. 20++=   -.     .`     .: details.
21 :     =  ...= . :.=- 21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU 22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with 23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB. 24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29 29
30#include "odevice_zaurus.h" 30#include "odevice_zaurus.h"
31 31
32/* QT */ 32/* QT */
33#include <qapplication.h> 33#include <qapplication.h>
34#include <qfile.h> 34#include <qfile.h>
35#include <qtextstream.h> 35#include <qtextstream.h>
36#include <qwindowsystem_qws.h> 36#include <qwindowsystem_qws.h>
37 37
38/* OPIE */ 38/* OPIE */
39#include <opie2/oinputsystem.h> 39#include <opie2/oinputsystem.h>
40#include <qpe/config.h> 40#include <qpe/config.h>
41#include <qpe/resource.h> 41#include <qpe/resource.h>
42#include <qpe/sound.h> 42#include <qpe/sound.h>
43#include <qpe/qcopenvelope_qws.h> 43#include <qpe/qcopenvelope_qws.h>
44 44
45/* STD */ 45/* STD */
46#include <fcntl.h> 46#include <fcntl.h>
47#include <math.h> 47#include <math.h>
48#include <stdlib.h> 48#include <stdlib.h>
49#include <signal.h> 49#include <signal.h>
50#include <sys/ioctl.h> 50#include <sys/ioctl.h>
51#include <sys/time.h> 51#include <sys/time.h>
52#include <unistd.h> 52#include <unistd.h>
53#ifndef QT_NO_SOUND 53#ifndef QT_NO_SOUND
54#include <linux/soundcard.h> 54#include <linux/soundcard.h>
55#endif 55#endif
56 56
57using namespace Opie::Core; 57using namespace Opie::Core;
58using namespace Opie::Core::Internal; 58using namespace Opie::Core::Internal;
59 59
60struct z_button z_buttons [] = { 60struct z_button z_buttons [] = {
61 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), 61 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"),
62 "devicebuttons/z_calendar", 62 "devicebuttons/z_calendar",
63 "datebook", "nextView()", 63 "datebook", "nextView()",
64 "today", "raise()" }, 64 "today", "raise()" },
65 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), 65 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"),
66 "devicebuttons/z_contact", 66 "devicebuttons/z_contact",
67 "addressbook", "raise()", 67 "addressbook", "raise()",
68 "addressbook", "beamBusinessCard()" }, 68 "addressbook", "beamBusinessCard()" },
69 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), 69 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
70 "devicebuttons/z_home", 70 "devicebuttons/z_home",
71 "QPE/Launcher", "home()", 71 "QPE/Launcher", "home()",
72 "buttonsettings", "raise()" }, 72 "buttonsettings", "raise()" },
73 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), 73 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
74 "devicebuttons/z_menu", 74 "devicebuttons/z_menu",
75 "QPE/TaskBar", "toggleMenu()", 75 "QPE/TaskBar", "toggleMenu()",
76 "QPE/TaskBar", "toggleStartMenu()" }, 76 "QPE/TaskBar", "toggleStartMenu()" },
77 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), 77 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"),
78 "devicebuttons/z_mail", 78 "devicebuttons/z_mail",
79 "opiemail", "raise()", 79 "opiemail", "raise()",
80 "opiemail", "newMail()" }, 80 "opiemail", "newMail()" },
81}; 81};
82 82
83struct z_button z_buttons_c700 [] = { 83struct z_button z_buttons_c700 [] = {
84 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), 84 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"),
85 "devicebuttons/z_calendar", 85 "devicebuttons/z_calendar",
86 "datebook", "nextView()", 86 "datebook", "nextView()",
87 "today", "raise()" }, 87 "today", "raise()" },
88 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), 88 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"),
89 "devicebuttons/z_contact", 89 "devicebuttons/z_contact",
90 "addressbook", "raise()", 90 "addressbook", "raise()",
91 "addressbook", "beamBusinessCard()" }, 91 "addressbook", "beamBusinessCard()" },
92 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), 92 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
93 "devicebuttons/z_home", 93 "devicebuttons/z_home",
94 "QPE/Launcher", "home()", 94 "QPE/Launcher", "home()",
95 "buttonsettings", "raise()" }, 95 "buttonsettings", "raise()" },
96 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), 96 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
97 "devicebuttons/z_menu", 97 "devicebuttons/z_menu",
98 "QPE/TaskBar", "toggleMenu()", 98 "QPE/TaskBar", "toggleMenu()",
99 "QPE/TaskBar", "toggleStartMenu()" }, 99 "QPE/TaskBar", "toggleStartMenu()" },
100 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), 100 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"),
101 "devicebuttons/z_mail", 101 "devicebuttons/z_mail",
102 "opiemail", "raise()", 102 "opiemail", "raise()",
103 "opiemail", "newMail()" }, 103 "opiemail", "newMail()" },
104 104
105 { Qt::Key_F15, QT_TRANSLATE_NOOP("Button", "Hinge1"), 105 { Qt::Key_F15, QT_TRANSLATE_NOOP("Button", "Hinge1"),
106 "devicebuttons/z_hinge1", 106 "devicebuttons/z_hinge1",
107 "QPE/Rotation", "rotateDefault()", 107 "QPE/Rotation", "rotateDefault()",0},
108 "QPE/Rotation", "rotateDefault()" },
109 { Qt::Key_F16, QT_TRANSLATE_NOOP("Button", "Hinge2"), 108 { Qt::Key_F16, QT_TRANSLATE_NOOP("Button", "Hinge2"),
110 "devicebuttons/z_hinge2", 109 "devicebuttons/z_hinge2",
111 "QPE/Rotation", "rotateDefault()", 110 "QPE/Rotation", "rotateDefault()",0},
112 "QPE/Rotation", "rotateDefault()" },
113 { Qt::Key_F17, QT_TRANSLATE_NOOP("Button", "Hinge3"), 111 { Qt::Key_F17, QT_TRANSLATE_NOOP("Button", "Hinge3"),
114 "devicebuttons/z_hinge3", 112 "devicebuttons/z_hinge3",
115 "QPE/Rotation", "rotateDefault()", 113 "QPE/Rotation", "rotateDefault()",0},
116 "QPE/Rotation", "rotateDefault()" },
117}; 114};
118 115
119// FIXME This gets unnecessary complicated. We should think about splitting the Zaurus 116// FIXME This gets unnecessary complicated. We should think about splitting the Zaurus
120// class up into individual classes. We need three classes 117// class up into individual classes. We need three classes
121// 118//
122// Zaurus-Collie (SA-model w/ 320x240 lcd, for SL5500 and SL5000) 119// Zaurus-Collie (SA-model w/ 320x240 lcd, for SL5500 and SL5000)
123// Zaurus-Poodle (PXA-model w/ 320x240 lcd, for SL5600) 120// Zaurus-Poodle (PXA-model w/ 320x240 lcd, for SL5600)
124// Zaurus-Corgi (PXA-model w/ 640x480 lcd, for C700, C750, C760, C860, C3000) 121// Zaurus-Corgi (PXA-model w/ 640x480 lcd, for C700, C750, C760, C860, C3000)
125// Zaurus-Tosa (PXA-model w/ 480x640 lcd, for SL6000) 122// Zaurus-Tosa (PXA-model w/ 480x640 lcd, for SL6000)
126// 123//
127// Only question right now is: Do we really need to do it? Because as soon 124// Only question right now is: Do we really need to do it? Because as soon
128// as the OpenZaurus kernel is ready, there will be a unified interface for all 125// as the OpenZaurus kernel is ready, there will be a unified interface for all
129// Zaurus models (concerning apm, backlight, buttons, etc.) 126// Zaurus models (concerning apm, backlight, buttons, etc.)
130// 127//
131// Comments? - mickeyl. 128// Comments? - mickeyl.
132 129
133void Zaurus::init(const QString& cpu_info) 130void Zaurus::init(const QString& cpu_info)
134{ 131{
135 // Set the time to wait until the system is realy suspended 132 // Set the time to wait until the system is realy suspended
136 // the delta between apm --suspend and sleeping 133 // the delta between apm --suspend and sleeping
137 setAPMTimeOut( 15000 ); 134 setAPMTimeOut( 15000 );
138 135
139 // generic distribution code already scanned /etc/issue at that point - 136 // generic distribution code already scanned /etc/issue at that point -
140 // embedix releases contain "Embedix <version> | Linux for Embedded Devices" 137 // embedix releases contain "Embedix <version> | Linux for Embedded Devices"
141 if ( d->m_sysverstr.contains( "embedix", false ) ) 138 if ( d->m_sysverstr.contains( "embedix", false ) )
142 { 139 {
143 d->m_vendorstr = "Sharp"; 140 d->m_vendorstr = "Sharp";
144 d->m_vendor = Vendor_Sharp; 141 d->m_vendor = Vendor_Sharp;
145 d->m_systemstr = "Zaurus"; 142 d->m_systemstr = "Zaurus";
146 d->m_system = System_Zaurus; 143 d->m_system = System_Zaurus;
147 m_embedix = true; 144 m_embedix = true;
148 } 145 }
149 else 146 else
150 { 147 {
151 d->m_vendorstr = "OpenZaurus Team"; 148 d->m_vendorstr = "OpenZaurus Team";
152 d->m_systemstr = "OpenZaurus"; 149 d->m_systemstr = "OpenZaurus";
153 d->m_system = System_OpenZaurus; 150 d->m_system = System_OpenZaurus;
154 // sysver already gathered 151 // sysver already gathered
155 152
156 // OpenZaurus sometimes uses the embedix kernel, check if this is one 153 // OpenZaurus sometimes uses the embedix kernel, check if this is one
157 FILE *uname = popen("uname -r", "r"); 154 FILE *uname = popen("uname -r", "r");
158 QFile f; 155 QFile f;
159 QString line; 156 QString line;
160 if ( f.open(IO_ReadOnly, uname) ) { 157 if ( f.open(IO_ReadOnly, uname) ) {
161 QTextStream ts ( &f ); 158 QTextStream ts ( &f );
162 line = ts. readLine(); 159 line = ts. readLine();
163 int loc = line. find ( "embedix" ); 160 int loc = line. find ( "embedix" );
164 if ( loc != -1 ) 161 if ( loc != -1 )
165 m_embedix = true; 162 m_embedix = true;
166 else 163 else
167 m_embedix = false; 164 m_embedix = false;
168 f.close(); 165 f.close();
169 } 166 }
170 pclose(uname); 167 pclose(uname);
171 } 168 }
172 169
173 // check the Zaurus model 170 // check the Zaurus model
174 QString model; 171 QString model;
175 int loc = cpu_info.find( ":" ); 172 int loc = cpu_info.find( ":" );
176 if ( loc != -1 ) 173 if ( loc != -1 )
177 model = cpu_info.mid( loc+2 ).simplifyWhiteSpace(); 174 model = cpu_info.mid( loc+2 ).simplifyWhiteSpace();
178 else 175 else
179 model = cpu_info; 176 model = cpu_info;
180 177
181 if ( model == "SHARP Corgi" ) { 178 if ( model == "SHARP Corgi" ) {
182 d->m_model = Model_Zaurus_SLC7x0; 179 d->m_model = Model_Zaurus_SLC7x0;
183 d->m_modelstr = "Zaurus SL-C700"; 180 d->m_modelstr = "Zaurus SL-C700";
184 } else if ( model == "SHARP Shepherd" ) { 181 } else if ( model == "SHARP Shepherd" ) {
185 d->m_model = Model_Zaurus_SLC7x0; 182 d->m_model = Model_Zaurus_SLC7x0;
186 d->m_modelstr = "Zaurus SL-C750"; 183 d->m_modelstr = "Zaurus SL-C750";
187 } else if ( model == "SHARP Husky" ) { 184 } else if ( model == "SHARP Husky" ) {
188 d->m_model = Model_Zaurus_SLC7x0; 185 d->m_model = Model_Zaurus_SLC7x0;
189 d->m_modelstr = "Zaurus SL-C760 or SL-C860"; 186 d->m_modelstr = "Zaurus SL-C760 or SL-C860";
190 } else if ( model == "SHARP Boxer" ) { 187 } else if ( model == "SHARP Boxer" ) {
191 d->m_model = Model_Zaurus_SLC7x0; 188 d->m_model = Model_Zaurus_SLC7x0;
192 d->m_modelstr = "Zaurus SL-C760 or SL-C860"; 189 d->m_modelstr = "Zaurus SL-C760 or SL-C860";
193 } else if ( model == "SHARP Poodle" ) { 190 } else if ( model == "SHARP Poodle" ) {
194 d->m_model = Model_Zaurus_SLB600; 191 d->m_model = Model_Zaurus_SLB600;
195 d->m_modelstr = "Zaurus SL-B500 or SL-5600"; 192 d->m_modelstr = "Zaurus SL-B500 or SL-5600";
196 } else if ( model == "Sharp-Collie" || model == "Collie" ) { 193 } else if ( model == "Sharp-Collie" || model == "Collie" ) {
197 d->m_model = Model_Zaurus_SL5500; 194 d->m_model = Model_Zaurus_SL5500;
198 d->m_modelstr = "Zaurus SL-5500 or SL-5000d"; 195 d->m_modelstr = "Zaurus SL-5500 or SL-5000d";
199 } else if ( model == "SHARP Tosa" ) { 196 } else if ( model == "SHARP Tosa" ) {
200 d->m_model = Model_Zaurus_SL6000; 197 d->m_model = Model_Zaurus_SL6000;
201 d->m_modelstr = "Zaurus SL-6000"; 198 d->m_modelstr = "Zaurus SL-6000";
202 } else if ( model == "SHARP Spitz" ) { 199 } else if ( model == "SHARP Spitz" ) {
203 d->m_model = Model_Zaurus_SLC3000; 200 d->m_model = Model_Zaurus_SLC3000;
204 d->m_modelstr = "Zaurus SL-C3000"; 201 d->m_modelstr = "Zaurus SL-C3000";
205 } else { 202 } else {
206 d->m_model = Model_Zaurus_SL5500; 203 d->m_model = Model_Zaurus_SL5500;
207 d->m_modelstr = "Unknown Zaurus"; 204 d->m_modelstr = "Unknown Zaurus";
208 } 205 }
209 206
210 // set initial rotation 207 // set initial rotation
211 switch( d->m_model ) { 208 switch( d->m_model ) {
212 case Model_Zaurus_SL6000: // fallthrough 209 case Model_Zaurus_SL6000: // fallthrough
213 case Model_Zaurus_SLA300: 210 case Model_Zaurus_SLA300:
214 d->m_rotation = Rot0; 211 d->m_rotation = Rot0;
215 break; 212 break;
216 case Model_Zaurus_SLC3000: // fallthrough 213 case Model_Zaurus_SLC3000: // fallthrough
217 case Model_Zaurus_SLC7x0: 214 case Model_Zaurus_SLC7x0:
218 d->m_rotation = rotation(); 215 d->m_rotation = rotation();
219 d->m_direction = direction(); 216 d->m_direction = direction();
220 break; 217 break;
221 case Model_Zaurus_SLB600: // fallthrough 218 case Model_Zaurus_SLB600: // fallthrough
222 case Model_Zaurus_SL5000: // fallthrough 219 case Model_Zaurus_SL5000: // fallthrough
223 case Model_Zaurus_SL5500: // fallthrough 220 case Model_Zaurus_SL5500: // fallthrough
224 default: 221 default:
225 d->m_rotation = Rot270; 222 d->m_rotation = Rot270;
226 break; 223 break;
227 } 224 }
228 m_leds[0] = Led_Off; 225 m_leds[0] = Led_Off;
229 226
230 if ( m_embedix ) 227 if ( m_embedix )
231 qDebug( "Zaurus::init() - Using the Embedix HAL on a %s", (const char*) d->m_modelstr ); 228 qDebug( "Zaurus::init() - Using the Embedix HAL on a %s", (const char*) d->m_modelstr );
232 else 229 else
233 qDebug( "Zaurus::init() - Using the OpenZaurus HAL on a %s", (const char*) d->m_modelstr ); 230 qDebug( "Zaurus::init() - Using the OpenZaurus HAL on a %s", (const char*) d->m_modelstr );
234} 231}
235 232
236void Zaurus::initButtons() 233void Zaurus::initButtons()
237{ 234{
238 if ( d->m_buttons ) 235 if ( d->m_buttons )
239 return; 236 return;
240 237
241 238
242 d->m_buttons = new QValueList <ODeviceButton>; 239 d->m_buttons = new QValueList <ODeviceButton>;
243 240
244 struct z_button * pz_buttons; 241 struct z_button * pz_buttons;
245 int buttoncount; 242 int buttoncount;
246 switch ( d->m_model ) { 243 switch ( d->m_model ) {
247 case Model_Zaurus_SLC3000: // fallthrough 244 case Model_Zaurus_SLC3000: // fallthrough
248 case Model_Zaurus_SLC7x0: 245 case Model_Zaurus_SLC7x0:
249 if ( isQWS( ) ) { 246 if ( isQWS( ) ) {
250 addPreHandler(this); // hinge-sensor-handler 247 addPreHandler(this); // hinge-sensor-handler
251 } 248 }
252 pz_buttons = z_buttons_c700; 249 pz_buttons = z_buttons_c700;
253 buttoncount = ARRAY_SIZE(z_buttons_c700); 250 buttoncount = ARRAY_SIZE(z_buttons_c700);
254 break; 251 break;
255 default: 252 default:
256 pz_buttons = z_buttons; 253 pz_buttons = z_buttons;
257 buttoncount = ARRAY_SIZE(z_buttons); 254 buttoncount = ARRAY_SIZE(z_buttons);
258 break; 255 break;
259 } 256 }
260 257
261 for ( int i = 0; i < buttoncount; i++ ) { 258 for ( int i = 0; i < buttoncount; i++ ) {
262 struct z_button *zb = pz_buttons + i; 259 struct z_button *zb = pz_buttons + i;
263 ODeviceButton b; 260 ODeviceButton b;
264 261
265 b.setKeycode( zb->code ); 262 b.setKeycode( zb->code );
266 b.setUserText( QObject::tr( "Button", zb->utext )); 263 b.setUserText( QObject::tr( "Button", zb->utext ));
267 b.setPixmap( Resource::loadPixmap( zb->pix )); 264 b.setPixmap( Resource::loadPixmap( zb->pix ));
268 b.setFactoryPresetPressedAction( OQCopMessage( makeChannel ( zb->fpressedservice ), zb->fpressedaction )); 265 b.setFactoryPresetPressedAction( OQCopMessage( makeChannel ( zb->fpressedservice ), zb->fpressedaction ));
269 b.setFactoryPresetHeldAction( OQCopMessage( makeChannel ( zb->fheldservice ), zb->fheldaction )); 266 b.setFactoryPresetHeldAction( OQCopMessage( makeChannel ( zb->fheldservice ), zb->fheldaction ));
270 d->m_buttons->append( b ); 267 d->m_buttons->append( b );
271 } 268 }
272 269
273 reloadButtonMapping(); 270 reloadButtonMapping();
274} 271}
275 272
276 273
277 274
278typedef struct sharp_led_status { 275typedef struct sharp_led_status {
279 int which; /* select which LED status is wanted. */ 276 int which; /* select which LED status is wanted. */
280 int status; /* set new led status if you call SHARP_LED_SETSTATUS */ 277 int status; /* set new led status if you call SHARP_LED_SETSTATUS */
281} sharp_led_status; 278} sharp_led_status;
282 279
283void Zaurus::buzzer( int sound ) 280void Zaurus::buzzer( int sound )
284{ 281{
285#ifndef QT_NO_SOUND 282#ifndef QT_NO_SOUND
286 Sound *snd = 0; 283 Sound *snd = 0;
287 284
288 // All devices except SL5500 have a DSP device 285 // All devices except SL5500 have a DSP device
289 if ( d->m_model != Model_Zaurus_SL5000 286 if ( d->m_model != Model_Zaurus_SL5000
290 && d->m_model != Model_Zaurus_SL5500 ) { 287 && d->m_model != Model_Zaurus_SL5500 ) {
291 288
292 switch ( sound ){ 289 switch ( sound ){
293 case SHARP_BUZ_TOUCHSOUND: { 290 case SHARP_BUZ_TOUCHSOUND: {
294 static Sound touch_sound("touchsound"); 291 static Sound touch_sound("touchsound");
295 snd = &touch_sound; 292 snd = &touch_sound;
296 } 293 }
297 break; 294 break;
298 case SHARP_BUZ_KEYSOUND: { 295 case SHARP_BUZ_KEYSOUND: {
299 static Sound key_sound( "keysound" ); 296 static Sound key_sound( "keysound" );
300 snd = &key_sound; 297 snd = &key_sound;
301 } 298 }
302 break; 299 break;
303 case SHARP_BUZ_SCHEDULE_ALARM: 300 case SHARP_BUZ_SCHEDULE_ALARM:
304 default: { 301 default: {
305 static Sound alarm_sound("alarm"); 302 static Sound alarm_sound("alarm");
306 snd = &alarm_sound; 303 snd = &alarm_sound;
307 } 304 }
308 break; 305 break;
309 } 306 }
310 } 307 }
311 308
312 // If a soundname is defined, we expect that this device has 309 // If a soundname is defined, we expect that this device has
313 // sound capabilities.. Otherwise we expect to have the buzzer 310 // sound capabilities.. Otherwise we expect to have the buzzer
314 // device.. 311 // device..
315 if ( snd && snd->isFinished() ){ 312 if ( snd && snd->isFinished() ){
316 changeMixerForAlarm( 0, "/dev/sound/mixer", snd ); 313 changeMixerForAlarm( 0, "/dev/sound/mixer", snd );
317 snd->play(); 314 snd->play();
318 } else if( !snd ) { 315 } else if( !snd ) {
319 int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK ); 316 int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK );
320 317
321 if ( fd >= 0 ) { 318 if ( fd >= 0 ) {
322 ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound ); 319 ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound );
323 ::close ( fd ); 320 ::close ( fd );
324 } 321 }
325 322
326 } 323 }
327#endif 324#endif
328} 325}
329 326
330 327
331void Zaurus::playAlarmSound() 328void Zaurus::playAlarmSound()
332{ 329{
333 buzzer( SHARP_BUZ_SCHEDULE_ALARM ); 330 buzzer( SHARP_BUZ_SCHEDULE_ALARM );
334} 331}
335 332
336void Zaurus::playTouchSound() 333void Zaurus::playTouchSound()
337{ 334{
338 buzzer( SHARP_BUZ_TOUCHSOUND ); 335 buzzer( SHARP_BUZ_TOUCHSOUND );
339} 336}
340 337
341void Zaurus::playKeySound() 338void Zaurus::playKeySound()
342{ 339{
343 buzzer( SHARP_BUZ_KEYSOUND ); 340 buzzer( SHARP_BUZ_KEYSOUND );
344} 341}
345 342
346 343
347QValueList <OLed> Zaurus::ledList() const 344QValueList <OLed> Zaurus::ledList() const
348{ 345{
349 QValueList <OLed> vl; 346 QValueList <OLed> vl;
350 vl << Led_Mail; 347 vl << Led_Mail;
351 return vl; 348 return vl;
352} 349}
353 350
354QValueList <OLedState> Zaurus::ledStateList( OLed l ) const 351QValueList <OLedState> Zaurus::ledStateList( OLed l ) const
355{ 352{
356 QValueList <OLedState> vl; 353 QValueList <OLedState> vl;
357 354
358 if ( l == Led_Mail ) 355 if ( l == Led_Mail )
359 vl << Led_Off << Led_On << Led_BlinkSlow; 356 vl << Led_Off << Led_On << Led_BlinkSlow;
360 return vl; 357 return vl;
361} 358}
362 359
363OLedState Zaurus::ledState( OLed which ) const 360OLedState Zaurus::ledState( OLed which ) const
364{ 361{
365 if ( which == Led_Mail ) 362 if ( which == Led_Mail )
366 return m_leds [0]; 363 return m_leds [0];
367 else 364 else
368 return Led_Off; 365 return Led_Off;
369} 366}
370 367
371bool Zaurus::setLedState( OLed which, OLedState st ) 368bool Zaurus::setLedState( OLed which, OLedState st )
372{ 369{