author | llornkcor <llornkcor> | 2004-08-17 22:43:56 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2004-08-17 22:43:56 (UTC) |
commit | 5e11a688c1b9f1d411322df6fb3d4d96613fd44d (patch) (unidiff) | |
tree | 123fea1b43e59c06835cd26d6fb3203a84d72357 /libopie2 | |
parent | 502c9b68e4739b6d487bb2ccd98e34535b7d4f77 (diff) | |
download | opie-5e11a688c1b9f1d411322df6fb3d4d96613fd44d.zip opie-5e11a688c1b9f1d411322df6fb3d4d96613fd44d.tar.gz opie-5e11a688c1b9f1d411322df6fb3d4d96613fd44d.tar.bz2 |
add sl-6000
-rw-r--r-- | libopie2/opiecore/device/odevice.h | 1 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_zaurus.cpp | 4 |
2 files changed, 5 insertions, 0 deletions
diff --git a/libopie2/opiecore/device/odevice.h b/libopie2/opiecore/device/odevice.h index 762d3f1..cb7a83f 100644 --- a/libopie2/opiecore/device/odevice.h +++ b/libopie2/opiecore/device/odevice.h | |||
@@ -1,268 +1,269 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) The Opie Team <opie-devel@handhelds.org> | 3 | Copyright (C) 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 | #ifndef ODEVICE_H_ | 30 | #ifndef ODEVICE_H_ |
31 | #define ODEVICE_H_ | 31 | #define ODEVICE_H_ |
32 | 32 | ||
33 | /* OPIE */ | 33 | /* OPIE */ |
34 | #include <opie2/odevicebutton.h> | 34 | #include <opie2/odevicebutton.h> |
35 | #include <qpe/qpeapplication.h> /* for Transformation enum.. */ | 35 | #include <qpe/qpeapplication.h> /* for Transformation enum.. */ |
36 | 36 | ||
37 | /* QT */ | 37 | /* QT */ |
38 | #include <qnamespace.h> | 38 | #include <qnamespace.h> |
39 | #include <qobject.h> | 39 | #include <qobject.h> |
40 | #include <qstring.h> | 40 | #include <qstring.h> |
41 | #include <qstrlist.h> | 41 | #include <qstrlist.h> |
42 | #include <qwindowsystem_qws.h> | 42 | #include <qwindowsystem_qws.h> |
43 | 43 | ||
44 | namespace Opie{ | 44 | namespace Opie{ |
45 | namespace Core{ | 45 | namespace Core{ |
46 | 46 | ||
47 | class ODeviceData; | 47 | class ODeviceData; |
48 | /** | 48 | /** |
49 | * The available devices | 49 | * The available devices |
50 | */ | 50 | */ |
51 | enum OModel { | 51 | enum OModel { |
52 | Model_Unknown, // = 0 | 52 | Model_Unknown, // = 0 |
53 | 53 | ||
54 | Model_Series_Mask = 0xff000000, | 54 | Model_Series_Mask = 0xff000000, |
55 | 55 | ||
56 | Model_iPAQ = ( 1 << 24 ), | 56 | Model_iPAQ = ( 1 << 24 ), |
57 | 57 | ||
58 | Model_iPAQ_All = ( Model_iPAQ | 0xffffff ), | 58 | Model_iPAQ_All = ( Model_iPAQ | 0xffffff ), |
59 | Model_iPAQ_H31xx = ( Model_iPAQ | 0x000001 ), | 59 | Model_iPAQ_H31xx = ( Model_iPAQ | 0x000001 ), |
60 | Model_iPAQ_H36xx = ( Model_iPAQ | 0x000002 ), | 60 | Model_iPAQ_H36xx = ( Model_iPAQ | 0x000002 ), |
61 | Model_iPAQ_H37xx = ( Model_iPAQ | 0x000004 ), | 61 | Model_iPAQ_H37xx = ( Model_iPAQ | 0x000004 ), |
62 | Model_iPAQ_H38xx = ( Model_iPAQ | 0x000008 ), | 62 | Model_iPAQ_H38xx = ( Model_iPAQ | 0x000008 ), |
63 | Model_iPAQ_H39xx = ( Model_iPAQ | 0x000010 ), | 63 | Model_iPAQ_H39xx = ( Model_iPAQ | 0x000010 ), |
64 | Model_iPAQ_H5xxx = ( Model_iPAQ | 0x000020 ), | 64 | Model_iPAQ_H5xxx = ( Model_iPAQ | 0x000020 ), |
65 | Model_iPAQ_H22xx = ( Model_iPAQ | 0x000040 ), | 65 | Model_iPAQ_H22xx = ( Model_iPAQ | 0x000040 ), |
66 | 66 | ||
67 | Model_Jornada = ( 6 << 24 ), | 67 | Model_Jornada = ( 6 << 24 ), |
68 | Model_Jornada_56x = ( Model_Jornada | 0x000001 ), | 68 | Model_Jornada_56x = ( Model_Jornada | 0x000001 ), |
69 | 69 | ||
70 | Model_Zaurus = ( 2 << 24 ), | 70 | Model_Zaurus = ( 2 << 24 ), |
71 | 71 | ||
72 | Model_Zaurus_SL5000 = ( Model_Zaurus | 0x000001 ), | 72 | Model_Zaurus_SL5000 = ( Model_Zaurus | 0x000001 ), |
73 | Model_Zaurus_SL5500 = ( Model_Zaurus | 0x000002 ), | 73 | Model_Zaurus_SL5500 = ( Model_Zaurus | 0x000002 ), |
74 | Model_Zaurus_SLA300 = ( Model_Zaurus | 0x000003 ), | 74 | Model_Zaurus_SLA300 = ( Model_Zaurus | 0x000003 ), |
75 | Model_Zaurus_SLB600 = ( Model_Zaurus | 0x000004 ), | 75 | Model_Zaurus_SLB600 = ( Model_Zaurus | 0x000004 ), |
76 | Model_Zaurus_SLC7x0 = ( Model_Zaurus | 0x000005 ), | 76 | Model_Zaurus_SLC7x0 = ( Model_Zaurus | 0x000005 ), |
77 | Model_Zaurus_SL6000 = ( Model_Zaurus | 0x000006 ), | ||
77 | 78 | ||
78 | Model_SIMpad = ( 3 << 24 ), | 79 | Model_SIMpad = ( 3 << 24 ), |
79 | 80 | ||
80 | Model_SIMpad_All = ( Model_SIMpad | 0xffffff ), | 81 | Model_SIMpad_All = ( Model_SIMpad | 0xffffff ), |
81 | Model_SIMpad_CL4 = ( Model_SIMpad | 0x000001 ), | 82 | Model_SIMpad_CL4 = ( Model_SIMpad | 0x000001 ), |
82 | Model_SIMpad_SL4 = ( Model_SIMpad | 0x000002 ), | 83 | Model_SIMpad_SL4 = ( Model_SIMpad | 0x000002 ), |
83 | Model_SIMpad_SLC = ( Model_SIMpad | 0x000004 ), | 84 | Model_SIMpad_SLC = ( Model_SIMpad | 0x000004 ), |
84 | Model_SIMpad_TSinus = ( Model_SIMpad | 0x000008 ), | 85 | Model_SIMpad_TSinus = ( Model_SIMpad | 0x000008 ), |
85 | 86 | ||
86 | Model_Ramses = ( 4 << 24 ), | 87 | Model_Ramses = ( 4 << 24 ), |
87 | 88 | ||
88 | Model_Ramses_All = ( Model_Ramses | 0xffffff ), | 89 | Model_Ramses_All = ( Model_Ramses | 0xffffff ), |
89 | Model_Ramses_MNCI = ( Model_Ramses | 0x000001 ), | 90 | Model_Ramses_MNCI = ( Model_Ramses | 0x000001 ), |
90 | 91 | ||
91 | Model_Yopy = ( 5 << 24 ), | 92 | Model_Yopy = ( 5 << 24 ), |
92 | 93 | ||
93 | Model_Yopy_All = ( Model_Yopy | 0xffffff ), | 94 | Model_Yopy_All = ( Model_Yopy | 0xffffff ), |
94 | Model_Yopy_3000 = ( Model_Yopy | 0x000001 ), | 95 | Model_Yopy_3000 = ( Model_Yopy | 0x000001 ), |
95 | Model_Yopy_3500 = ( Model_Yopy | 0x000002 ), | 96 | Model_Yopy_3500 = ( Model_Yopy | 0x000002 ), |
96 | Model_Yopy_3700 = ( Model_Yopy | 0x000003 ), | 97 | Model_Yopy_3700 = ( Model_Yopy | 0x000003 ), |
97 | 98 | ||
98 | Model_Beagle = ( 6 << 24 ), | 99 | Model_Beagle = ( 6 << 24 ), |
99 | 100 | ||
100 | Model_Beagle_All = ( Model_Beagle | 0xffffff ), | 101 | Model_Beagle_All = ( Model_Beagle | 0xffffff ), |
101 | Model_Beagle_PA100 = ( Model_Beagle | 0x000001 ), | 102 | Model_Beagle_PA100 = ( Model_Beagle | 0x000001 ), |
102 | 103 | ||
103 | }; | 104 | }; |
104 | 105 | ||
105 | /** | 106 | /** |
106 | * The vendor of the device | 107 | * The vendor of the device |
107 | */ | 108 | */ |
108 | enum OVendor { | 109 | enum OVendor { |
109 | Vendor_Unknown, | 110 | Vendor_Unknown, |
110 | 111 | ||
111 | Vendor_HP, | 112 | Vendor_HP, |
112 | Vendor_Sharp, | 113 | Vendor_Sharp, |
113 | Vendor_SIEMENS, | 114 | Vendor_SIEMENS, |
114 | Vendor_MundN, | 115 | Vendor_MundN, |
115 | Vendor_GMate, | 116 | Vendor_GMate, |
116 | Vendor_MasterIA, | 117 | Vendor_MasterIA, |
117 | }; | 118 | }; |
118 | 119 | ||
119 | /** | 120 | /** |
120 | * The System used | 121 | * The System used |
121 | */ | 122 | */ |
122 | enum OSystem { | 123 | enum OSystem { |
123 | System_Unknown, | 124 | System_Unknown, |
124 | 125 | ||
125 | System_Familiar, | 126 | System_Familiar, |
126 | System_Zaurus, | 127 | System_Zaurus, |
127 | System_OpenZaurus, | 128 | System_OpenZaurus, |
128 | System_Linupy, | 129 | System_Linupy, |
129 | System_OpenEmbedded, | 130 | System_OpenEmbedded, |
130 | }; | 131 | }; |
131 | 132 | ||
132 | typedef struct { | 133 | typedef struct { |
133 | OSystem system; | 134 | OSystem system; |
134 | char* sysstr; | 135 | char* sysstr; |
135 | char* sysvfile; | 136 | char* sysvfile; |
136 | } ODistribution; | 137 | } ODistribution; |
137 | 138 | ||
138 | extern ODistribution distributions[]; | 139 | extern ODistribution distributions[]; |
139 | 140 | ||
140 | 141 | ||
141 | enum OLedState { | 142 | enum OLedState { |
142 | Led_Off, | 143 | Led_Off, |
143 | Led_On, | 144 | Led_On, |
144 | Led_BlinkSlow, | 145 | Led_BlinkSlow, |
145 | Led_BlinkFast | 146 | Led_BlinkFast |
146 | }; | 147 | }; |
147 | 148 | ||
148 | enum OLed { | 149 | enum OLed { |
149 | Led_Mail, | 150 | Led_Mail, |
150 | Led_Power, | 151 | Led_Power, |
151 | Led_BlueTooth | 152 | Led_BlueTooth |
152 | }; | 153 | }; |
153 | 154 | ||
154 | enum OHardKey { | 155 | enum OHardKey { |
155 | HardKey_Datebook = Qt::Key_F9, | 156 | HardKey_Datebook = Qt::Key_F9, |
156 | HardKey_Contacts = Qt::Key_F10, | 157 | HardKey_Contacts = Qt::Key_F10, |
157 | HardKey_Menu = Qt::Key_F11, | 158 | HardKey_Menu = Qt::Key_F11, |
158 | HardKey_Home = Qt::Key_F12, | 159 | HardKey_Home = Qt::Key_F12, |
159 | HardKey_Mail = Qt::Key_F13, | 160 | HardKey_Mail = Qt::Key_F13, |
160 | HardKey_Record = Qt::Key_F24, | 161 | HardKey_Record = Qt::Key_F24, |
161 | HardKey_Suspend = Qt::Key_F34, | 162 | HardKey_Suspend = Qt::Key_F34, |
162 | HardKey_Backlight = Qt::Key_F35, | 163 | HardKey_Backlight = Qt::Key_F35, |
163 | HardKey_Action = Qt::Key_F10, | 164 | HardKey_Action = Qt::Key_F10, |
164 | HardKey_OK = Qt::Key_F11, | 165 | HardKey_OK = Qt::Key_F11, |
165 | HardKey_End = Qt::Key_F12, | 166 | HardKey_End = Qt::Key_F12, |
166 | }; | 167 | }; |
167 | 168 | ||
168 | enum ODirection { | 169 | enum ODirection { |
169 | CW = 0, | 170 | CW = 0, |
170 | CCW = 1, | 171 | CCW = 1, |
171 | Flip = 2, | 172 | Flip = 2, |
172 | }; | 173 | }; |
173 | 174 | ||
174 | enum OHingeStatus { | 175 | enum OHingeStatus { |
175 | CASE_CLOSED = 3, | 176 | CASE_CLOSED = 3, |
176 | CASE_PORTRAIT = 2, | 177 | CASE_PORTRAIT = 2, |
177 | CASE_LANDSCAPE = 0, | 178 | CASE_LANDSCAPE = 0, |
178 | CASE_UNKNOWN = 1, | 179 | CASE_UNKNOWN = 1, |
179 | }; | 180 | }; |
180 | 181 | ||
181 | /* default button for qvfb or such | 182 | /* default button for qvfb or such |
182 | * see odevice.cpp for details. | 183 | * see odevice.cpp for details. |
183 | * hint: manage a user defined button for qvfb? | 184 | * hint: manage a user defined button for qvfb? |
184 | * alwin | 185 | * alwin |
185 | */ | 186 | */ |
186 | struct default_button { | 187 | struct default_button { |
187 | Qt::Key code; | 188 | Qt::Key code; |
188 | char *utext; | 189 | char *utext; |
189 | char *pix; | 190 | char *pix; |
190 | char *fpressedservice; | 191 | char *fpressedservice; |
191 | char *fpressedaction; | 192 | char *fpressedaction; |
192 | char *fheldservice; | 193 | char *fheldservice; |
193 | char *fheldaction; | 194 | char *fheldaction; |
194 | }; | 195 | }; |
195 | 196 | ||
196 | /** | 197 | /** |
197 | * A singleton which gives informations about device specefic option | 198 | * A singleton which gives informations about device specefic option |
198 | * like the Hardware used, LEDs, the Base Distribution and | 199 | * like the Hardware used, LEDs, the Base Distribution and |
199 | * hardware key mappings. | 200 | * hardware key mappings. |
200 | * | 201 | * |
201 | * @short A small class for device specefic options | 202 | * @short A small class for device specefic options |
202 | * @see QObject | 203 | * @see QObject |
203 | * @author Robert Griebl | 204 | * @author Robert Griebl |
204 | * @version 1.0 | 205 | * @version 1.0 |
205 | */ | 206 | */ |
206 | class ODevice : public QObject | 207 | class ODevice : public QObject |
207 | { | 208 | { |
208 | Q_OBJECT | 209 | Q_OBJECT |
209 | 210 | ||
210 | private: | 211 | private: |
211 | /* disable copy */ | 212 | /* disable copy */ |
212 | ODevice ( const ODevice & ); | 213 | ODevice ( const ODevice & ); |
213 | 214 | ||
214 | protected: | 215 | protected: |
215 | ODevice(); | 216 | ODevice(); |
216 | virtual void init(const QString&); | 217 | virtual void init(const QString&); |
217 | virtual void initButtons(); | 218 | virtual void initButtons(); |
218 | static void sendSuspendmsg(); | 219 | static void sendSuspendmsg(); |
219 | 220 | ||
220 | ODeviceData *d; | 221 | ODeviceData *d; |
221 | 222 | ||
222 | public: | 223 | public: |
223 | // sandman do we want to allow destructions? -zecke? | 224 | // sandman do we want to allow destructions? -zecke? |
224 | virtual ~ODevice(); | 225 | virtual ~ODevice(); |
225 | 226 | ||
226 | static ODevice *inst(); | 227 | static ODevice *inst(); |
227 | 228 | ||
228 | // information | 229 | // information |
229 | 230 | ||
230 | QString modelString() const; | 231 | QString modelString() const; |
231 | OModel model() const; | 232 | OModel model() const; |
232 | inline OModel series() const { return (OModel) ( model() & Model_Series_Mask ); } | 233 | inline OModel series() const { return (OModel) ( model() & Model_Series_Mask ); } |
233 | 234 | ||
234 | QString vendorString() const; | 235 | QString vendorString() const; |
235 | OVendor vendor() const; | 236 | OVendor vendor() const; |
236 | 237 | ||
237 | QString systemString() const; | 238 | QString systemString() const; |
238 | OSystem system() const; | 239 | OSystem system() const; |
239 | 240 | ||
240 | QString systemVersionString() const; | 241 | QString systemVersionString() const; |
241 | 242 | ||
242 | virtual Transformation rotation() const; | 243 | virtual Transformation rotation() const; |
243 | virtual ODirection direction() const; | 244 | virtual ODirection direction() const; |
244 | 245 | ||
245 | // system | 246 | // system |
246 | 247 | ||
247 | virtual bool setSoftSuspend ( bool on ); | 248 | virtual bool setSoftSuspend ( bool on ); |
248 | virtual bool suspend(); | 249 | virtual bool suspend(); |
249 | 250 | ||
250 | virtual bool setDisplayStatus ( bool on ); | 251 | virtual bool setDisplayStatus ( bool on ); |
251 | virtual bool setDisplayBrightness ( int brightness ); | 252 | virtual bool setDisplayBrightness ( int brightness ); |
252 | virtual int displayBrightnessResolution() const; | 253 | virtual int displayBrightnessResolution() const; |
253 | virtual bool setDisplayContrast ( int contrast ); | 254 | virtual bool setDisplayContrast ( int contrast ); |
254 | virtual int displayContrastResolution() const; | 255 | virtual int displayContrastResolution() const; |
255 | 256 | ||
256 | // don't add new virtual methods, use this: | 257 | // don't add new virtual methods, use this: |
257 | // /*virtual */ void boo(int i ) { return virtual_hook(1,&i); }; | 258 | // /*virtual */ void boo(int i ) { return virtual_hook(1,&i); }; |
258 | // and in your subclass do do overwrite | 259 | // and in your subclass do do overwrite |
259 | // protected virtual int virtual_hook(int, void *) | 260 | // protected virtual int virtual_hook(int, void *) |
260 | // which is defined below | 261 | // which is defined below |
261 | 262 | ||
262 | // input / output | 263 | // input / output |
263 | virtual void playAlarmSound(); | 264 | virtual void playAlarmSound(); |
264 | virtual void playKeySound(); | 265 | virtual void playKeySound(); |
265 | virtual void playTouchSound(); | 266 | virtual void playTouchSound(); |
266 | 267 | ||
267 | virtual QValueList <OLed> ledList() const; | 268 | virtual QValueList <OLed> ledList() const; |
268 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; | 269 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; |
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp index 6ac3157..47682bb 100644 --- a/libopie2/opiecore/device/odevice_zaurus.cpp +++ b/libopie2/opiecore/device/odevice_zaurus.cpp | |||
@@ -1,377 +1,381 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) The Opie Team <opie-devel@handhelds.org> | 3 | Copyright (C) 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 <qpe/config.h> | 39 | #include <qpe/config.h> |
40 | #include <qpe/resource.h> | 40 | #include <qpe/resource.h> |
41 | #include <qpe/sound.h> | 41 | #include <qpe/sound.h> |
42 | #include <qpe/qcopenvelope_qws.h> | 42 | #include <qpe/qcopenvelope_qws.h> |
43 | 43 | ||
44 | /* STD */ | 44 | /* STD */ |
45 | #include <fcntl.h> | 45 | #include <fcntl.h> |
46 | #include <math.h> | 46 | #include <math.h> |
47 | #include <stdlib.h> | 47 | #include <stdlib.h> |
48 | #include <signal.h> | 48 | #include <signal.h> |
49 | #include <sys/ioctl.h> | 49 | #include <sys/ioctl.h> |
50 | #include <sys/time.h> | 50 | #include <sys/time.h> |
51 | #include <unistd.h> | 51 | #include <unistd.h> |
52 | #ifndef QT_NO_SOUND | 52 | #ifndef QT_NO_SOUND |
53 | #include <linux/soundcard.h> | 53 | #include <linux/soundcard.h> |
54 | #endif | 54 | #endif |
55 | 55 | ||
56 | using namespace Opie::Core; | 56 | using namespace Opie::Core; |
57 | using namespace Opie::Core::Internal; | 57 | using namespace Opie::Core::Internal; |
58 | 58 | ||
59 | struct z_button z_buttons [] = { | 59 | struct z_button z_buttons [] = { |
60 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), | 60 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), |
61 | "devicebuttons/z_calendar", | 61 | "devicebuttons/z_calendar", |
62 | "datebook", "nextView()", | 62 | "datebook", "nextView()", |
63 | "today", "raise()" }, | 63 | "today", "raise()" }, |
64 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), | 64 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), |
65 | "devicebuttons/z_contact", | 65 | "devicebuttons/z_contact", |
66 | "addressbook", "raise()", | 66 | "addressbook", "raise()", |
67 | "addressbook", "beamBusinessCard()" }, | 67 | "addressbook", "beamBusinessCard()" }, |
68 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), | 68 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), |
69 | "devicebuttons/z_home", | 69 | "devicebuttons/z_home", |
70 | "QPE/Launcher", "home()", | 70 | "QPE/Launcher", "home()", |
71 | "buttonsettings", "raise()" }, | 71 | "buttonsettings", "raise()" }, |
72 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), | 72 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), |
73 | "devicebuttons/z_menu", | 73 | "devicebuttons/z_menu", |
74 | "QPE/TaskBar", "toggleMenu()", | 74 | "QPE/TaskBar", "toggleMenu()", |
75 | "QPE/TaskBar", "toggleStartMenu()" }, | 75 | "QPE/TaskBar", "toggleStartMenu()" }, |
76 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), | 76 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), |
77 | "devicebuttons/z_mail", | 77 | "devicebuttons/z_mail", |
78 | "opiemail", "raise()", | 78 | "opiemail", "raise()", |
79 | "opiemail", "newMail()" }, | 79 | "opiemail", "newMail()" }, |
80 | }; | 80 | }; |
81 | 81 | ||
82 | struct z_button z_buttons_c700 [] = { | 82 | struct z_button z_buttons_c700 [] = { |
83 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), | 83 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), |
84 | "devicebuttons/z_calendar", | 84 | "devicebuttons/z_calendar", |
85 | "datebook", "nextView()", | 85 | "datebook", "nextView()", |
86 | "today", "raise()" }, | 86 | "today", "raise()" }, |
87 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), | 87 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), |
88 | "devicebuttons/z_contact", | 88 | "devicebuttons/z_contact", |
89 | "addressbook", "raise()", | 89 | "addressbook", "raise()", |
90 | "addressbook", "beamBusinessCard()" }, | 90 | "addressbook", "beamBusinessCard()" }, |
91 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), | 91 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), |
92 | "devicebuttons/z_home", | 92 | "devicebuttons/z_home", |
93 | "QPE/Launcher", "home()", | 93 | "QPE/Launcher", "home()", |
94 | "buttonsettings", "raise()" }, | 94 | "buttonsettings", "raise()" }, |
95 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), | 95 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), |
96 | "devicebuttons/z_menu", | 96 | "devicebuttons/z_menu", |
97 | "QPE/TaskBar", "toggleMenu()", | 97 | "QPE/TaskBar", "toggleMenu()", |
98 | "QPE/TaskBar", "toggleStartMenu()" }, | 98 | "QPE/TaskBar", "toggleStartMenu()" }, |
99 | { Qt::Key_F14, QT_TRANSLATE_NOOP("Button", "Display Rotate"), | 99 | { Qt::Key_F14, QT_TRANSLATE_NOOP("Button", "Display Rotate"), |
100 | "devicebuttons/z_hinge", | 100 | "devicebuttons/z_hinge", |
101 | "QPE/Rotation", "rotateDefault()", | 101 | "QPE/Rotation", "rotateDefault()", |
102 | "QPE/Dummy", "doNothing()" }, | 102 | "QPE/Dummy", "doNothing()" }, |
103 | }; | 103 | }; |
104 | 104 | ||
105 | // FIXME This gets unnecessary complicated. We should think about splitting the Zaurus | 105 | // FIXME This gets unnecessary complicated. We should think about splitting the Zaurus |
106 | // class up into individual classes. We need three classes | 106 | // class up into individual classes. We need three classes |
107 | // | 107 | // |
108 | // Zaurus-Collie (SA-model w/ 320x240 lcd, for SL5500 and SL5000) | 108 | // Zaurus-Collie (SA-model w/ 320x240 lcd, for SL5500 and SL5000) |
109 | // Zaurus-Poodle (PXA-model w/ 320x240 lcd, for SL5600) | 109 | // Zaurus-Poodle (PXA-model w/ 320x240 lcd, for SL5600) |
110 | // Zaurus-Corgi (PXA-model w/ 640x480 lcd, for C700, C750, C760, and C860) | 110 | // Zaurus-Corgi (PXA-model w/ 640x480 lcd, for C700, C750, C760, and C860) |
111 | // | 111 | // |
112 | // Only question right now is: Do we really need to do it? Because as soon | 112 | // Only question right now is: Do we really need to do it? Because as soon |
113 | // as the OpenZaurus kernel is ready, there will be a unified interface for all | 113 | // as the OpenZaurus kernel is ready, there will be a unified interface for all |
114 | // Zaurus models (concerning apm, backlight, buttons, etc.) | 114 | // Zaurus models (concerning apm, backlight, buttons, etc.) |
115 | // | 115 | // |
116 | // Comments? - mickeyl. | 116 | // Comments? - mickeyl. |
117 | 117 | ||
118 | void Zaurus::init(const QString& cpu_info) | 118 | void Zaurus::init(const QString& cpu_info) |
119 | { | 119 | { |
120 | // generic distribution code already scanned /etc/issue at that point - | 120 | // generic distribution code already scanned /etc/issue at that point - |
121 | // embedix releases contain "Embedix <version> | Linux for Embedded Devices" | 121 | // embedix releases contain "Embedix <version> | Linux for Embedded Devices" |
122 | if ( d->m_sysverstr.contains( "embedix", false ) ) | 122 | if ( d->m_sysverstr.contains( "embedix", false ) ) |
123 | { | 123 | { |
124 | d->m_vendorstr = "Sharp"; | 124 | d->m_vendorstr = "Sharp"; |
125 | d->m_vendor = Vendor_Sharp; | 125 | d->m_vendor = Vendor_Sharp; |
126 | d->m_systemstr = "Zaurus"; | 126 | d->m_systemstr = "Zaurus"; |
127 | d->m_system = System_Zaurus; | 127 | d->m_system = System_Zaurus; |
128 | m_embedix = true; | 128 | m_embedix = true; |
129 | } | 129 | } |
130 | else | 130 | else |
131 | { | 131 | { |
132 | d->m_vendorstr = "OpenZaurus Team"; | 132 | d->m_vendorstr = "OpenZaurus Team"; |
133 | d->m_systemstr = "OpenZaurus"; | 133 | d->m_systemstr = "OpenZaurus"; |
134 | d->m_system = System_OpenZaurus; | 134 | d->m_system = System_OpenZaurus; |
135 | // sysver already gathered | 135 | // sysver already gathered |
136 | 136 | ||
137 | // Openzaurus sometimes uses the embedix kernel, check if this is one | 137 | // Openzaurus sometimes uses the embedix kernel, check if this is one |
138 | FILE *uname = popen("uname -r", "r"); | 138 | FILE *uname = popen("uname -r", "r"); |
139 | QFile f; | 139 | QFile f; |
140 | QString line; | 140 | QString line; |
141 | if ( f.open(IO_ReadOnly, uname) ) { | 141 | if ( f.open(IO_ReadOnly, uname) ) { |
142 | QTextStream ts ( &f ); | 142 | QTextStream ts ( &f ); |
143 | line = ts. readLine(); | 143 | line = ts. readLine(); |
144 | int loc = line. find ( "embedix" ); | 144 | int loc = line. find ( "embedix" ); |
145 | if ( loc != -1 ) | 145 | if ( loc != -1 ) |
146 | m_embedix = true; | 146 | m_embedix = true; |
147 | else | 147 | else |
148 | m_embedix = false; | 148 | m_embedix = false; |
149 | f.close(); | 149 | f.close(); |
150 | } | 150 | } |
151 | pclose(uname); | 151 | pclose(uname); |
152 | } | 152 | } |
153 | 153 | ||
154 | // check the Zaurus model | 154 | // check the Zaurus model |
155 | QString model; | 155 | QString model; |
156 | int loc = cpu_info.find( ":" ); | 156 | int loc = cpu_info.find( ":" ); |
157 | if ( loc != -1 ) | 157 | if ( loc != -1 ) |
158 | model = cpu_info.mid( loc+2 ).simplifyWhiteSpace(); | 158 | model = cpu_info.mid( loc+2 ).simplifyWhiteSpace(); |
159 | else | 159 | else |
160 | model = cpu_info; | 160 | model = cpu_info; |
161 | 161 | ||
162 | if ( model == "SHARP Corgi" ) { | 162 | if ( model == "SHARP Corgi" ) { |
163 | d->m_model = Model_Zaurus_SLC7x0; | 163 | d->m_model = Model_Zaurus_SLC7x0; |
164 | d->m_modelstr = "Zaurus SL-C700"; | 164 | d->m_modelstr = "Zaurus SL-C700"; |
165 | } else if ( model == "SHARP Shepherd" ) { | 165 | } else if ( model == "SHARP Shepherd" ) { |
166 | d->m_model = Model_Zaurus_SLC7x0; | 166 | d->m_model = Model_Zaurus_SLC7x0; |
167 | d->m_modelstr = "Zaurus SL-C750"; | 167 | d->m_modelstr = "Zaurus SL-C750"; |
168 | } else if ( model == "SHARP Husky" ) { | 168 | } else if ( model == "SHARP Husky" ) { |
169 | d->m_model = Model_Zaurus_SLC7x0; | 169 | d->m_model = Model_Zaurus_SLC7x0; |
170 | d->m_modelstr = "Zaurus SL-C760"; | 170 | d->m_modelstr = "Zaurus SL-C760"; |
171 | } else if ( model == "SHARP Poodle" ) { | 171 | } else if ( model == "SHARP Poodle" ) { |
172 | d->m_model = Model_Zaurus_SLB600; | 172 | d->m_model = Model_Zaurus_SLB600; |
173 | d->m_modelstr = "Zaurus SL-B500 or SL-5600"; | 173 | d->m_modelstr = "Zaurus SL-B500 or SL-5600"; |
174 | } else if ( model == "Sharp-Collie" || model == "Collie" ) { | 174 | } else if ( model == "Sharp-Collie" || model == "Collie" ) { |
175 | d->m_model = Model_Zaurus_SL5500; | 175 | d->m_model = Model_Zaurus_SL5500; |
176 | d->m_modelstr = "Zaurus SL-5500 or SL-5000d"; | 176 | d->m_modelstr = "Zaurus SL-5500 or SL-5000d"; |
177 | } else if ( model == "SHARP Tosa" ) { | ||
178 | d->m_model = Model_Zaurus_SL6000; | ||
179 | d->m_modelstr = "Zaurus SL-6000"; | ||
177 | } else { | 180 | } else { |
178 | d->m_model = Model_Zaurus_SL5500; | 181 | d->m_model = Model_Zaurus_SL5500; |
179 | d->m_modelstr = "Unkown Zaurus"; | 182 | d->m_modelstr = "Unkown Zaurus"; |
180 | } | 183 | } |
181 | 184 | ||
182 | // set initial rotation | 185 | // set initial rotation |
183 | 186 | ||
184 | bool flipstate = false; | 187 | bool flipstate = false; |
185 | switch ( d->m_model ) { | 188 | switch ( d->m_model ) { |
189 | case Model_Zaurus_SL6000: | ||
186 | case Model_Zaurus_SLA300: | 190 | case Model_Zaurus_SLA300: |
187 | d->m_rotation = Rot0; | 191 | d->m_rotation = Rot0; |
188 | break; | 192 | break; |
189 | case Model_Zaurus_SLC7x0: | 193 | case Model_Zaurus_SLC7x0: |
190 | d->m_rotation = rotation(); | 194 | d->m_rotation = rotation(); |
191 | d->m_direction = direction(); | 195 | d->m_direction = direction(); |
192 | break; | 196 | break; |
193 | case Model_Zaurus_SLB600: | 197 | case Model_Zaurus_SLB600: |
194 | case Model_Zaurus_SL5500: | 198 | case Model_Zaurus_SL5500: |
195 | case Model_Zaurus_SL5000: | 199 | case Model_Zaurus_SL5000: |
196 | default: | 200 | default: |
197 | d->m_rotation = Rot270; | 201 | d->m_rotation = Rot270; |
198 | break; | 202 | break; |
199 | } | 203 | } |
200 | m_leds [0] = Led_Off; | 204 | m_leds [0] = Led_Off; |
201 | } | 205 | } |
202 | 206 | ||
203 | void Zaurus::initButtons() | 207 | void Zaurus::initButtons() |
204 | { | 208 | { |
205 | if ( d->m_buttons ) | 209 | if ( d->m_buttons ) |
206 | return; | 210 | return; |
207 | 211 | ||
208 | d->m_buttons = new QValueList <ODeviceButton>; | 212 | d->m_buttons = new QValueList <ODeviceButton>; |
209 | 213 | ||
210 | struct z_button * pz_buttons; | 214 | struct z_button * pz_buttons; |
211 | int buttoncount; | 215 | int buttoncount; |
212 | switch ( d->m_model ) { | 216 | switch ( d->m_model ) { |
213 | case Model_Zaurus_SLC7x0: | 217 | case Model_Zaurus_SLC7x0: |
214 | pz_buttons = z_buttons_c700; | 218 | pz_buttons = z_buttons_c700; |
215 | buttoncount = ARRAY_SIZE(z_buttons_c700); | 219 | buttoncount = ARRAY_SIZE(z_buttons_c700); |
216 | break; | 220 | break; |
217 | default: | 221 | default: |
218 | pz_buttons = z_buttons; | 222 | pz_buttons = z_buttons; |
219 | buttoncount = ARRAY_SIZE(z_buttons); | 223 | buttoncount = ARRAY_SIZE(z_buttons); |
220 | break; | 224 | break; |
221 | } | 225 | } |
222 | 226 | ||
223 | for ( int i = 0; i < buttoncount; i++ ) { | 227 | for ( int i = 0; i < buttoncount; i++ ) { |
224 | struct z_button *zb = pz_buttons + i; | 228 | struct z_button *zb = pz_buttons + i; |
225 | ODeviceButton b; | 229 | ODeviceButton b; |
226 | 230 | ||
227 | b. setKeycode ( zb->code ); | 231 | b. setKeycode ( zb->code ); |
228 | b. setUserText ( QObject::tr ( "Button", zb->utext )); | 232 | b. setUserText ( QObject::tr ( "Button", zb->utext )); |
229 | b. setPixmap ( Resource::loadPixmap ( zb->pix )); | 233 | b. setPixmap ( Resource::loadPixmap ( zb->pix )); |
230 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( zb->fpressedservice ), | 234 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( zb->fpressedservice ), |
231 | zb->fpressedaction )); | 235 | zb->fpressedaction )); |
232 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( zb->fheldservice ), | 236 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( zb->fheldservice ), |
233 | zb->fheldaction )); | 237 | zb->fheldaction )); |
234 | 238 | ||
235 | d->m_buttons->append ( b ); | 239 | d->m_buttons->append ( b ); |
236 | } | 240 | } |
237 | 241 | ||
238 | reloadButtonMapping(); | 242 | reloadButtonMapping(); |
239 | 243 | ||
240 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); | 244 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); |
241 | connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), | 245 | connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), |
242 | this, SLOT( systemMessage(const QCString&,const QByteArray&))); | 246 | this, SLOT( systemMessage(const QCString&,const QByteArray&))); |
243 | } | 247 | } |
244 | 248 | ||
245 | #include <unistd.h> | 249 | #include <unistd.h> |
246 | #include <fcntl.h> | 250 | #include <fcntl.h> |
247 | #include <sys/ioctl.h> | 251 | #include <sys/ioctl.h> |
248 | 252 | ||
249 | //#include <asm/sharp_char.h> // including kernel headers is evil ... | 253 | //#include <asm/sharp_char.h> // including kernel headers is evil ... |
250 | 254 | ||
251 | #define SHARP_DEV_IOCTL_COMMAND_START 0x5680 | 255 | #define SHARP_DEV_IOCTL_COMMAND_START 0x5680 |
252 | 256 | ||
253 | #defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) | 257 | #defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) |
254 | #define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) | 258 | #define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) |
255 | 259 | ||
256 | #define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ | 260 | #define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ |
257 | #define SHARP_BUZ_KEYSOUND 2 /* key sound */ | 261 | #define SHARP_BUZ_KEYSOUND 2 /* key sound */ |
258 | #define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ | 262 | #define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ |
259 | 263 | ||
260 | /* --- for SHARP_BUZZER device --- */ | 264 | /* --- for SHARP_BUZZER device --- */ |
261 | 265 | ||
262 | //#defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) | 266 | //#defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) |
263 | //#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) | 267 | //#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) |
264 | 268 | ||
265 | #define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1) | 269 | #define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1) |
266 | #define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2) | 270 | #define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2) |
267 | #define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3) | 271 | #define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3) |
268 | #define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4) | 272 | #define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4) |
269 | #define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5) | 273 | #define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5) |
270 | 274 | ||
271 | //#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ | 275 | //#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ |
272 | //#define SHARP_BUZ_KEYSOUND 2 /* key sound */ | 276 | //#define SHARP_BUZ_KEYSOUND 2 /* key sound */ |
273 | 277 | ||
274 | //#define SHARP_PDA_ILLCLICKSOUND 3 /* illegal click */ | 278 | //#define SHARP_PDA_ILLCLICKSOUND 3 /* illegal click */ |
275 | //#define SHARP_PDA_WARNSOUND 4 /* warning occurred */ | 279 | //#define SHARP_PDA_WARNSOUND 4 /* warning occurred */ |
276 | //#define SHARP_PDA_ERRORSOUND 5 /* error occurred */ | 280 | //#define SHARP_PDA_ERRORSOUND 5 /* error occurred */ |
277 | //#define SHARP_PDA_CRITICALSOUND 6 /* critical error occurred */ | 281 | //#define SHARP_PDA_CRITICALSOUND 6 /* critical error occurred */ |
278 | //#define SHARP_PDA_SYSSTARTSOUND 7 /* system start */ | 282 | //#define SHARP_PDA_SYSSTARTSOUND 7 /* system start */ |
279 | //#define SHARP_PDA_SYSTEMENDSOUND 8 /* system shutdown */ | 283 | //#define SHARP_PDA_SYSTEMENDSOUND 8 /* system shutdown */ |
280 | //#define SHARP_PDA_APPSTART 9 /* application start */ | 284 | //#define SHARP_PDA_APPSTART 9 /* application start */ |
281 | //#define SHARP_PDA_APPQUIT 10 /* application ends */ | 285 | //#define SHARP_PDA_APPQUIT 10 /* application ends */ |
282 | 286 | ||
283 | //#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ | 287 | //#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ |
284 | //#define SHARP_BUZ_DAILY_ALARM 12 /* daily alarm */ | 288 | //#define SHARP_BUZ_DAILY_ALARM 12 /* daily alarm */ |
285 | //#define SHARP_BUZ_GOT_PHONE_CALL 13 /* phone call sound */ | 289 | //#define SHARP_BUZ_GOT_PHONE_CALL 13 /* phone call sound */ |
286 | //#define SHARP_BUZ_GOT_MAIL 14 /* mail sound */ | 290 | //#define SHARP_BUZ_GOT_MAIL 14 /* mail sound */ |
287 | // | 291 | // |
288 | 292 | ||
289 | #defineSHARP_LED_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) | 293 | #defineSHARP_LED_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) |
290 | #define SHARP_LED_SETSTATUS (SHARP_LED_IOCTL_START+1) | 294 | #define SHARP_LED_SETSTATUS (SHARP_LED_IOCTL_START+1) |
291 | 295 | ||
292 | #define SHARP_IOCTL_GET_ROTATION 0x413c | 296 | #define SHARP_IOCTL_GET_ROTATION 0x413c |
293 | 297 | ||
294 | typedef struct sharp_led_status { | 298 | typedef struct sharp_led_status { |
295 | int which; /* select which LED status is wanted. */ | 299 | int which; /* select which LED status is wanted. */ |
296 | int status; /* set new led status if you call SHARP_LED_SETSTATUS */ | 300 | int status; /* set new led status if you call SHARP_LED_SETSTATUS */ |
297 | } sharp_led_status; | 301 | } sharp_led_status; |
298 | 302 | ||
299 | #define SHARP_LED_MAIL_EXISTS 9 /* mail status (exists or not) */ | 303 | #define SHARP_LED_MAIL_EXISTS 9 /* mail status (exists or not) */ |
300 | 304 | ||
301 | #define LED_MAIL_NO_UNREAD_MAIL 0 /* for SHARP_LED_MAIL_EXISTS */ | 305 | #define LED_MAIL_NO_UNREAD_MAIL 0 /* for SHARP_LED_MAIL_EXISTS */ |
302 | #define LED_MAIL_NEWMAIL_EXISTS 1 /* for SHARP_LED_MAIL_EXISTS */ | 306 | #define LED_MAIL_NEWMAIL_EXISTS 1 /* for SHARP_LED_MAIL_EXISTS */ |
303 | #define LED_MAIL_UNREAD_MAIL_EX 2 /* for SHARP_LED_MAIL_EXISTS */ | 307 | #define LED_MAIL_UNREAD_MAIL_EX 2 /* for SHARP_LED_MAIL_EXISTS */ |
304 | 308 | ||
305 | // #include <asm/sharp_apm.h> // including kernel headers is evil ... | 309 | // #include <asm/sharp_apm.h> // including kernel headers is evil ... |
306 | 310 | ||
307 | #define APM_IOCGEVTSRC OD_IOR( 'A', 203, int ) | 311 | #define APM_IOCGEVTSRC OD_IOR( 'A', 203, int ) |
308 | #define APM_IOCSEVTSRC OD_IORW( 'A', 204, int ) | 312 | #define APM_IOCSEVTSRC OD_IORW( 'A', 204, int ) |
309 | #define APM_EVT_POWER_BUTTON (1 << 0) | 313 | #define APM_EVT_POWER_BUTTON (1 << 0) |
310 | 314 | ||
311 | #define FL_IOCTL_STEP_CONTRAST 100 | 315 | #define FL_IOCTL_STEP_CONTRAST 100 |
312 | 316 | ||
313 | 317 | ||
314 | void Zaurus::buzzer ( int sound ) | 318 | void Zaurus::buzzer ( int sound ) |
315 | { | 319 | { |
316 | #ifndef QT_NO_SOUND | 320 | #ifndef QT_NO_SOUND |
317 | QString soundname; | 321 | QString soundname; |
318 | 322 | ||
319 | // Not all devices have real sound | 323 | // Not all devices have real sound |
320 | if ( d->m_model == Model_Zaurus_SLC7x0 | 324 | if ( d->m_model == Model_Zaurus_SLC7x0 |
321 | || d->m_model == Model_Zaurus_SLB600 ){ | 325 | || d->m_model == Model_Zaurus_SLB600 ){ |
322 | 326 | ||
323 | switch ( sound ){ | 327 | switch ( sound ){ |
324 | case SHARP_BUZ_SCHEDULE_ALARM: | 328 | case SHARP_BUZ_SCHEDULE_ALARM: |
325 | soundname = "alarm"; | 329 | soundname = "alarm"; |
326 | break; | 330 | break; |
327 | case SHARP_BUZ_TOUCHSOUND: | 331 | case SHARP_BUZ_TOUCHSOUND: |
328 | soundname = "touchsound"; | 332 | soundname = "touchsound"; |
329 | break; | 333 | break; |
330 | case SHARP_BUZ_KEYSOUND: | 334 | case SHARP_BUZ_KEYSOUND: |
331 | soundname = "keysound"; | 335 | soundname = "keysound"; |
332 | break; | 336 | break; |
333 | default: | 337 | default: |
334 | soundname = "alarm"; | 338 | soundname = "alarm"; |
335 | 339 | ||
336 | } | 340 | } |
337 | } | 341 | } |
338 | 342 | ||
339 | // If a soundname is defined, we expect that this device has | 343 | // If a soundname is defined, we expect that this device has |
340 | // sound capabilities.. Otherwise we expect to have the buzzer | 344 | // sound capabilities.. Otherwise we expect to have the buzzer |
341 | // device.. | 345 | // device.. |
342 | if ( !soundname.isEmpty() ){ | 346 | if ( !soundname.isEmpty() ){ |
343 | int fd; | 347 | int fd; |
344 | int vol; | 348 | int vol; |
345 | bool vol_reset = false; | 349 | bool vol_reset = false; |
346 | 350 | ||
347 | Sound snd ( soundname ); | 351 | Sound snd ( soundname ); |
348 | 352 | ||
349 | if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) { | 353 | if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) { |
350 | if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) { | 354 | if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) { |
351 | Config cfg ( "qpe" ); | 355 | Config cfg ( "qpe" ); |
352 | cfg. setGroup ( "Volume" ); | 356 | cfg. setGroup ( "Volume" ); |
353 | 357 | ||
354 | int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 ); | 358 | int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 ); |
355 | if ( volalarm < 0 ) | 359 | if ( volalarm < 0 ) |
356 | volalarm = 0; | 360 | volalarm = 0; |
357 | else if ( volalarm > 100 ) | 361 | else if ( volalarm > 100 ) |
358 | volalarm = 100; | 362 | volalarm = 100; |
359 | volalarm |= ( volalarm << 8 ); | 363 | volalarm |= ( volalarm << 8 ); |
360 | 364 | ||
361 | if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 ) | 365 | if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 ) |
362 | vol_reset = true; | 366 | vol_reset = true; |
363 | } | 367 | } |
364 | } | 368 | } |
365 | 369 | ||
366 | snd. play(); | 370 | snd. play(); |
367 | while ( !snd. isFinished()) | 371 | while ( !snd. isFinished()) |
368 | qApp->processEvents(); | 372 | qApp->processEvents(); |
369 | 373 | ||
370 | if ( fd >= 0 ) { | 374 | if ( fd >= 0 ) { |
371 | if ( vol_reset ) | 375 | if ( vol_reset ) |
372 | ::ioctl ( fd, MIXER_WRITE( 0 ), &vol ); | 376 | ::ioctl ( fd, MIXER_WRITE( 0 ), &vol ); |
373 | ::close ( fd ); | 377 | ::close ( fd ); |
374 | } | 378 | } |
375 | } else { | 379 | } else { |
376 | int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK ); | 380 | int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK ); |
377 | 381 | ||