author | hrw <hrw> | 2006-05-16 09:49:39 (UTC) |
---|---|---|
committer | hrw <hrw> | 2006-05-16 09:49:39 (UTC) |
commit | 46eab1f4cc65e464eba94d6e9965601f304cc1cf (patch) (unidiff) | |
tree | 01459182b6f7aed9868f58a52392c98b206c05e6 | |
parent | 782a34192c2c879a80fd319153a2b2f48ded1c99 (diff) | |
download | opie-46eab1f4cc65e464eba94d6e9965601f304cc1cf.zip opie-46eab1f4cc65e464eba94d6e9965601f304cc1cf.tar.gz opie-46eab1f4cc65e464eba94d6e9965601f304cc1cf.tar.bz2 |
Zaurus ODevice: fix brightness control for Collie/Poodle
-rw-r--r-- | libopie2/opiecore/device/odevice_zaurus.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp index 28a1ccf..4963f54 100644 --- a/libopie2/opiecore/device/odevice_zaurus.cpp +++ b/libopie2/opiecore/device/odevice_zaurus.cpp | |||
@@ -1,627 +1,627 @@ | |||
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-bl/"; |
244 | break; | 244 | break; |
245 | default: | 245 | default: |
246 | m_backlightdev = "/sys/class/backlight/corgi-bl/"; | 246 | m_backlightdev = "/sys/class/backlight/corgi-bl/"; |
247 | } | 247 | } |
248 | 248 | ||
249 | // set initial rotation | 249 | // set initial rotation |
250 | switch( d->m_model ) | 250 | switch( d->m_model ) |
251 | { | 251 | { |
252 | case Model_Zaurus_SL6000: // fallthrough | 252 | case Model_Zaurus_SL6000: // fallthrough |
253 | case Model_Zaurus_SLA300: | 253 | case Model_Zaurus_SLA300: |
254 | d->m_rotation = Rot0; | 254 | d->m_rotation = Rot0; |
255 | break; | 255 | break; |
256 | case Model_Zaurus_SLC3100: // fallthrough | 256 | case Model_Zaurus_SLC3100: // fallthrough |
257 | case Model_Zaurus_SLC3000: // fallthrough | 257 | case Model_Zaurus_SLC3000: // fallthrough |
258 | case Model_Zaurus_SLC1000: // fallthrough | 258 | case Model_Zaurus_SLC1000: // fallthrough |
259 | case Model_Zaurus_SLC7x0: | 259 | case Model_Zaurus_SLC7x0: |
260 | initHingeSensor(); | 260 | initHingeSensor(); |
261 | d->m_rotation = rotation(); | 261 | d->m_rotation = rotation(); |
262 | d->m_direction = direction(); | 262 | d->m_direction = direction(); |
263 | break; | 263 | break; |
264 | case Model_Zaurus_SLB600: // fallthrough | 264 | case Model_Zaurus_SLB600: // fallthrough |
265 | case Model_Zaurus_SL5000: // fallthrough | 265 | case Model_Zaurus_SL5000: // fallthrough |
266 | case Model_Zaurus_SL5500: // fallthrough | 266 | case Model_Zaurus_SL5500: // fallthrough |
267 | default: | 267 | default: |
268 | d->m_rotation = Rot270; | 268 | d->m_rotation = Rot270; |
269 | } | 269 | } |
270 | 270 | ||
271 | // set default qte driver | 271 | // set default qte driver |
272 | switch( d->m_model ) | 272 | switch( d->m_model ) |
273 | { | 273 | { |
274 | case Model_Zaurus_SLC7x0: | 274 | case Model_Zaurus_SLC7x0: |
275 | d->m_qteDriver = "W100"; | 275 | d->m_qteDriver = "W100"; |
276 | break; | 276 | break; |
277 | default: | 277 | default: |
278 | d->m_qteDriver = "Transformed"; | 278 | d->m_qteDriver = "Transformed"; |
279 | } | 279 | } |
280 | 280 | ||
281 | m_leds[0] = Led_Off; | 281 | m_leds[0] = Led_Off; |
282 | 282 | ||
283 | if ( m_embedix ) | 283 | if ( m_embedix ) |
284 | 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 ); |
285 | else | 285 | else |
286 | 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 ); |
287 | } | 287 | } |
288 | 288 | ||
289 | void Zaurus::initButtons() | 289 | void Zaurus::initButtons() |
290 | { | 290 | { |
291 | qDebug( "Zaurus::initButtons()" ); | 291 | qDebug( "Zaurus::initButtons()" ); |
292 | if ( d->m_buttons ) | 292 | if ( d->m_buttons ) |
293 | return; | 293 | return; |
294 | 294 | ||
295 | d->m_buttons = new QValueList <ODeviceButton>; | 295 | d->m_buttons = new QValueList <ODeviceButton>; |
296 | 296 | ||
297 | struct z_button * pz_buttons; | 297 | struct z_button * pz_buttons; |
298 | int buttoncount; | 298 | int buttoncount; |
299 | switch ( d->m_model ) | 299 | switch ( d->m_model ) |
300 | { | 300 | { |
301 | case Model_Zaurus_SL6000: | 301 | case Model_Zaurus_SL6000: |
302 | pz_buttons = z_buttons_6000; | 302 | pz_buttons = z_buttons_6000; |
303 | buttoncount = ARRAY_SIZE(z_buttons_6000); | 303 | buttoncount = ARRAY_SIZE(z_buttons_6000); |
304 | break; | 304 | break; |
305 | case Model_Zaurus_SLC3100: // fallthrough | 305 | case Model_Zaurus_SLC3100: // fallthrough |
306 | case Model_Zaurus_SLC3000: // fallthrough | 306 | case Model_Zaurus_SLC3000: // fallthrough |
307 | case Model_Zaurus_SLC1000: // fallthrough | 307 | case Model_Zaurus_SLC1000: // fallthrough |
308 | case Model_Zaurus_SLC7x0: | 308 | case Model_Zaurus_SLC7x0: |
309 | if ( isQWS( ) ) | 309 | if ( isQWS( ) ) |
310 | { | 310 | { |
311 | addPreHandler(this); | 311 | addPreHandler(this); |
312 | } | 312 | } |
313 | pz_buttons = z_buttons_c700; | 313 | pz_buttons = z_buttons_c700; |
314 | buttoncount = ARRAY_SIZE(z_buttons_c700); | 314 | buttoncount = ARRAY_SIZE(z_buttons_c700); |
315 | break; | 315 | break; |
316 | default: | 316 | default: |
317 | pz_buttons = z_buttons; | 317 | pz_buttons = z_buttons; |
318 | buttoncount = ARRAY_SIZE(z_buttons); | 318 | buttoncount = ARRAY_SIZE(z_buttons); |
319 | break; | 319 | break; |
320 | } | 320 | } |
321 | 321 | ||
322 | for ( int i = 0; i < buttoncount; i++ ) { | 322 | for ( int i = 0; i < buttoncount; i++ ) { |
323 | struct z_button *zb = pz_buttons + i; | 323 | struct z_button *zb = pz_buttons + i; |
324 | ODeviceButton b; | 324 | ODeviceButton b; |
325 | 325 | ||
326 | b.setKeycode( zb->code ); | 326 | b.setKeycode( zb->code ); |
327 | b.setUserText( QObject::tr( "Button", zb->utext )); | 327 | b.setUserText( QObject::tr( "Button", zb->utext )); |
328 | b.setPixmap( OResource::loadPixmap( zb->pix )); | 328 | b.setPixmap( OResource::loadPixmap( zb->pix )); |
329 | b.setFactoryPresetPressedAction( OQCopMessage( makeChannel ( zb->fpressedservice ), zb->fpressedaction )); | 329 | b.setFactoryPresetPressedAction( OQCopMessage( makeChannel ( zb->fpressedservice ), zb->fpressedaction )); |
330 | b.setFactoryPresetHeldAction( OQCopMessage( makeChannel ( zb->fheldservice ), zb->fheldaction )); | 330 | b.setFactoryPresetHeldAction( OQCopMessage( makeChannel ( zb->fheldservice ), zb->fheldaction )); |
331 | d->m_buttons->append( b ); | 331 | d->m_buttons->append( b ); |
332 | } | 332 | } |
333 | 333 | ||
334 | reloadButtonMapping(); | 334 | reloadButtonMapping(); |
335 | } | 335 | } |
336 | 336 | ||
337 | 337 | ||
338 | 338 | ||
339 | typedef struct sharp_led_status { | 339 | typedef struct sharp_led_status { |
340 | int which; /* select which LED status is wanted. */ | 340 | int which; /* select which LED status is wanted. */ |
341 | 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 */ |
342 | } sharp_led_status; | 342 | } sharp_led_status; |
343 | 343 | ||
344 | void Zaurus::buzzer( int sound ) | 344 | void Zaurus::buzzer( int sound ) |
345 | { | 345 | { |
346 | #ifndef QT_NO_SOUND | 346 | #ifndef QT_NO_SOUND |
347 | Sound *snd = 0; | 347 | Sound *snd = 0; |
348 | 348 | ||
349 | // All devices except SL5500 have a DSP device | 349 | // All devices except SL5500 have a DSP device |
350 | if ( d->m_model != Model_Zaurus_SL5000 | 350 | if ( d->m_model != Model_Zaurus_SL5000 |
351 | && d->m_model != Model_Zaurus_SL5500 ) { | 351 | && d->m_model != Model_Zaurus_SL5500 ) { |
352 | 352 | ||
353 | switch ( sound ){ | 353 | switch ( sound ){ |
354 | case SHARP_BUZ_TOUCHSOUND: { | 354 | case SHARP_BUZ_TOUCHSOUND: { |
355 | static Sound touch_sound("touchsound"); | 355 | static Sound touch_sound("touchsound"); |
356 | snd = &touch_sound; | 356 | snd = &touch_sound; |
357 | } | 357 | } |
358 | break; | 358 | break; |
359 | case SHARP_BUZ_KEYSOUND: { | 359 | case SHARP_BUZ_KEYSOUND: { |
360 | static Sound key_sound( "keysound" ); | 360 | static Sound key_sound( "keysound" ); |
361 | snd = &key_sound; | 361 | snd = &key_sound; |
362 | } | 362 | } |
363 | break; | 363 | break; |
364 | case SHARP_BUZ_SCHEDULE_ALARM: | 364 | case SHARP_BUZ_SCHEDULE_ALARM: |
365 | default: { | 365 | default: { |
366 | static Sound alarm_sound("alarm"); | 366 | static Sound alarm_sound("alarm"); |
367 | snd = &alarm_sound; | 367 | snd = &alarm_sound; |
368 | } | 368 | } |
369 | break; | 369 | break; |
370 | } | 370 | } |
371 | } | 371 | } |
372 | 372 | ||
373 | // If a soundname is defined, we expect that this device has | 373 | // If a soundname is defined, we expect that this device has |
374 | // sound capabilities.. Otherwise we expect to have the buzzer | 374 | // sound capabilities.. Otherwise we expect to have the buzzer |
375 | // device.. | 375 | // device.. |
376 | if ( snd && snd->isFinished() ){ | 376 | if ( snd && snd->isFinished() ){ |
377 | changeMixerForAlarm( 0, "/dev/sound/mixer", snd ); | 377 | changeMixerForAlarm( 0, "/dev/sound/mixer", snd ); |
378 | snd->play(); | 378 | snd->play(); |
379 | } else if( !snd ) { | 379 | } else if( !snd ) { |
380 | int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK ); | 380 | int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK ); |
381 | 381 | ||
382 | if ( fd >= 0 ) { | 382 | if ( fd >= 0 ) { |
383 | ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound ); | 383 | ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound ); |
384 | ::close ( fd ); | 384 | ::close ( fd ); |
385 | } | 385 | } |
386 | 386 | ||
387 | } | 387 | } |
388 | #endif | 388 | #endif |
389 | } | 389 | } |
390 | 390 | ||
391 | 391 | ||
392 | void Zaurus::playAlarmSound() | 392 | void Zaurus::playAlarmSound() |
393 | { | 393 | { |
394 | buzzer( SHARP_BUZ_SCHEDULE_ALARM ); | 394 | buzzer( SHARP_BUZ_SCHEDULE_ALARM ); |
395 | } | 395 | } |
396 | 396 | ||
397 | void Zaurus::playTouchSound() | 397 | void Zaurus::playTouchSound() |
398 | { | 398 | { |
399 | buzzer( SHARP_BUZ_TOUCHSOUND ); | 399 | buzzer( SHARP_BUZ_TOUCHSOUND ); |
400 | } | 400 | } |
401 | 401 | ||
402 | void Zaurus::playKeySound() | 402 | void Zaurus::playKeySound() |
403 | { | 403 | { |
404 | buzzer( SHARP_BUZ_KEYSOUND ); | 404 | buzzer( SHARP_BUZ_KEYSOUND ); |
405 | } | 405 | } |
406 | 406 | ||
407 | 407 | ||
408 | QValueList <OLed> Zaurus::ledList() const | 408 | QValueList <OLed> Zaurus::ledList() const |
409 | { | 409 | { |
410 | QValueList <OLed> vl; | 410 | QValueList <OLed> vl; |
411 | vl << Led_Mail; | 411 | vl << Led_Mail; |
412 | return vl; | 412 | return vl; |
413 | } | 413 | } |
414 | 414 | ||
415 | QValueList <OLedState> Zaurus::ledStateList( OLed l ) const | 415 | QValueList <OLedState> Zaurus::ledStateList( OLed l ) const |
416 | { | 416 | { |
417 | QValueList <OLedState> vl; | 417 | QValueList <OLedState> vl; |
418 | 418 | ||
419 | if ( l == Led_Mail ) | 419 | if ( l == Led_Mail ) |
420 | vl << Led_Off << Led_On << Led_BlinkSlow; | 420 | vl << Led_Off << Led_On << Led_BlinkSlow; |
421 | return vl; | 421 | return vl; |
422 | } | 422 | } |
423 | 423 | ||
424 | OLedState Zaurus::ledState( OLed which ) const | 424 | OLedState Zaurus::ledState( OLed which ) const |
425 | { | 425 | { |
426 | if ( which == Led_Mail ) | 426 | if ( which == Led_Mail ) |
427 | return m_leds [0]; | 427 | return m_leds [0]; |
428 | else | 428 | else |
429 | return Led_Off; | 429 | return Led_Off; |
430 | } | 430 | } |
431 | 431 | ||
432 | bool Zaurus::setLedState( OLed which, OLedState st ) | 432 | bool Zaurus::setLedState( OLed which, OLedState st ) |
433 | { | 433 | { |
434 | // Currently not supported on non_embedix kernels | 434 | // Currently not supported on non_embedix kernels |
435 | if (!m_embedix) | 435 | if (!m_embedix) |
436 | { | 436 | { |
437 | 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" ); |
438 | return false; | 438 | return false; |
439 | } | 439 | } |
440 | 440 | ||
441 | static int fd = ::open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK ); | 441 | static int fd = ::open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK ); |
442 | 442 | ||
443 | if ( which == Led_Mail ) { | 443 | if ( which == Led_Mail ) { |
444 | if ( fd >= 0 ) { | 444 | if ( fd >= 0 ) { |
445 | struct sharp_led_status leds; | 445 | struct sharp_led_status leds; |
446 | ::memset ( &leds, 0, sizeof( leds )); | 446 | ::memset ( &leds, 0, sizeof( leds )); |
447 | leds. which = SHARP_LED_MAIL_EXISTS; | 447 | leds. which = SHARP_LED_MAIL_EXISTS; |
448 | bool ok = true; | 448 | bool ok = true; |
449 | 449 | ||
450 | switch ( st ) { | 450 | switch ( st ) { |
451 | case Led_Off : leds. status = LED_MAIL_NO_UNREAD_MAIL; break; | 451 | case Led_Off : leds. status = LED_MAIL_NO_UNREAD_MAIL; break; |
452 | case Led_On : leds. status = LED_MAIL_NEWMAIL_EXISTS; break; | 452 | case Led_On : leds. status = LED_MAIL_NEWMAIL_EXISTS; break; |
453 | case Led_BlinkSlow: leds. status = LED_MAIL_UNREAD_MAIL_EX; break; | 453 | case Led_BlinkSlow: leds. status = LED_MAIL_UNREAD_MAIL_EX; break; |
454 | default : ok = false; | 454 | default : ok = false; |
455 | } | 455 | } |
456 | 456 | ||
457 | if ( ok && ( ::ioctl ( fd, SHARP_LED_SETSTATUS, &leds ) >= 0 )) { | 457 | if ( ok && ( ::ioctl ( fd, SHARP_LED_SETSTATUS, &leds ) >= 0 )) { |
458 | m_leds [0] = st; | 458 | m_leds [0] = st; |
459 | return true; | 459 | return true; |
460 | } | 460 | } |
461 | } | 461 | } |
462 | } | 462 | } |
463 | return false; | 463 | return false; |
464 | } | 464 | } |
465 | 465 | ||
466 | int Zaurus::displayBrightnessResolution() const | 466 | int Zaurus::displayBrightnessResolution() const |
467 | { | 467 | { |
468 | int res = 1; | 468 | int res = 1; |
469 | if (m_embedix) | 469 | if (m_embedix) |
470 | { | 470 | { |
471 | int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_RDWR|O_NONBLOCK ); | 471 | int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_RDWR|O_NONBLOCK ); |
472 | if ( fd ) | 472 | if ( fd ) |
473 | { | 473 | { |
474 | int value = ::ioctl( fd, SHARP_FL_IOCTL_GET_STEP, 0 ); | 474 | int value = ::ioctl( fd, SHARP_FL_IOCTL_GET_STEP, 0 ); |
475 | ::close( fd ); | 475 | ::close( fd ); |
476 | return value ? value : res; | 476 | return value ? value : res; |
477 | } | 477 | } |
478 | } | 478 | } |
479 | else | 479 | else |
480 | { | 480 | { |
481 | int fd = ::open( m_backlightdev + "max_brightness", O_RDONLY|O_NONBLOCK ); | 481 | int fd = ::open( m_backlightdev + "max_brightness", O_RDONLY|O_NONBLOCK ); |
482 | if ( fd ) | 482 | if ( fd ) |
483 | { | 483 | { |
484 | char buf[100]; | 484 | char buf[100]; |
485 | 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 ); |
486 | ::close( fd ); | 486 | ::close( fd ); |
487 | } | 487 | } |
488 | } | 488 | } |
489 | return res; | 489 | return res; |
490 | } | 490 | } |
491 | 491 | ||
492 | bool Zaurus::setDisplayBrightness( int bright ) | 492 | bool Zaurus::setDisplayBrightness( int bright ) |
493 | { | 493 | { |
494 | //qDebug( "Zaurus::setDisplayBrightness( %d )", bright ); | 494 | //qDebug( "Zaurus::setDisplayBrightness( %d )", bright ); |
495 | bool res = false; | 495 | bool res = false; |
496 | 496 | ||
497 | if ( bright > 255 ) bright = 255; | 497 | if ( bright > 255 ) bright = 255; |
498 | if ( bright < 0 ) bright = 0; | 498 | if ( bright < 0 ) bright = 0; |
499 | 499 | ||
500 | int numberOfSteps = displayBrightnessResolution(); | 500 | int numberOfSteps = displayBrightnessResolution(); |
501 | int val = ( bright == 1 ) ? 1 : ( bright * numberOfSteps ) / 255; | 501 | int val = ( bright == 1 ) ? 1 : ( bright * numberOfSteps ) / 255; |
502 | 502 | ||
503 | if ( m_embedix ) | 503 | if ( m_embedix ) |
504 | { | 504 | { |
505 | int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_WRONLY|O_NONBLOCK ); | 505 | int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_WRONLY|O_NONBLOCK ); |
506 | if ( fd ) | 506 | if ( fd ) |
507 | { | 507 | { |
508 | res = ( ::ioctl( fd, SHARP_FL_IOCTL_STEP_CONTRAST, val ) == 0 ); | 508 | res = ( ::ioctl( fd, SHARP_FL_IOCTL_STEP_CONTRAST, val ) == 0 ); |
509 | ::close( fd ); | 509 | ::close( fd ); |
510 | } | 510 | } |
511 | } | 511 | } |
512 | else | 512 | else |
513 | { | 513 | { |
514 | int fd = ::open( m_backlightdev + "brightness", O_WRONLY|O_NONBLOCK ); | 514 | int fd = ::open( m_backlightdev + "brightness", O_WRONLY|O_NONBLOCK ); |
515 | if ( fd ) | 515 | if ( fd ) |
516 | { | 516 | { |
517 | char buf[100]; | 517 | char buf[100]; |
518 | int len = ::snprintf( &buf[0], sizeof buf, "%d", val ); | 518 | int len = ::snprintf( &buf[0], sizeof buf, "%d", val ); |
519 | res = ( ::write( fd, &buf[0], len ) == 0 ); | 519 | res = ( ::write( fd, &buf[0], len ) == 0 ); |
520 | ::close( fd ); | 520 | ::close( fd ); |
521 | } | 521 | } |
522 | } | 522 | } |
523 | return res; | 523 | return res; |
524 | } | 524 | } |
525 | 525 | ||
526 | bool Zaurus::setDisplayStatus( bool on ) | 526 | bool Zaurus::setDisplayStatus( bool on ) |
527 | { | 527 | { |
528 | bool res = false; | 528 | bool res = false; |
529 | if ( m_embedix ) | 529 | if ( m_embedix ) |
530 | { | 530 | { |
531 | int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_WRONLY|O_NONBLOCK ); | 531 | int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_WRONLY|O_NONBLOCK ); |
532 | if ( fd ) | 532 | if ( fd ) |
533 | { | 533 | { |
534 | int ioctlnum = on ? SHARP_FL_IOCTL_ON : SHARP_FL_IOCTL_OFF; | 534 | int ioctlnum = on ? SHARP_FL_IOCTL_ON : SHARP_FL_IOCTL_OFF; |
535 | res = ( ::ioctl ( fd, ioctlnum, 0 ) == 0 ); | 535 | res = ( ::ioctl ( fd, ioctlnum, 0 ) == 0 ); |
536 | ::close ( fd ); | 536 | ::close ( fd ); |
537 | } | 537 | } |
538 | } | 538 | } |
539 | else | 539 | else |
540 | { | 540 | { |
541 | int fd = ::open( m_backlightdev + "power", O_WRONLY|O_NONBLOCK ); | 541 | int fd = ::open( m_backlightdev + "power", O_WRONLY|O_NONBLOCK ); |
542 | if ( fd ) | 542 | if ( fd ) |
543 | { | 543 | { |
544 | char buf[10]; | 544 | char buf[10]; |
545 | buf[0] = on ? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN; | 545 | buf[0] = on ? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN; |
546 | buf[1] = '\0'; | 546 | buf[1] = '\0'; |
547 | res = ( ::write( fd, &buf[0], 2 ) == 0 ); | 547 | res = ( ::write( fd, &buf[0], 2 ) == 0 ); |
548 | ::close( fd ); | 548 | ::close( fd ); |
549 | } | 549 | } |
550 | } | 550 | } |
551 | return res; | 551 | return res; |
552 | } | 552 | } |
553 | 553 | ||
554 | Transformation Zaurus::rotation() const | 554 | Transformation Zaurus::rotation() const |
555 | { | 555 | { |
556 | qDebug( "Zaurus::rotation()" ); | 556 | qDebug( "Zaurus::rotation()" ); |
557 | Transformation rot; | 557 | Transformation rot; |
558 | 558 | ||
559 | switch ( d->m_model ) { | 559 | switch ( d->m_model ) { |
560 | case Model_Zaurus_SLC3100: // fallthrough | 560 | case Model_Zaurus_SLC3100: // fallthrough |
561 | case Model_Zaurus_SLC3000: // fallthrough | 561 | case Model_Zaurus_SLC3000: // fallthrough |
562 | case Model_Zaurus_SLC1000: | 562 | case Model_Zaurus_SLC1000: |
563 | { | 563 | { |
564 | OHingeStatus hs = readHingeSensor(); | 564 | OHingeStatus hs = readHingeSensor(); |
565 | qDebug( "Zaurus::rotation() - hinge sensor = %d", (int) hs ); | 565 | qDebug( "Zaurus::rotation() - hinge sensor = %d", (int) hs ); |
566 | if ( hs == CASE_PORTRAIT ) rot = Rot0; | 566 | if ( hs == CASE_PORTRAIT ) rot = Rot0; |
567 | else if ( hs == CASE_UNKNOWN ) rot = Rot270; | 567 | else if ( hs == CASE_UNKNOWN ) rot = Rot270; |
568 | else rot = Rot270; | 568 | else rot = Rot270; |
569 | } | 569 | } |
570 | break; | 570 | break; |
571 | 571 | ||
572 | // 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 |
573 | // hardware default rotation on kernel 2.6 to Rot0 | 573 | // hardware default rotation on kernel 2.6 to Rot0 |
574 | case Model_Zaurus_SLC7x0: | 574 | case Model_Zaurus_SLC7x0: |
575 | { | 575 | { |
576 | OHingeStatus hs = readHingeSensor(); | 576 | OHingeStatus hs = readHingeSensor(); |
577 | qDebug( "Zaurus::rotation() - hinge sensor = %d", (int) hs ); | 577 | qDebug( "Zaurus::rotation() - hinge sensor = %d", (int) hs ); |
578 | 578 | ||
579 | if ( m_embedix ) | 579 | if ( m_embedix ) |
580 | { | 580 | { |
581 | if ( hs == CASE_PORTRAIT ) rot = Rot0; | 581 | if ( hs == CASE_PORTRAIT ) rot = Rot0; |
582 | else if ( hs == CASE_UNKNOWN ) rot = Rot270; | 582 | else if ( hs == CASE_UNKNOWN ) rot = Rot270; |
583 | else rot = Rot270; | 583 | else rot = Rot270; |
584 | } | 584 | } |
585 | else | 585 | else |
586 | { | 586 | { |
587 | if ( hs == CASE_PORTRAIT ) rot = Rot90; | 587 | if ( hs == CASE_PORTRAIT ) rot = Rot90; |
588 | else if ( hs == CASE_UNKNOWN ) rot = Rot0; | 588 | else if ( hs == CASE_UNKNOWN ) rot = Rot0; |
589 | else rot = Rot0; | 589 | else rot = Rot0; |
590 | } | 590 | } |
591 | } | 591 | } |
592 | break; | 592 | break; |
593 | case Model_Zaurus_SL6000: | 593 | case Model_Zaurus_SL6000: |
594 | case Model_Zaurus_SLB600: | 594 | case Model_Zaurus_SLB600: |
595 | case Model_Zaurus_SLA300: | 595 | case Model_Zaurus_SLA300: |
596 | case Model_Zaurus_SL5500: | 596 | case Model_Zaurus_SL5500: |
597 | case Model_Zaurus_SL5000: | 597 | case Model_Zaurus_SL5000: |
598 | default: | 598 | default: |
599 | rot = d->m_rotation; | 599 | rot = d->m_rotation; |
600 | break; | 600 | break; |
601 | } | 601 | } |
602 | 602 | ||
603 | qDebug( "Zaurus::rotation() - returning '%d'", rot ); | 603 | qDebug( "Zaurus::rotation() - returning '%d'", rot ); |
604 | return rot; | 604 | return rot; |
605 | } | 605 | } |
606 | ODirection Zaurus::direction() const | 606 | ODirection Zaurus::direction() const |
607 | { | 607 | { |
608 | ODirection dir; | 608 | ODirection dir; |
609 | 609 | ||
610 | switch ( d->m_model ) { | 610 | switch ( d->m_model ) { |
611 | case Model_Zaurus_SLC3100: // fallthrough | 611 | case Model_Zaurus_SLC3100: // fallthrough |
612 | case Model_Zaurus_SLC3000: // fallthrough | 612 | case Model_Zaurus_SLC3000: // fallthrough |
613 | case Model_Zaurus_SLC1000: // fallthrough | 613 | case Model_Zaurus_SLC1000: // fallthrough |
614 | case Model_Zaurus_SLC7x0: { | 614 | case Model_Zaurus_SLC7x0: { |
615 | OHingeStatus hs = readHingeSensor(); | 615 | OHingeStatus hs = readHingeSensor(); |
616 | if ( hs == CASE_PORTRAIT ) dir = CCW; | 616 | if ( hs == CASE_PORTRAIT ) dir = CCW; |
617 | else if ( hs == CASE_UNKNOWN ) dir = CCW; | 617 | else if ( hs == CASE_UNKNOWN ) dir = CCW; |
618 | else dir = CW; | 618 | else dir = CW; |
619 | } | 619 | } |
620 | break; | 620 | break; |
621 | case Model_Zaurus_SL6000: | 621 | case Model_Zaurus_SL6000: |
622 | case Model_Zaurus_SLA300: | 622 | case Model_Zaurus_SLA300: |
623 | case Model_Zaurus_SLB600: | 623 | case Model_Zaurus_SLB600: |
624 | case Model_Zaurus_SL5500: | 624 | case Model_Zaurus_SL5500: |
625 | case Model_Zaurus_SL5000: | 625 | case Model_Zaurus_SL5000: |
626 | default: dir = d->m_direction; | 626 | default: dir = d->m_direction; |
627 | break; | 627 | break; |