author | chicken <chicken> | 2004-10-11 13:42:02 (UTC) |
---|---|---|
committer | chicken <chicken> | 2004-10-11 13:42:02 (UTC) |
commit | d3da21c01659c68dc2cf1dfff1608649977b6e05 (patch) (unidiff) | |
tree | 934a04259e38827a48b9e21bfffabd47cb816ca0 | |
parent | 9c2ff4fd80562f0f92a2662fb2fa95b88284b9b4 (diff) | |
download | opie-d3da21c01659c68dc2cf1dfff1608649977b6e05.zip opie-d3da21c01659c68dc2cf1dfff1608649977b6e05.tar.gz opie-d3da21c01659c68dc2cf1dfff1608649977b6e05.tar.bz2 |
remove jornada 56x brightness hack
-rw-r--r-- | libopie2/opiecore/device/odevice_jornada.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/libopie2/opiecore/device/odevice_jornada.cpp b/libopie2/opiecore/device/odevice_jornada.cpp index 60736a1..2cab0c8 100644 --- a/libopie2/opiecore/device/odevice_jornada.cpp +++ b/libopie2/opiecore/device/odevice_jornada.cpp | |||
@@ -1,208 +1,207 @@ | |||
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_jornada.h" | 30 | #include "odevice_jornada.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 | /* KERNEL */ | 56 | /* KERNEL */ |
57 | #define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) | 57 | #define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) |
58 | 58 | ||
59 | #define OD_IO(type,number) OD_IOC(0,type,number,0) | 59 | #define OD_IO(type,number) OD_IOC(0,type,number,0) |
60 | #define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size)) | 60 | #define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size)) |
61 | #define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size)) | 61 | #define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size)) |
62 | #define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size)) | 62 | #define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size)) |
63 | 63 | ||
64 | typedef struct { | 64 | typedef struct { |
65 | unsigned char OffOnBlink; /* 0=off 1=on 2=Blink */ | 65 | unsigned char OffOnBlink; /* 0=off 1=on 2=Blink */ |
66 | unsigned char TotalTime; /* Units of 5 seconds */ | 66 | unsigned char TotalTime; /* Units of 5 seconds */ |
67 | unsigned char OnTime; /* units of 100m/s */ | 67 | unsigned char OnTime; /* units of 100m/s */ |
68 | unsigned char OffTime; /* units of 100m/s */ | 68 | unsigned char OffTime; /* units of 100m/s */ |
69 | } LED_IN; | 69 | } LED_IN; |
70 | 70 | ||
71 | typedef struct { | 71 | typedef struct { |
72 | unsigned char mode; | 72 | unsigned char mode; |
73 | unsigned char pwr; | 73 | unsigned char pwr; |
74 | unsigned char brightness; | 74 | unsigned char brightness; |
75 | } FLITE_IN; | 75 | } FLITE_IN; |
76 | 76 | ||
77 | #define LED_ON OD_IOW( 'f', 5, LED_IN ) | 77 | #define LED_ON OD_IOW( 'f', 5, LED_IN ) |
78 | #define FLITE_ON OD_IOW( 'f', 7, FLITE_IN ) | 78 | #define FLITE_ON OD_IOW( 'f', 7, FLITE_IN ) |
79 | 79 | ||
80 | using namespace Opie::Core; | 80 | using namespace Opie::Core; |
81 | using namespace Opie::Core::Internal; | 81 | using namespace Opie::Core::Internal; |
82 | 82 | ||
83 | struct j_button jornada56x_buttons [] = { | 83 | struct j_button jornada56x_buttons [] = { |
84 | { Model_Jornada_56x, | 84 | { Model_Jornada_56x, |
85 | Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Calendar Button"), | 85 | Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Calendar Button"), |
86 | "devicebuttons/jornada56x_calendar", | 86 | "devicebuttons/jornada56x_calendar", |
87 | "datebook", "nextView()", | 87 | "datebook", "nextView()", |
88 | "today", "raise()" }, | 88 | "today", "raise()" }, |
89 | { Model_Jornada_56x, | 89 | { Model_Jornada_56x, |
90 | Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Contacts Button"), | 90 | Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Contacts Button"), |
91 | "devicebuttons/jornada56x_contact", | 91 | "devicebuttons/jornada56x_contact", |
92 | "addressbook", "raise()", | 92 | "addressbook", "raise()", |
93 | "addressbook", "beamBusinessCard()" }, | 93 | "addressbook", "beamBusinessCard()" }, |
94 | { Model_Jornada_56x, | 94 | { Model_Jornada_56x, |
95 | Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Todo Button"), | 95 | Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Todo Button"), |
96 | "devicebuttons/jornada56x_todo", | 96 | "devicebuttons/jornada56x_todo", |
97 | "todolist", "raise()", | 97 | "todolist", "raise()", |
98 | "todolist", "create()" }, | 98 | "todolist", "create()" }, |
99 | { Model_Jornada_56x, | 99 | { Model_Jornada_56x, |
100 | Qt::Key_F8, QT_TRANSLATE_NOOP("Button", "Home Button"), | 100 | Qt::Key_F8, QT_TRANSLATE_NOOP("Button", "Home Button"), |
101 | "devicebuttons/jornada56x_home", | 101 | "devicebuttons/jornada56x_home", |
102 | "QPE/Launcher", "home()", | 102 | "QPE/Launcher", "home()", |
103 | "buttonsettings", "raise()" }, | 103 | "buttonsettings", "raise()" }, |
104 | { Model_Jornada_56x, | 104 | { Model_Jornada_56x, |
105 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Record Button"), | 105 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Record Button"), |
106 | "devicebuttons/jornada56x_record", | 106 | "devicebuttons/jornada56x_record", |
107 | "QPE/VMemo", "toggleRecord()", | 107 | "QPE/VMemo", "toggleRecord()", |
108 | "sound", "raise()" }, | 108 | "sound", "raise()" }, |
109 | }; | 109 | }; |
110 | 110 | ||
111 | void Jornada::init(const QString&) | 111 | void Jornada::init(const QString&) |
112 | { | 112 | { |
113 | d->m_vendorstr = "HP"; | 113 | d->m_vendorstr = "HP"; |
114 | d->m_vendor = Vendor_HP; | 114 | d->m_vendor = Vendor_HP; |
115 | d->m_modelstr = "Jornada 56x"; | 115 | d->m_modelstr = "Jornada 56x"; |
116 | d->m_model = Model_Jornada_56x; | 116 | d->m_model = Model_Jornada_56x; |
117 | d->m_rotation = Rot0; | 117 | d->m_rotation = Rot0; |
118 | //Distribution detecting code is now in base class | 118 | //Distribution detecting code is now in base class |
119 | } | 119 | } |
120 | 120 | ||
121 | void Jornada::initButtons() | 121 | void Jornada::initButtons() |
122 | { | 122 | { |
123 | if ( d->m_buttons ) | 123 | if ( d->m_buttons ) |
124 | return; | 124 | return; |
125 | 125 | ||
126 | d->m_buttons = new QValueList <ODeviceButton>; | 126 | d->m_buttons = new QValueList <ODeviceButton>; |
127 | 127 | ||
128 | for ( uint i = 0; i < ( sizeof( jornada56x_buttons ) / sizeof( j_button )); i++ ) { | 128 | for ( uint i = 0; i < ( sizeof( jornada56x_buttons ) / sizeof( j_button )); i++ ) { |
129 | j_button *ib = jornada56x_buttons + i; | 129 | j_button *ib = jornada56x_buttons + i; |
130 | ODeviceButton b; | 130 | ODeviceButton b; |
131 | 131 | ||
132 | if (( ib->model & d->m_model ) == d->m_model ) { | 132 | if (( ib->model & d->m_model ) == d->m_model ) { |
133 | b. setKeycode ( ib->code ); | 133 | b. setKeycode ( ib->code ); |
134 | b. setUserText ( QObject::tr ( "Button", ib->utext )); | 134 | b. setUserText ( QObject::tr ( "Button", ib->utext )); |
135 | b. setPixmap ( Resource::loadPixmap ( ib->pix )); | 135 | b. setPixmap ( Resource::loadPixmap ( ib->pix )); |
136 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib->fpressedservice ), ib->fpressedaction )); | 136 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib->fpressedservice ), ib->fpressedaction )); |
137 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib->fheldservice ), ib->fheldaction )); | 137 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib->fheldservice ), ib->fheldaction )); |
138 | 138 | ||
139 | d->m_buttons->append ( b ); | 139 | d->m_buttons->append ( b ); |
140 | } | 140 | } |
141 | } | 141 | } |
142 | reloadButtonMapping(); | 142 | reloadButtonMapping(); |
143 | 143 | ||
144 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); | 144 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); |
145 | connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( systemMessage(const QCString&,const QByteArray&))); | 145 | connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( systemMessage(const QCString&,const QByteArray&))); |
146 | } | 146 | } |
147 | 147 | ||
148 | int Jornada::displayBrightnessResolution() const | 148 | int Jornada::displayBrightnessResolution() const |
149 | { | 149 | { |
150 | return 255; | 150 | return 255; |
151 | } | 151 | } |
152 | 152 | ||
153 | 153 | ||
154 | bool Jornada::setDisplayBrightness( int bright ) | 154 | bool Jornada::setDisplayBrightness( int bright ) |
155 | { | 155 | { |
156 | bool res = false; | 156 | bool res = false; |
157 | 157 | ||
158 | if ( bright > 255 ) | 158 | if ( bright > 255 ) |
159 | bright = 255; | 159 | bright = 255; |
160 | if ( bright < 0 ) | 160 | if ( bright < 0 ) |
161 | bright = 0; | 161 | bright = 0; |
162 | 162 | ||
163 | QString cmdline; | 163 | QString cmdline; |
164 | 164 | ||
165 | int value = 255 - bright; | ||
166 | if ( !bright ) | 165 | if ( !bright ) |
167 | cmdline = QString().sprintf( "echo 4 > /sys/class/backlight/sa1100fb/power"); | 166 | cmdline = QString().sprintf( "echo 4 > /sys/class/backlight/sa1100fb/power"); |
168 | else | 167 | else |
169 | cmdline = QString().sprintf( "echo 0 > /sys/class/backlight/sa1100fb/power; echo %d > /sys/class/backlight/sa1100fb/brightness", value ); | 168 | cmdline = QString().sprintf( "echo 0 > /sys/class/backlight/sa1100fb/power; echo %d > /sys/class/backlight/sa1100fb/brightness", bright ); |
170 | 169 | ||
171 | res = ( ::system( (const char*) cmdline ) == 0 ); | 170 | res = ( ::system( (const char*) cmdline ) == 0 ); |
172 | 171 | ||
173 | return res; | 172 | return res; |
174 | } | 173 | } |
175 | 174 | ||
176 | 175 | ||
177 | bool Jornada::suspend( ) | 176 | bool Jornada::suspend( ) |
178 | { | 177 | { |
179 | qDebug("ODevice::suspend"); | 178 | qDebug("ODevice::suspend"); |
180 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend | 179 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend |
181 | return false; | 180 | return false; |
182 | 181 | ||
183 | if ( d->m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices | 182 | if ( d->m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices |
184 | return false; | 183 | return false; |
185 | 184 | ||
186 | bool res = false; | 185 | bool res = false; |
187 | ODevice::sendSuspendmsg(); | 186 | ODevice::sendSuspendmsg(); |
188 | 187 | ||
189 | struct timeval tvs; | 188 | struct timeval tvs; |
190 | ::gettimeofday ( &tvs, 0 ); | 189 | ::gettimeofday ( &tvs, 0 ); |
191 | 190 | ||
192 | ::sync(); // flush fs caches | 191 | ::sync(); // flush fs caches |
193 | res = ( ::system ( "apm --suspend" ) == 0 ); | 192 | res = ( ::system ( "apm --suspend" ) == 0 ); |
194 | 193 | ||
195 | return res; | 194 | return res; |
196 | } | 195 | } |
197 | 196 | ||
198 | bool Jornada::setDisplayStatus ( bool on ) | 197 | bool Jornada::setDisplayStatus ( bool on ) |
199 | { | 198 | { |
200 | bool res = false; | 199 | bool res = false; |
201 | 200 | ||
202 | QString cmdline = QString( "echo %1 > /sys/class/lcd/sa1100fb/power; echo %2 > /sys/class/backlight/sa1100fb/power").arg( on ? "0" : "4" ).arg( on ? "0" : "4" ); | 201 | QString cmdline = QString( "echo %1 > /sys/class/lcd/sa1100fb/power; echo %2 > /sys/class/backlight/sa1100fb/power").arg( on ? "0" : "4" ).arg( on ? "0" : "4" ); |
203 | 202 | ||
204 | res = ( ::system( (const char*) cmdline ) == 0 ); | 203 | res = ( ::system( (const char*) cmdline ) == 0 ); |
205 | 204 | ||
206 | return res; | 205 | return res; |
207 | } | 206 | } |
208 | 207 | ||