author | mickeyl <mickeyl> | 2006-02-06 13:40:26 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2006-02-06 13:40:26 (UTC) |
commit | b5e868fd9f1dcc97c388f01f9b99ebfeb891133a (patch) (unidiff) | |
tree | 025a48bb1332c3114384b24979f01f51c5c3987a /libopie2 | |
parent | c5dee755c8f72f83bad3279659b58e1bd4cf28e1 (diff) | |
download | opie-b5e868fd9f1dcc97c388f01f9b99ebfeb891133a.zip opie-b5e868fd9f1dcc97c388f01f9b99ebfeb891133a.tar.gz opie-b5e868fd9f1dcc97c388f01f9b99ebfeb891133a.tar.bz2 |
odevice: tosa now uses corgi-bl. patch courtesy Dirk Opfer - thanks
-rw-r--r-- | libopie2/opiecore/device/odevice_zaurus.cpp | 3 |
1 files changed, 0 insertions, 3 deletions
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp index 8a7e252..28a1ccf 100644 --- a/libopie2/opiecore/device/odevice_zaurus.cpp +++ b/libopie2/opiecore/device/odevice_zaurus.cpp | |||
@@ -1,631 +1,628 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) 2002-2005 The Opie Team <opie-devel@handhelds.org> | 3 | Copyright (C) 2002-2005 The Opie Team <opie-devel@handhelds.org> |
4 | =. Copyright (C) 2002-2005 Michael 'Mickey' Lauer <mickey@Vanille.de> | 4 | =. Copyright (C) 2002-2005 Michael 'Mickey' Lauer <mickey@Vanille.de> |
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; version 2 of the License. | 11 | - . .-<_> .<> Foundation; version 2 of the License. |
12 | ._= =} : | 12 | ._= =} : |
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 | /* OPIE */ | 32 | /* OPIE */ |
33 | #include <opie2/oinputsystem.h> | 33 | #include <opie2/oinputsystem.h> |
34 | #include <opie2/oresource.h> | 34 | #include <opie2/oresource.h> |
35 | 35 | ||
36 | #include <qpe/config.h> | 36 | #include <qpe/config.h> |
37 | #include <qpe/sound.h> | 37 | #include <qpe/sound.h> |
38 | 38 | ||
39 | /* QT */ | 39 | /* QT */ |
40 | #include <qapplication.h> | 40 | #include <qapplication.h> |
41 | #include <qfile.h> | 41 | #include <qfile.h> |
42 | #include <qtextstream.h> | 42 | #include <qtextstream.h> |
43 | #include <qwindowsystem_qws.h> | 43 | #include <qwindowsystem_qws.h> |
44 | #include <qcopchannel_qws.h> | 44 | #include <qcopchannel_qws.h> |
45 | 45 | ||
46 | /* STD */ | 46 | /* STD */ |
47 | #include <string.h> | 47 | #include <string.h> |
48 | #include <errno.h> | 48 | #include <errno.h> |
49 | #include <fcntl.h> | 49 | #include <fcntl.h> |
50 | #include <math.h> | 50 | #include <math.h> |
51 | #include <stdlib.h> | 51 | #include <stdlib.h> |
52 | #include <signal.h> | 52 | #include <signal.h> |
53 | #include <sys/ioctl.h> | 53 | #include <sys/ioctl.h> |
54 | #include <sys/time.h> | 54 | #include <sys/time.h> |
55 | #include <unistd.h> | 55 | #include <unistd.h> |
56 | #ifndef QT_NO_SOUND | 56 | #ifndef QT_NO_SOUND |
57 | #include <linux/soundcard.h> | 57 | #include <linux/soundcard.h> |
58 | #endif | 58 | #endif |
59 | 59 | ||
60 | using namespace Opie::Core; | 60 | using namespace Opie::Core; |
61 | using namespace Opie::Core::Internal; | 61 | using namespace Opie::Core::Internal; |
62 | 62 | ||
63 | struct z_button z_buttons [] = { | 63 | struct z_button z_buttons [] = { |
64 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), | 64 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), |
65 | "devicebuttons/z_calendar", | 65 | "devicebuttons/z_calendar", |
66 | "datebook", "nextView()", | 66 | "datebook", "nextView()", |
67 | "today", "raise()" }, | 67 | "today", "raise()" }, |
68 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), | 68 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), |
69 | "devicebuttons/z_contact", | 69 | "devicebuttons/z_contact", |
70 | "addressbook", "raise()", | 70 | "addressbook", "raise()", |
71 | "addressbook", "beamBusinessCard()" }, | 71 | "addressbook", "beamBusinessCard()" }, |
72 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), | 72 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), |
73 | "devicebuttons/z_home", | 73 | "devicebuttons/z_home", |
74 | "QPE/Launcher", "home()", | 74 | "QPE/Launcher", "home()", |
75 | "buttonsettings", "raise()" }, | 75 | "buttonsettings", "raise()" }, |
76 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), | 76 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), |
77 | "devicebuttons/z_menu", | 77 | "devicebuttons/z_menu", |
78 | "QPE/TaskBar", "toggleMenu()", | 78 | "QPE/TaskBar", "toggleMenu()", |
79 | "QPE/TaskBar", "toggleStartMenu()" }, | 79 | "QPE/TaskBar", "toggleStartMenu()" }, |
80 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), | 80 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), |
81 | "devicebuttons/z_mail", | 81 | "devicebuttons/z_mail", |
82 | "opiemail", "raise()", | 82 | "opiemail", "raise()", |
83 | "opiemail", "newMail()" }, | 83 | "opiemail", "newMail()" }, |
84 | }; | 84 | }; |
85 | 85 | ||
86 | struct z_button z_buttons_c700 [] = { | 86 | struct z_button z_buttons_c700 [] = { |
87 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), | 87 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), |
88 | "devicebuttons/z_calendar", | 88 | "devicebuttons/z_calendar", |
89 | "datebook", "nextView()", | 89 | "datebook", "nextView()", |
90 | "today", "raise()" }, | 90 | "today", "raise()" }, |
91 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), | 91 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), |
92 | "devicebuttons/z_contact", | 92 | "devicebuttons/z_contact", |
93 | "addressbook", "raise()", | 93 | "addressbook", "raise()", |
94 | "addressbook", "beamBusinessCard()" }, | 94 | "addressbook", "beamBusinessCard()" }, |
95 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), | 95 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), |
96 | "devicebuttons/z_home", | 96 | "devicebuttons/z_home", |
97 | "QPE/Launcher", "home()", | 97 | "QPE/Launcher", "home()", |
98 | "buttonsettings", "raise()" }, | 98 | "buttonsettings", "raise()" }, |
99 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), | 99 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), |
100 | "devicebuttons/z_menu", | 100 | "devicebuttons/z_menu", |
101 | "QPE/TaskBar", "toggleMenu()", | 101 | "QPE/TaskBar", "toggleMenu()", |
102 | "QPE/TaskBar", "toggleStartMenu()" }, | 102 | "QPE/TaskBar", "toggleStartMenu()" }, |
103 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), | 103 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), |
104 | "devicebuttons/z_mail", | 104 | "devicebuttons/z_mail", |
105 | "opiemail", "raise()", | 105 | "opiemail", "raise()", |
106 | "opiemail", "newMail()" }, | 106 | "opiemail", "newMail()" }, |
107 | 107 | ||
108 | { Qt::Key_F15, QT_TRANSLATE_NOOP("Button", "Hinge1"), | 108 | { Qt::Key_F15, QT_TRANSLATE_NOOP("Button", "Hinge1"), |
109 | "devicebuttons/z_hinge1", | 109 | "devicebuttons/z_hinge1", |
110 | "QPE/Rotation", "rotateDefault()",0}, | 110 | "QPE/Rotation", "rotateDefault()",0}, |
111 | { Qt::Key_F16, QT_TRANSLATE_NOOP("Button", "Hinge2"), | 111 | { Qt::Key_F16, QT_TRANSLATE_NOOP("Button", "Hinge2"), |
112 | "devicebuttons/z_hinge2", | 112 | "devicebuttons/z_hinge2", |
113 | "QPE/Rotation", "rotateDefault()",0}, | 113 | "QPE/Rotation", "rotateDefault()",0}, |
114 | { Qt::Key_F17, QT_TRANSLATE_NOOP("Button", "Hinge3"), | 114 | { Qt::Key_F17, QT_TRANSLATE_NOOP("Button", "Hinge3"), |
115 | "devicebuttons/z_hinge3", | 115 | "devicebuttons/z_hinge3", |
116 | "QPE/Rotation", "rotateDefault()",0}, | 116 | "QPE/Rotation", "rotateDefault()",0}, |
117 | }; | 117 | }; |
118 | 118 | ||
119 | struct z_button z_buttons_6000 [] = { | 119 | struct z_button z_buttons_6000 [] = { |
120 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), | 120 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), |
121 | "devicebuttons/z_calendar", | 121 | "devicebuttons/z_calendar", |
122 | "datebook", "nextView()", | 122 | "datebook", "nextView()", |
123 | "today", "raise()" }, | 123 | "today", "raise()" }, |
124 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), | 124 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), |
125 | "devicebuttons/z_contact", | 125 | "devicebuttons/z_contact", |
126 | "addressbook", "raise()", | 126 | "addressbook", "raise()", |
127 | "addressbook", "beamBusinessCard()" }, | 127 | "addressbook", "beamBusinessCard()" }, |
128 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), | 128 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), |
129 | "devicebuttons/z_home", | 129 | "devicebuttons/z_home", |
130 | "QPE/Launcher", "home()", | 130 | "QPE/Launcher", "home()", |
131 | "buttonsettings", "raise()" }, | 131 | "buttonsettings", "raise()" }, |
132 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), | 132 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), |
133 | "devicebuttons/z_menu", | 133 | "devicebuttons/z_menu", |
134 | "QPE/TaskBar", "toggleMenu()", | 134 | "QPE/TaskBar", "toggleMenu()", |
135 | "QPE/TaskBar", "toggleStartMenu()" }, | 135 | "QPE/TaskBar", "toggleStartMenu()" }, |
136 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), | 136 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), |
137 | "devicebuttons/z_mail", | 137 | "devicebuttons/z_mail", |
138 | "opiemail", "raise()", | 138 | "opiemail", "raise()", |
139 | "opiemail", "newMail()" }, | 139 | "opiemail", "newMail()" }, |
140 | { Qt::Key_F15, QT_TRANSLATE_NOOP("Button", "Rotate Button"), | 140 | { Qt::Key_F15, QT_TRANSLATE_NOOP("Button", "Rotate Button"), |
141 | "devicebuttons/z_rotate", | 141 | "devicebuttons/z_rotate", |
142 | 0, | 142 | 0, |
143 | "QPE/Rotation", "rotateDefault()" }, | 143 | "QPE/Rotation", "rotateDefault()" }, |
144 | { Qt::Key_F24, QT_TRANSLATE_NOOP("Button", "Record Button"), | 144 | { Qt::Key_F24, QT_TRANSLATE_NOOP("Button", "Record Button"), |
145 | "devicebuttons/z_hinge3", | 145 | "devicebuttons/z_hinge3", |
146 | "QPE/VMemo", "toggleRecord()", | 146 | "QPE/VMemo", "toggleRecord()", |
147 | "sound", "raise()" }, | 147 | "sound", "raise()" }, |
148 | }; | 148 | }; |
149 | 149 | ||
150 | // FIXME This gets unnecessary complicated. We should think about splitting the Zaurus | 150 | // FIXME This gets unnecessary complicated. We should think about splitting the Zaurus |
151 | // class up into individual classes. We would need three classes | 151 | // class up into individual classes. We would need three classes |
152 | // | 152 | // |
153 | // Zaurus-Collie (SA-model w/ 320x240 lcd, for SL5500 and SL5000) | 153 | // Zaurus-Collie (SA-model w/ 320x240 lcd, for SL5500 and SL5000) |
154 | // Zaurus-Poodle (PXA-model w/ 320x240 lcd, for SL5600) | 154 | // Zaurus-Poodle (PXA-model w/ 320x240 lcd, for SL5600) |
155 | // Zaurus-Corgi (PXA-model w/ 640x480 lcd, for C700, C750, C760, C860, C3000, C1000, C3100) | 155 | // Zaurus-Corgi (PXA-model w/ 640x480 lcd, for C700, C750, C760, C860, C3000, C1000, C3100) |
156 | // Zaurus-Tosa (PXA-model w/ 480x640 lcd, for SL6000) | 156 | // Zaurus-Tosa (PXA-model w/ 480x640 lcd, for SL6000) |
157 | 157 | ||
158 | void Zaurus::init(const QString& cpu_info) | 158 | void Zaurus::init(const QString& cpu_info) |
159 | { | 159 | { |
160 | qDebug( "Zaurus::init()" ); | 160 | qDebug( "Zaurus::init()" ); |
161 | // Set the time to wait until the system is really suspended | 161 | // Set the time to wait until the system is really suspended |
162 | // the delta between apm --suspend and sleeping | 162 | // the delta between apm --suspend and sleeping |
163 | setAPMTimeOut( 15000 ); | 163 | setAPMTimeOut( 15000 ); |
164 | 164 | ||
165 | // generic distribution code already scanned /etc/issue at that point - | 165 | // generic distribution code already scanned /etc/issue at that point - |
166 | // embedix releases contain "Embedix <version> | Linux for Embedded Devices" | 166 | // embedix releases contain "Embedix <version> | Linux for Embedded Devices" |
167 | if ( d->m_sysverstr.contains( "embedix", false ) ) | 167 | if ( d->m_sysverstr.contains( "embedix", false ) ) |
168 | { | 168 | { |
169 | d->m_vendorstr = "Sharp"; | 169 | d->m_vendorstr = "Sharp"; |
170 | d->m_vendor = Vendor_Sharp; | 170 | d->m_vendor = Vendor_Sharp; |
171 | d->m_systemstr = "Zaurus"; | 171 | d->m_systemstr = "Zaurus"; |
172 | d->m_system = System_Zaurus; | 172 | d->m_system = System_Zaurus; |
173 | m_embedix = true; | 173 | m_embedix = true; |
174 | } | 174 | } |
175 | else | 175 | else |
176 | { | 176 | { |
177 | d->m_vendorstr = "OpenZaurus Team"; | 177 | d->m_vendorstr = "OpenZaurus Team"; |
178 | d->m_systemstr = "OpenZaurus"; | 178 | d->m_systemstr = "OpenZaurus"; |
179 | d->m_system = System_OpenZaurus; | 179 | d->m_system = System_OpenZaurus; |
180 | // sysver already gathered | 180 | // sysver already gathered |
181 | 181 | ||
182 | // OpenZaurus sometimes uses the 2.4 (embedix) kernel, check if this is one | 182 | // OpenZaurus sometimes uses the 2.4 (embedix) kernel, check if this is one |
183 | FILE *uname = popen("uname -r", "r"); | 183 | FILE *uname = popen("uname -r", "r"); |
184 | QFile f; | 184 | QFile f; |
185 | QString line; | 185 | QString line; |
186 | if ( f.open(IO_ReadOnly, uname) ) { | 186 | if ( f.open(IO_ReadOnly, uname) ) { |
187 | QTextStream ts ( &f ); | 187 | QTextStream ts ( &f ); |
188 | line = ts.readLine(); | 188 | line = ts.readLine(); |
189 | m_embedix = line.startsWith( "2.4." ); | 189 | m_embedix = line.startsWith( "2.4." ); |
190 | f.close(); | 190 | f.close(); |
191 | } | 191 | } |
192 | pclose(uname); | 192 | pclose(uname); |
193 | } | 193 | } |
194 | 194 | ||
195 | // check the Zaurus model | 195 | // check the Zaurus model |
196 | QString model; | 196 | QString model; |
197 | int loc = cpu_info.find( ":" ); | 197 | int loc = cpu_info.find( ":" ); |
198 | if ( loc != -1 ) | 198 | if ( loc != -1 ) |
199 | model = cpu_info.mid( loc+2 ).simplifyWhiteSpace(); | 199 | model = cpu_info.mid( loc+2 ).simplifyWhiteSpace(); |
200 | else | 200 | else |
201 | model = cpu_info; | 201 | model = cpu_info; |
202 | 202 | ||
203 | if ( model == "SHARP Corgi" ) { | 203 | if ( model == "SHARP Corgi" ) { |
204 | d->m_model = Model_Zaurus_SLC7x0; | 204 | d->m_model = Model_Zaurus_SLC7x0; |
205 | d->m_modelstr = "Zaurus SL-C700"; | 205 | d->m_modelstr = "Zaurus SL-C700"; |
206 | } else if ( model == "SHARP Shepherd" ) { | 206 | } else if ( model == "SHARP Shepherd" ) { |
207 | d->m_model = Model_Zaurus_SLC7x0; | 207 | d->m_model = Model_Zaurus_SLC7x0; |
208 | d->m_modelstr = "Zaurus SL-C750"; | 208 | d->m_modelstr = "Zaurus SL-C750"; |
209 | } else if ( model == "SHARP Husky" ) { | 209 | } else if ( model == "SHARP Husky" ) { |
210 | d->m_model = Model_Zaurus_SLC7x0; | 210 | d->m_model = Model_Zaurus_SLC7x0; |
211 | d->m_modelstr = "Zaurus SL-C760 or SL-C860"; | 211 | d->m_modelstr = "Zaurus SL-C760 or SL-C860"; |
212 | } else if ( model == "SHARP Boxer" ) { | 212 | } else if ( model == "SHARP Boxer" ) { |
213 | d->m_model = Model_Zaurus_SLC7x0; | 213 | d->m_model = Model_Zaurus_SLC7x0; |
214 | d->m_modelstr = "Zaurus SL-C760 or SL-C860"; | 214 | d->m_modelstr = "Zaurus SL-C760 or SL-C860"; |
215 | } else if ( model == "SHARP Poodle" ) { | 215 | } else if ( model == "SHARP Poodle" ) { |
216 | d->m_model = Model_Zaurus_SLB600; | 216 | d->m_model = Model_Zaurus_SLB600; |
217 | d->m_modelstr = "Zaurus SL-B500 or SL-5600"; | 217 | d->m_modelstr = "Zaurus SL-B500 or SL-5600"; |
218 | } else if ( model == "Sharp-Collie" || model == "Collie" ) { | 218 | } else if ( model == "Sharp-Collie" || model == "Collie" ) { |
219 | d->m_model = Model_Zaurus_SL5500; | 219 | d->m_model = Model_Zaurus_SL5500; |
220 | d->m_modelstr = "Zaurus SL-5500 or SL-5000d"; | 220 | d->m_modelstr = "Zaurus SL-5500 or SL-5000d"; |
221 | } else if ( model == "SHARP Tosa" ) { | 221 | } else if ( model == "SHARP Tosa" ) { |
222 | d->m_model = Model_Zaurus_SL6000; | 222 | d->m_model = Model_Zaurus_SL6000; |
223 | d->m_modelstr = "Zaurus SL-6000"; | 223 | d->m_modelstr = "Zaurus SL-6000"; |
224 | } else if ( model == "SHARP Spitz" ) { | 224 | } else if ( model == "SHARP Spitz" ) { |
225 | d->m_model = Model_Zaurus_SLC3000; | 225 | d->m_model = Model_Zaurus_SLC3000; |
226 | d->m_modelstr = "Zaurus SL-C3000"; | 226 | d->m_modelstr = "Zaurus SL-C3000"; |
227 | } else if ( model == "SHARP Akita" ) { | 227 | } else if ( model == "SHARP Akita" ) { |
228 | d->m_model = Model_Zaurus_SLC1000; | 228 | d->m_model = Model_Zaurus_SLC1000; |
229 | d->m_modelstr = "Zaurus SL-C1000"; | 229 | d->m_modelstr = "Zaurus SL-C1000"; |
230 | } else if ( model == "SHARP Borzoi" ) { | 230 | } else if ( model == "SHARP Borzoi" ) { |
231 | d->m_model = Model_Zaurus_SLC3100; | 231 | d->m_model = Model_Zaurus_SLC3100; |
232 | d->m_modelstr = "Zaurus SL-C3100"; | 232 | d->m_modelstr = "Zaurus SL-C3100"; |
233 | } else { | 233 | } else { |
234 | d->m_model = Model_Zaurus_SL5500; | 234 | d->m_model = Model_Zaurus_SL5500; |
235 | d->m_modelstr = "Unknown Zaurus"; | 235 | d->m_modelstr = "Unknown Zaurus"; |
236 | } | 236 | } |
237 | 237 | ||
238 | // set path to backlight device in kernel 2.6 | 238 | // set path to backlight device in kernel 2.6 |
239 | switch ( d->m_model ) | 239 | switch ( d->m_model ) |
240 | { | 240 | { |
241 | case Model_Zaurus_SLB600: // fallthrough | 241 | case Model_Zaurus_SLB600: // fallthrough |
242 | case Model_Zaurus_SL5500: | 242 | case Model_Zaurus_SL5500: |
243 | m_backlightdev = "/sys/class/backlight/locomo-backlight/"; | 243 | m_backlightdev = "/sys/class/backlight/locomo-backlight/"; |
244 | break; | 244 | break; |
245 | case Model_Zaurus_SL6000: | ||
246 | m_backlightdev = "/sys/class/backlight/tosa-bl/"; | ||
247 | break; | ||
248 | default: | 245 | default: |
249 | m_backlightdev = "/sys/class/backlight/corgi-bl/"; | 246 | m_backlightdev = "/sys/class/backlight/corgi-bl/"; |
250 | } | 247 | } |
251 | 248 | ||
252 | // set initial rotation | 249 | // set initial rotation |
253 | switch( d->m_model ) | 250 | switch( d->m_model ) |
254 | { | 251 | { |
255 | case Model_Zaurus_SL6000: // fallthrough | 252 | case Model_Zaurus_SL6000: // fallthrough |
256 | case Model_Zaurus_SLA300: | 253 | case Model_Zaurus_SLA300: |
257 | d->m_rotation = Rot0; | 254 | d->m_rotation = Rot0; |
258 | break; | 255 | break; |
259 | case Model_Zaurus_SLC3100: // fallthrough | 256 | case Model_Zaurus_SLC3100: // fallthrough |
260 | case Model_Zaurus_SLC3000: // fallthrough | 257 | case Model_Zaurus_SLC3000: // fallthrough |
261 | case Model_Zaurus_SLC1000: // fallthrough | 258 | case Model_Zaurus_SLC1000: // fallthrough |
262 | case Model_Zaurus_SLC7x0: | 259 | case Model_Zaurus_SLC7x0: |
263 | initHingeSensor(); | 260 | initHingeSensor(); |
264 | d->m_rotation = rotation(); | 261 | d->m_rotation = rotation(); |
265 | d->m_direction = direction(); | 262 | d->m_direction = direction(); |
266 | break; | 263 | break; |
267 | case Model_Zaurus_SLB600: // fallthrough | 264 | case Model_Zaurus_SLB600: // fallthrough |
268 | case Model_Zaurus_SL5000: // fallthrough | 265 | case Model_Zaurus_SL5000: // fallthrough |
269 | case Model_Zaurus_SL5500: // fallthrough | 266 | case Model_Zaurus_SL5500: // fallthrough |
270 | default: | 267 | default: |
271 | d->m_rotation = Rot270; | 268 | d->m_rotation = Rot270; |
272 | } | 269 | } |
273 | 270 | ||
274 | // set default qte driver | 271 | // set default qte driver |
275 | switch( d->m_model ) | 272 | switch( d->m_model ) |
276 | { | 273 | { |
277 | case Model_Zaurus_SLC7x0: | 274 | case Model_Zaurus_SLC7x0: |
278 | d->m_qteDriver = "W100"; | 275 | d->m_qteDriver = "W100"; |
279 | break; | 276 | break; |
280 | default: | 277 | default: |
281 | d->m_qteDriver = "Transformed"; | 278 | d->m_qteDriver = "Transformed"; |
282 | } | 279 | } |
283 | 280 | ||
284 | m_leds[0] = Led_Off; | 281 | m_leds[0] = Led_Off; |
285 | 282 | ||
286 | if ( m_embedix ) | 283 | if ( m_embedix ) |
287 | qDebug( "Zaurus::init() - Using the 2.4 Embedix HAL on a %s", (const char*) d->m_modelstr ); | 284 | qDebug( "Zaurus::init() - Using the 2.4 Embedix HAL on a %s", (const char*) d->m_modelstr ); |
288 | else | 285 | else |
289 | qDebug( "Zaurus::init() - Using the 2.6 OpenZaurus HAL on a %s", (const char*) d->m_modelstr ); | 286 | qDebug( "Zaurus::init() - Using the 2.6 OpenZaurus HAL on a %s", (const char*) d->m_modelstr ); |
290 | } | 287 | } |
291 | 288 | ||
292 | void Zaurus::initButtons() | 289 | void Zaurus::initButtons() |
293 | { | 290 | { |
294 | qDebug( "Zaurus::initButtons()" ); | 291 | qDebug( "Zaurus::initButtons()" ); |
295 | if ( d->m_buttons ) | 292 | if ( d->m_buttons ) |
296 | return; | 293 | return; |
297 | 294 | ||
298 | d->m_buttons = new QValueList <ODeviceButton>; | 295 | d->m_buttons = new QValueList <ODeviceButton>; |
299 | 296 | ||
300 | struct z_button * pz_buttons; | 297 | struct z_button * pz_buttons; |
301 | int buttoncount; | 298 | int buttoncount; |
302 | switch ( d->m_model ) | 299 | switch ( d->m_model ) |
303 | { | 300 | { |
304 | case Model_Zaurus_SL6000: | 301 | case Model_Zaurus_SL6000: |
305 | pz_buttons = z_buttons_6000; | 302 | pz_buttons = z_buttons_6000; |
306 | buttoncount = ARRAY_SIZE(z_buttons_6000); | 303 | buttoncount = ARRAY_SIZE(z_buttons_6000); |
307 | break; | 304 | break; |
308 | case Model_Zaurus_SLC3100: // fallthrough | 305 | case Model_Zaurus_SLC3100: // fallthrough |
309 | case Model_Zaurus_SLC3000: // fallthrough | 306 | case Model_Zaurus_SLC3000: // fallthrough |
310 | case Model_Zaurus_SLC1000: // fallthrough | 307 | case Model_Zaurus_SLC1000: // fallthrough |
311 | case Model_Zaurus_SLC7x0: | 308 | case Model_Zaurus_SLC7x0: |
312 | if ( isQWS( ) ) | 309 | if ( isQWS( ) ) |
313 | { | 310 | { |
314 | addPreHandler(this); | 311 | addPreHandler(this); |
315 | } | 312 | } |
316 | pz_buttons = z_buttons_c700; | 313 | pz_buttons = z_buttons_c700; |
317 | buttoncount = ARRAY_SIZE(z_buttons_c700); | 314 | buttoncount = ARRAY_SIZE(z_buttons_c700); |
318 | break; | 315 | break; |
319 | default: | 316 | default: |
320 | pz_buttons = z_buttons; | 317 | pz_buttons = z_buttons; |
321 | buttoncount = ARRAY_SIZE(z_buttons); | 318 | buttoncount = ARRAY_SIZE(z_buttons); |
322 | break; | 319 | break; |
323 | } | 320 | } |
324 | 321 | ||
325 | for ( int i = 0; i < buttoncount; i++ ) { | 322 | for ( int i = 0; i < buttoncount; i++ ) { |
326 | struct z_button *zb = pz_buttons + i; | 323 | struct z_button *zb = pz_buttons + i; |
327 | ODeviceButton b; | 324 | ODeviceButton b; |
328 | 325 | ||
329 | b.setKeycode( zb->code ); | 326 | b.setKeycode( zb->code ); |
330 | b.setUserText( QObject::tr( "Button", zb->utext )); | 327 | b.setUserText( QObject::tr( "Button", zb->utext )); |
331 | b.setPixmap( OResource::loadPixmap( zb->pix )); | 328 | b.setPixmap( OResource::loadPixmap( zb->pix )); |
332 | b.setFactoryPresetPressedAction( OQCopMessage( makeChannel ( zb->fpressedservice ), zb->fpressedaction )); | 329 | b.setFactoryPresetPressedAction( OQCopMessage( makeChannel ( zb->fpressedservice ), zb->fpressedaction )); |
333 | b.setFactoryPresetHeldAction( OQCopMessage( makeChannel ( zb->fheldservice ), zb->fheldaction )); | 330 | b.setFactoryPresetHeldAction( OQCopMessage( makeChannel ( zb->fheldservice ), zb->fheldaction )); |
334 | d->m_buttons->append( b ); | 331 | d->m_buttons->append( b ); |
335 | } | 332 | } |
336 | 333 | ||
337 | reloadButtonMapping(); | 334 | reloadButtonMapping(); |
338 | } | 335 | } |
339 | 336 | ||
340 | 337 | ||
341 | 338 | ||
342 | typedef struct sharp_led_status { | 339 | typedef struct sharp_led_status { |
343 | int which; /* select which LED status is wanted. */ | 340 | int which; /* select which LED status is wanted. */ |
344 | int status; /* set new led status if you call SHARP_LED_SETSTATUS */ | 341 | int status; /* set new led status if you call SHARP_LED_SETSTATUS */ |
345 | } sharp_led_status; | 342 | } sharp_led_status; |
346 | 343 | ||
347 | void Zaurus::buzzer( int sound ) | 344 | void Zaurus::buzzer( int sound ) |
348 | { | 345 | { |
349 | #ifndef QT_NO_SOUND | 346 | #ifndef QT_NO_SOUND |
350 | Sound *snd = 0; | 347 | Sound *snd = 0; |
351 | 348 | ||
352 | // All devices except SL5500 have a DSP device | 349 | // All devices except SL5500 have a DSP device |
353 | if ( d->m_model != Model_Zaurus_SL5000 | 350 | if ( d->m_model != Model_Zaurus_SL5000 |
354 | && d->m_model != Model_Zaurus_SL5500 ) { | 351 | && d->m_model != Model_Zaurus_SL5500 ) { |
355 | 352 | ||
356 | switch ( sound ){ | 353 | switch ( sound ){ |
357 | case SHARP_BUZ_TOUCHSOUND: { | 354 | case SHARP_BUZ_TOUCHSOUND: { |
358 | static Sound touch_sound("touchsound"); | 355 | static Sound touch_sound("touchsound"); |
359 | snd = &touch_sound; | 356 | snd = &touch_sound; |
360 | } | 357 | } |
361 | break; | 358 | break; |
362 | case SHARP_BUZ_KEYSOUND: { | 359 | case SHARP_BUZ_KEYSOUND: { |
363 | static Sound key_sound( "keysound" ); | 360 | static Sound key_sound( "keysound" ); |
364 | snd = &key_sound; | 361 | snd = &key_sound; |
365 | } | 362 | } |
366 | break; | 363 | break; |
367 | case SHARP_BUZ_SCHEDULE_ALARM: | 364 | case SHARP_BUZ_SCHEDULE_ALARM: |
368 | default: { | 365 | default: { |
369 | static Sound alarm_sound("alarm"); | 366 | static Sound alarm_sound("alarm"); |
370 | snd = &alarm_sound; | 367 | snd = &alarm_sound; |
371 | } | 368 | } |
372 | break; | 369 | break; |
373 | } | 370 | } |
374 | } | 371 | } |
375 | 372 | ||
376 | // If a soundname is defined, we expect that this device has | 373 | // If a soundname is defined, we expect that this device has |
377 | // sound capabilities.. Otherwise we expect to have the buzzer | 374 | // sound capabilities.. Otherwise we expect to have the buzzer |
378 | // device.. | 375 | // device.. |
379 | if ( snd && snd->isFinished() ){ | 376 | if ( snd && snd->isFinished() ){ |
380 | changeMixerForAlarm( 0, "/dev/sound/mixer", snd ); | 377 | changeMixerForAlarm( 0, "/dev/sound/mixer", snd ); |
381 | snd->play(); | 378 | snd->play(); |
382 | } else if( !snd ) { | 379 | } else if( !snd ) { |
383 | int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK ); | 380 | int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK ); |
384 | 381 | ||
385 | if ( fd >= 0 ) { | 382 | if ( fd >= 0 ) { |
386 | ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound ); | 383 | ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound ); |
387 | ::close ( fd ); | 384 | ::close ( fd ); |
388 | } | 385 | } |
389 | 386 | ||
390 | } | 387 | } |
391 | #endif | 388 | #endif |
392 | } | 389 | } |
393 | 390 | ||
394 | 391 | ||
395 | void Zaurus::playAlarmSound() | 392 | void Zaurus::playAlarmSound() |
396 | { | 393 | { |
397 | buzzer( SHARP_BUZ_SCHEDULE_ALARM ); | 394 | buzzer( SHARP_BUZ_SCHEDULE_ALARM ); |
398 | } | 395 | } |
399 | 396 | ||
400 | void Zaurus::playTouchSound() | 397 | void Zaurus::playTouchSound() |
401 | { | 398 | { |
402 | buzzer( SHARP_BUZ_TOUCHSOUND ); | 399 | buzzer( SHARP_BUZ_TOUCHSOUND ); |
403 | } | 400 | } |
404 | 401 | ||
405 | void Zaurus::playKeySound() | 402 | void Zaurus::playKeySound() |
406 | { | 403 | { |
407 | buzzer( SHARP_BUZ_KEYSOUND ); | 404 | buzzer( SHARP_BUZ_KEYSOUND ); |
408 | } | 405 | } |
409 | 406 | ||
410 | 407 | ||
411 | QValueList <OLed> Zaurus::ledList() const | 408 | QValueList <OLed> Zaurus::ledList() const |
412 | { | 409 | { |
413 | QValueList <OLed> vl; | 410 | QValueList <OLed> vl; |
414 | vl << Led_Mail; | 411 | vl << Led_Mail; |
415 | return vl; | 412 | return vl; |
416 | } | 413 | } |
417 | 414 | ||
418 | QValueList <OLedState> Zaurus::ledStateList( OLed l ) const | 415 | QValueList <OLedState> Zaurus::ledStateList( OLed l ) const |
419 | { | 416 | { |
420 | QValueList <OLedState> vl; | 417 | QValueList <OLedState> vl; |
421 | 418 | ||
422 | if ( l == Led_Mail ) | 419 | if ( l == Led_Mail ) |
423 | vl << Led_Off << Led_On << Led_BlinkSlow; | 420 | vl << Led_Off << Led_On << Led_BlinkSlow; |
424 | return vl; | 421 | return vl; |
425 | } | 422 | } |
426 | 423 | ||
427 | OLedState Zaurus::ledState( OLed which ) const | 424 | OLedState Zaurus::ledState( OLed which ) const |
428 | { | 425 | { |
429 | if ( which == Led_Mail ) | 426 | if ( which == Led_Mail ) |
430 | return m_leds [0]; | 427 | return m_leds [0]; |
431 | else | 428 | else |
432 | return Led_Off; | 429 | return Led_Off; |
433 | } | 430 | } |
434 | 431 | ||
435 | bool Zaurus::setLedState( OLed which, OLedState st ) | 432 | bool Zaurus::setLedState( OLed which, OLedState st ) |
436 | { | 433 | { |
437 | // Currently not supported on non_embedix kernels | 434 | // Currently not supported on non_embedix kernels |
438 | if (!m_embedix) | 435 | if (!m_embedix) |
439 | { | 436 | { |
440 | qDebug( "Zaurus::setLedState: ODevice handling for non-embedix kernels not yet implemented" ); | 437 | qDebug( "Zaurus::setLedState: ODevice handling for non-embedix kernels not yet implemented" ); |
441 | return false; | 438 | return false; |
442 | } | 439 | } |
443 | 440 | ||
444 | static int fd = ::open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK ); | 441 | static int fd = ::open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK ); |
445 | 442 | ||
446 | if ( which == Led_Mail ) { | 443 | if ( which == Led_Mail ) { |
447 | if ( fd >= 0 ) { | 444 | if ( fd >= 0 ) { |
448 | struct sharp_led_status leds; | 445 | struct sharp_led_status leds; |
449 | ::memset ( &leds, 0, sizeof( leds )); | 446 | ::memset ( &leds, 0, sizeof( leds )); |
450 | leds. which = SHARP_LED_MAIL_EXISTS; | 447 | leds. which = SHARP_LED_MAIL_EXISTS; |
451 | bool ok = true; | 448 | bool ok = true; |
452 | 449 | ||
453 | switch ( st ) { | 450 | switch ( st ) { |
454 | case Led_Off : leds. status = LED_MAIL_NO_UNREAD_MAIL; break; | 451 | case Led_Off : leds. status = LED_MAIL_NO_UNREAD_MAIL; break; |
455 | case Led_On : leds. status = LED_MAIL_NEWMAIL_EXISTS; break; | 452 | case Led_On : leds. status = LED_MAIL_NEWMAIL_EXISTS; break; |
456 | case Led_BlinkSlow: leds. status = LED_MAIL_UNREAD_MAIL_EX; break; | 453 | case Led_BlinkSlow: leds. status = LED_MAIL_UNREAD_MAIL_EX; break; |
457 | default : ok = false; | 454 | default : ok = false; |
458 | } | 455 | } |
459 | 456 | ||
460 | if ( ok && ( ::ioctl ( fd, SHARP_LED_SETSTATUS, &leds ) >= 0 )) { | 457 | if ( ok && ( ::ioctl ( fd, SHARP_LED_SETSTATUS, &leds ) >= 0 )) { |
461 | m_leds [0] = st; | 458 | m_leds [0] = st; |
462 | return true; | 459 | return true; |
463 | } | 460 | } |
464 | } | 461 | } |
465 | } | 462 | } |
466 | return false; | 463 | return false; |
467 | } | 464 | } |
468 | 465 | ||
469 | int Zaurus::displayBrightnessResolution() const | 466 | int Zaurus::displayBrightnessResolution() const |
470 | { | 467 | { |
471 | int res = 1; | 468 | int res = 1; |
472 | if (m_embedix) | 469 | if (m_embedix) |
473 | { | 470 | { |
474 | int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_RDWR|O_NONBLOCK ); | 471 | int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_RDWR|O_NONBLOCK ); |
475 | if ( fd ) | 472 | if ( fd ) |
476 | { | 473 | { |
477 | int value = ::ioctl( fd, SHARP_FL_IOCTL_GET_STEP, 0 ); | 474 | int value = ::ioctl( fd, SHARP_FL_IOCTL_GET_STEP, 0 ); |
478 | ::close( fd ); | 475 | ::close( fd ); |
479 | return value ? value : res; | 476 | return value ? value : res; |
480 | } | 477 | } |
481 | } | 478 | } |
482 | else | 479 | else |
483 | { | 480 | { |
484 | int fd = ::open( m_backlightdev + "max_brightness", O_RDONLY|O_NONBLOCK ); | 481 | int fd = ::open( m_backlightdev + "max_brightness", O_RDONLY|O_NONBLOCK ); |
485 | if ( fd ) | 482 | if ( fd ) |
486 | { | 483 | { |
487 | char buf[100]; | 484 | char buf[100]; |
488 | if ( ::read( fd, &buf[0], sizeof buf ) ) ::sscanf( &buf[0], "%d", &res ); | 485 | if ( ::read( fd, &buf[0], sizeof buf ) ) ::sscanf( &buf[0], "%d", &res ); |
489 | ::close( fd ); | 486 | ::close( fd ); |
490 | } | 487 | } |
491 | } | 488 | } |
492 | return res; | 489 | return res; |
493 | } | 490 | } |
494 | 491 | ||
495 | bool Zaurus::setDisplayBrightness( int bright ) | 492 | bool Zaurus::setDisplayBrightness( int bright ) |
496 | { | 493 | { |
497 | //qDebug( "Zaurus::setDisplayBrightness( %d )", bright ); | 494 | //qDebug( "Zaurus::setDisplayBrightness( %d )", bright ); |
498 | bool res = false; | 495 | bool res = false; |
499 | 496 | ||
500 | if ( bright > 255 ) bright = 255; | 497 | if ( bright > 255 ) bright = 255; |
501 | if ( bright < 0 ) bright = 0; | 498 | if ( bright < 0 ) bright = 0; |
502 | 499 | ||
503 | int numberOfSteps = displayBrightnessResolution(); | 500 | int numberOfSteps = displayBrightnessResolution(); |
504 | int val = ( bright == 1 ) ? 1 : ( bright * numberOfSteps ) / 255; | 501 | int val = ( bright == 1 ) ? 1 : ( bright * numberOfSteps ) / 255; |
505 | 502 | ||
506 | if ( m_embedix ) | 503 | if ( m_embedix ) |
507 | { | 504 | { |
508 | int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_WRONLY|O_NONBLOCK ); | 505 | int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_WRONLY|O_NONBLOCK ); |
509 | if ( fd ) | 506 | if ( fd ) |
510 | { | 507 | { |
511 | res = ( ::ioctl( fd, SHARP_FL_IOCTL_STEP_CONTRAST, val ) == 0 ); | 508 | res = ( ::ioctl( fd, SHARP_FL_IOCTL_STEP_CONTRAST, val ) == 0 ); |
512 | ::close( fd ); | 509 | ::close( fd ); |
513 | } | 510 | } |
514 | } | 511 | } |
515 | else | 512 | else |
516 | { | 513 | { |
517 | int fd = ::open( m_backlightdev + "brightness", O_WRONLY|O_NONBLOCK ); | 514 | int fd = ::open( m_backlightdev + "brightness", O_WRONLY|O_NONBLOCK ); |
518 | if ( fd ) | 515 | if ( fd ) |
519 | { | 516 | { |
520 | char buf[100]; | 517 | char buf[100]; |
521 | int len = ::snprintf( &buf[0], sizeof buf, "%d", val ); | 518 | int len = ::snprintf( &buf[0], sizeof buf, "%d", val ); |
522 | res = ( ::write( fd, &buf[0], len ) == 0 ); | 519 | res = ( ::write( fd, &buf[0], len ) == 0 ); |
523 | ::close( fd ); | 520 | ::close( fd ); |
524 | } | 521 | } |
525 | } | 522 | } |
526 | return res; | 523 | return res; |
527 | } | 524 | } |
528 | 525 | ||
529 | bool Zaurus::setDisplayStatus( bool on ) | 526 | bool Zaurus::setDisplayStatus( bool on ) |
530 | { | 527 | { |
531 | bool res = false; | 528 | bool res = false; |
532 | if ( m_embedix ) | 529 | if ( m_embedix ) |
533 | { | 530 | { |
534 | int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_WRONLY|O_NONBLOCK ); | 531 | int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_WRONLY|O_NONBLOCK ); |
535 | if ( fd ) | 532 | if ( fd ) |
536 | { | 533 | { |
537 | int ioctlnum = on ? SHARP_FL_IOCTL_ON : SHARP_FL_IOCTL_OFF; | 534 | int ioctlnum = on ? SHARP_FL_IOCTL_ON : SHARP_FL_IOCTL_OFF; |
538 | res = ( ::ioctl ( fd, ioctlnum, 0 ) == 0 ); | 535 | res = ( ::ioctl ( fd, ioctlnum, 0 ) == 0 ); |
539 | ::close ( fd ); | 536 | ::close ( fd ); |
540 | } | 537 | } |
541 | } | 538 | } |
542 | else | 539 | else |
543 | { | 540 | { |
544 | int fd = ::open( m_backlightdev + "power", O_WRONLY|O_NONBLOCK ); | 541 | int fd = ::open( m_backlightdev + "power", O_WRONLY|O_NONBLOCK ); |
545 | if ( fd ) | 542 | if ( fd ) |
546 | { | 543 | { |
547 | char buf[10]; | 544 | char buf[10]; |
548 | buf[0] = on ? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN; | 545 | buf[0] = on ? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN; |
549 | buf[1] = '\0'; | 546 | buf[1] = '\0'; |
550 | res = ( ::write( fd, &buf[0], 2 ) == 0 ); | 547 | res = ( ::write( fd, &buf[0], 2 ) == 0 ); |
551 | ::close( fd ); | 548 | ::close( fd ); |
552 | } | 549 | } |
553 | } | 550 | } |
554 | return res; | 551 | return res; |
555 | } | 552 | } |
556 | 553 | ||
557 | Transformation Zaurus::rotation() const | 554 | Transformation Zaurus::rotation() const |
558 | { | 555 | { |
559 | qDebug( "Zaurus::rotation()" ); | 556 | qDebug( "Zaurus::rotation()" ); |
560 | Transformation rot; | 557 | Transformation rot; |
561 | 558 | ||
562 | switch ( d->m_model ) { | 559 | switch ( d->m_model ) { |
563 | case Model_Zaurus_SLC3100: // fallthrough | 560 | case Model_Zaurus_SLC3100: // fallthrough |
564 | case Model_Zaurus_SLC3000: // fallthrough | 561 | case Model_Zaurus_SLC3000: // fallthrough |
565 | case Model_Zaurus_SLC1000: | 562 | case Model_Zaurus_SLC1000: |
566 | { | 563 | { |
567 | OHingeStatus hs = readHingeSensor(); | 564 | OHingeStatus hs = readHingeSensor(); |
568 | qDebug( "Zaurus::rotation() - hinge sensor = %d", (int) hs ); | 565 | qDebug( "Zaurus::rotation() - hinge sensor = %d", (int) hs ); |
569 | if ( hs == CASE_PORTRAIT ) rot = Rot0; | 566 | if ( hs == CASE_PORTRAIT ) rot = Rot0; |
570 | else if ( hs == CASE_UNKNOWN ) rot = Rot270; | 567 | else if ( hs == CASE_UNKNOWN ) rot = Rot270; |
571 | else rot = Rot270; | 568 | else rot = Rot270; |
572 | } | 569 | } |
573 | break; | 570 | break; |
574 | 571 | ||
575 | // SLC7x0 needs a special case here, because we were able to set the W100 | 572 | // SLC7x0 needs a special case here, because we were able to set the W100 |
576 | // hardware default rotation on kernel 2.6 to Rot0 | 573 | // hardware default rotation on kernel 2.6 to Rot0 |
577 | case Model_Zaurus_SLC7x0: | 574 | case Model_Zaurus_SLC7x0: |
578 | { | 575 | { |
579 | OHingeStatus hs = readHingeSensor(); | 576 | OHingeStatus hs = readHingeSensor(); |
580 | qDebug( "Zaurus::rotation() - hinge sensor = %d", (int) hs ); | 577 | qDebug( "Zaurus::rotation() - hinge sensor = %d", (int) hs ); |
581 | 578 | ||
582 | if ( m_embedix ) | 579 | if ( m_embedix ) |
583 | { | 580 | { |
584 | if ( hs == CASE_PORTRAIT ) rot = Rot0; | 581 | if ( hs == CASE_PORTRAIT ) rot = Rot0; |
585 | else if ( hs == CASE_UNKNOWN ) rot = Rot270; | 582 | else if ( hs == CASE_UNKNOWN ) rot = Rot270; |
586 | else rot = Rot270; | 583 | else rot = Rot270; |
587 | } | 584 | } |
588 | else | 585 | else |
589 | { | 586 | { |
590 | if ( hs == CASE_PORTRAIT ) rot = Rot90; | 587 | if ( hs == CASE_PORTRAIT ) rot = Rot90; |
591 | else if ( hs == CASE_UNKNOWN ) rot = Rot0; | 588 | else if ( hs == CASE_UNKNOWN ) rot = Rot0; |
592 | else rot = Rot0; | 589 | else rot = Rot0; |
593 | } | 590 | } |
594 | } | 591 | } |
595 | break; | 592 | break; |
596 | case Model_Zaurus_SL6000: | 593 | case Model_Zaurus_SL6000: |
597 | case Model_Zaurus_SLB600: | 594 | case Model_Zaurus_SLB600: |
598 | case Model_Zaurus_SLA300: | 595 | case Model_Zaurus_SLA300: |
599 | case Model_Zaurus_SL5500: | 596 | case Model_Zaurus_SL5500: |
600 | case Model_Zaurus_SL5000: | 597 | case Model_Zaurus_SL5000: |
601 | default: | 598 | default: |
602 | rot = d->m_rotation; | 599 | rot = d->m_rotation; |
603 | break; | 600 | break; |
604 | } | 601 | } |
605 | 602 | ||
606 | qDebug( "Zaurus::rotation() - returning '%d'", rot ); | 603 | qDebug( "Zaurus::rotation() - returning '%d'", rot ); |
607 | return rot; | 604 | return rot; |
608 | } | 605 | } |
609 | ODirection Zaurus::direction() const | 606 | ODirection Zaurus::direction() const |
610 | { | 607 | { |
611 | ODirection dir; | 608 | ODirection dir; |
612 | 609 | ||
613 | switch ( d->m_model ) { | 610 | switch ( d->m_model ) { |
614 | case Model_Zaurus_SLC3100: // fallthrough | 611 | case Model_Zaurus_SLC3100: // fallthrough |
615 | case Model_Zaurus_SLC3000: // fallthrough | 612 | case Model_Zaurus_SLC3000: // fallthrough |
616 | case Model_Zaurus_SLC1000: // fallthrough | 613 | case Model_Zaurus_SLC1000: // fallthrough |
617 | case Model_Zaurus_SLC7x0: { | 614 | case Model_Zaurus_SLC7x0: { |
618 | OHingeStatus hs = readHingeSensor(); | 615 | OHingeStatus hs = readHingeSensor(); |
619 | if ( hs == CASE_PORTRAIT ) dir = CCW; | 616 | if ( hs == CASE_PORTRAIT ) dir = CCW; |
620 | else if ( hs == CASE_UNKNOWN ) dir = CCW; | 617 | else if ( hs == CASE_UNKNOWN ) dir = CCW; |
621 | else dir = CW; | 618 | else dir = CW; |
622 | } | 619 | } |
623 | break; | 620 | break; |
624 | case Model_Zaurus_SL6000: | 621 | case Model_Zaurus_SL6000: |
625 | case Model_Zaurus_SLA300: | 622 | case Model_Zaurus_SLA300: |
626 | case Model_Zaurus_SLB600: | 623 | case Model_Zaurus_SLB600: |
627 | case Model_Zaurus_SL5500: | 624 | case Model_Zaurus_SL5500: |
628 | case Model_Zaurus_SL5000: | 625 | case Model_Zaurus_SL5000: |
629 | default: dir = d->m_direction; | 626 | default: dir = d->m_direction; |
630 | break; | 627 | break; |
631 | } | 628 | } |