-rw-r--r-- | libopie2/opiecore/device/odevice_jornada.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libopie2/opiecore/device/odevice_jornada.cpp b/libopie2/opiecore/device/odevice_jornada.cpp index bcde425..3acba03 100644 --- a/libopie2/opiecore/device/odevice_jornada.cpp +++ b/libopie2/opiecore/device/odevice_jornada.cpp | |||
@@ -113,96 +113,101 @@ void Jornada::init(const QString& cpu_info) | |||
113 | d->m_vendorstr = "HP"; | 113 | d->m_vendorstr = "HP"; |
114 | d->m_vendor = Vendor_HP; | 114 | d->m_vendor = Vendor_HP; |
115 | 115 | ||
116 | QString model; | 116 | QString model; |
117 | int loc = cpu_info.find( ":" ); | 117 | int loc = cpu_info.find( ":" ); |
118 | if ( loc != -1 ) | 118 | if ( loc != -1 ) |
119 | model = cpu_info.mid( loc+2 ).simplifyWhiteSpace(); | 119 | model = cpu_info.mid( loc+2 ).simplifyWhiteSpace(); |
120 | else | 120 | else |
121 | model = cpu_info; | 121 | model = cpu_info; |
122 | 122 | ||
123 | if ( model == "HP Jornada 56x" ) { | 123 | if ( model == "HP Jornada 56x" ) { |
124 | d->m_modelstr = "Jornada 56x"; | 124 | d->m_modelstr = "Jornada 56x"; |
125 | d->m_model = Model_Jornada_56x; | 125 | d->m_model = Model_Jornada_56x; |
126 | } else if ( model == "HP Jornada 720" ) { | 126 | } else if ( model == "HP Jornada 720" ) { |
127 | d->m_modelstr = "Jornada 720"; | 127 | d->m_modelstr = "Jornada 720"; |
128 | d->m_model = Model_Jornada_720; | 128 | d->m_model = Model_Jornada_720; |
129 | } | 129 | } |
130 | 130 | ||
131 | d->m_rotation = Rot0; //all Jornadas need this rotation | 131 | d->m_rotation = Rot0; //all Jornadas need this rotation |
132 | //Distribution detecting code is now in base class | 132 | //Distribution detecting code is now in base class |
133 | } | 133 | } |
134 | 134 | ||
135 | void Jornada::initButtons() | 135 | void Jornada::initButtons() |
136 | { | 136 | { |
137 | if ( d->m_buttons ) | 137 | if ( d->m_buttons ) |
138 | return; | 138 | return; |
139 | 139 | ||
140 | d->m_buttons = new QValueList <ODeviceButton>; | 140 | d->m_buttons = new QValueList <ODeviceButton>; |
141 | 141 | ||
142 | for ( uint i = 0; i < ( sizeof( jornada56x_buttons ) / sizeof( j_button )); i++ ) { | 142 | for ( uint i = 0; i < ( sizeof( jornada56x_buttons ) / sizeof( j_button )); i++ ) { |
143 | j_button *ib = jornada56x_buttons + i; | 143 | j_button *ib = jornada56x_buttons + i; |
144 | ODeviceButton b; | 144 | ODeviceButton b; |
145 | 145 | ||
146 | if (( ib->model & d->m_model ) == d->m_model ) { | 146 | if (( ib->model & d->m_model ) == d->m_model ) { |
147 | b. setKeycode ( ib->code ); | 147 | b. setKeycode ( ib->code ); |
148 | b. setUserText ( QObject::tr ( "Button", ib->utext )); | 148 | b. setUserText ( QObject::tr ( "Button", ib->utext )); |
149 | b. setPixmap ( Resource::loadPixmap ( ib->pix )); | 149 | b. setPixmap ( Resource::loadPixmap ( ib->pix )); |
150 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib->fpressedservice ), ib->fpressedaction )); | 150 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib->fpressedservice ), ib->fpressedaction )); |
151 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib->fheldservice ), ib->fheldaction )); | 151 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib->fheldservice ), ib->fheldaction )); |
152 | 152 | ||
153 | d->m_buttons->append ( b ); | 153 | d->m_buttons->append ( b ); |
154 | } | 154 | } |
155 | } | 155 | } |
156 | reloadButtonMapping(); | 156 | reloadButtonMapping(); |
157 | } | 157 | } |
158 | 158 | ||
159 | int Jornada::displayBrightnessResolution() const | 159 | int Jornada::displayBrightnessResolution() const |
160 | { | 160 | { |
161 | return 255; | 161 | if ( d->m_model == Model_Jornada_56x ) |
162 | return 190; | ||
163 | else if (d->m_model == Model_Jornada_720 ) | ||
164 | return 255; | ||
165 | else | ||
166 | return 0; | ||
162 | } | 167 | } |
163 | 168 | ||
164 | 169 | ||
165 | bool Jornada::setDisplayBrightness( int bright ) | 170 | bool Jornada::setDisplayBrightness( int bright ) |
166 | { | 171 | { |
167 | bool res = false; | 172 | bool res = false; |
168 | 173 | ||
169 | if ( bright > 255 ) | 174 | if ( bright > 255 ) |
170 | bright = 255; | 175 | bright = 255; |
171 | if ( bright < 0 ) | 176 | if ( bright < 0 ) |
172 | bright = 0; | 177 | bright = 0; |
173 | 178 | ||
174 | QString cmdline; | 179 | QString cmdline; |
175 | 180 | ||
176 | if ( d->m_model == Model_Jornada_56x ) { | 181 | if ( d->m_model == Model_Jornada_56x ) { |
177 | if ( !bright ) | 182 | if ( !bright ) |
178 | cmdline = QString::fromLatin1( "echo 4 > /sys/class/backlight/sa1100fb/power"); | 183 | cmdline = QString::fromLatin1( "echo 4 > /sys/class/backlight/sa1100fb/power"); |
179 | else | 184 | else |
180 | cmdline = QString::fromLatin1( "echo 0 > /sys/class/backlight/sa1100fb/power; echo %1 > /sys/class/backlight/sa1100fb/brightness" ).arg( bright ); | 185 | cmdline = QString::fromLatin1( "echo 0 > /sys/class/backlight/sa1100fb/power; echo %1 > /sys/class/backlight/sa1100fb/brightness" ).arg( bright ); |
181 | } else if ( d->m_model == Model_Jornada_720 ) { | 186 | } else if ( d->m_model == Model_Jornada_720 ) { |
182 | cmdline = QString::fromLatin1( "echo %1 > /sys/class/backlight/e1356fb/brightness" ).arg( bright ); | 187 | cmdline = QString::fromLatin1( "echo %1 > /sys/class/backlight/e1356fb/brightness" ).arg( bright ); |
183 | } | 188 | } |
184 | 189 | ||
185 | // No Global::shellQuote as we gurantee it to be sane | 190 | // No Global::shellQuote as we gurantee it to be sane |
186 | res = ( ::system( QFile::encodeName(cmdline) ) == 0 ); | 191 | res = ( ::system( QFile::encodeName(cmdline) ) == 0 ); |
187 | 192 | ||
188 | return res; | 193 | return res; |
189 | } | 194 | } |
190 | 195 | ||
191 | 196 | ||
192 | bool Jornada::setDisplayStatus ( bool on ) | 197 | bool Jornada::setDisplayStatus ( bool on ) |
193 | { | 198 | { |
194 | bool res = false; | 199 | bool res = false; |
195 | 200 | ||
196 | QString cmdline; | 201 | QString cmdline; |
197 | 202 | ||
198 | if ( d->m_model == Model_Jornada_56x ) { | 203 | if ( d->m_model == Model_Jornada_56x ) { |
199 | cmdline = QString::fromLatin1( "echo %1 > /sys/class/lcd/sa1100fb/power; echo %2 > /sys/class/backlight/sa1100fb/power").arg( on ? "0" : "4" ).arg( on ? "0" : "4" ); | 204 | cmdline = QString::fromLatin1( "echo %1 > /sys/class/lcd/sa1100fb/power; echo %2 > /sys/class/backlight/sa1100fb/power").arg( on ? "0" : "4" ).arg( on ? "0" : "4" ); |
200 | } else if ( d->m_model == Model_Jornada_720 ) { | 205 | } else if ( d->m_model == Model_Jornada_720 ) { |
201 | cmdline = QString::fromLatin1( "echo %1 > /sys/class/lcd/e1356fb/power").arg( on ? "0" : "4" ); | 206 | cmdline = QString::fromLatin1( "echo %1 > /sys/class/lcd/e1356fb/power").arg( on ? "0" : "4" ); |
202 | } | 207 | } |
203 | 208 | ||
204 | res = ( ::system( QFile::encodeName(cmdline) ) == 0 ); | 209 | res = ( ::system( QFile::encodeName(cmdline) ) == 0 ); |
205 | 210 | ||
206 | return res; | 211 | return res; |
207 | } | 212 | } |
208 | 213 | ||