author | zecke <zecke> | 2004-10-13 13:00:45 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-10-13 13:00:45 (UTC) |
commit | 72065f1f1aa12882ae63f8b063312e96dd683156 (patch) (unidiff) | |
tree | 0e4a68f4aac3cc8686987d03adc323a795db6b5c | |
parent | c931e96eb4bf7df64bca49c2343f2203bac637ba (diff) | |
download | opie-72065f1f1aa12882ae63f8b063312e96dd683156.zip opie-72065f1f1aa12882ae63f8b063312e96dd683156.tar.gz opie-72065f1f1aa12882ae63f8b063312e96dd683156.tar.bz2 |
-Create the QPE/System channel in ODevice to listen for button remapping
-Remove various connect and QCopChannel creation from actual device implementations
Let us see if that breaks anything, I hope SIMpad still will do fine. We might need to
guard if a qApp exists?
-rw-r--r-- | libopie2/opiecore/device/odevice.cpp | 13 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice.h | 1 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_ipaq.cpp | 3 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_jornada.cpp | 3 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_yopy.cpp | 4 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_zaurus.cpp | 4 |
6 files changed, 11 insertions, 17 deletions
diff --git a/libopie2/opiecore/device/odevice.cpp b/libopie2/opiecore/device/odevice.cpp index 8b64c41..67cae1c 100644 --- a/libopie2/opiecore/device/odevice.cpp +++ b/libopie2/opiecore/device/odevice.cpp | |||
@@ -148,123 +148,123 @@ ODevice *ODevice::inst() | |||
148 | } | 148 | } |
149 | else | 149 | else |
150 | { | 150 | { |
151 | qWarning( "ODevice() - can't open '%s' - unknown hardware - using default.", PATH_PROC_CPUINFO ); | 151 | qWarning( "ODevice() - can't open '%s' - unknown hardware - using default.", PATH_PROC_CPUINFO ); |
152 | } | 152 | } |
153 | if ( !dev ) dev = new ODevice(); | 153 | if ( !dev ) dev = new ODevice(); |
154 | dev->init(cpu_info); | 154 | dev->init(cpu_info); |
155 | } | 155 | } |
156 | return dev; | 156 | return dev; |
157 | } | 157 | } |
158 | 158 | ||
159 | ODevice::ODevice() | 159 | ODevice::ODevice() |
160 | { | 160 | { |
161 | d = new ODeviceData; | 161 | d = new ODeviceData; |
162 | 162 | ||
163 | d->m_modelstr = "Unknown"; | 163 | d->m_modelstr = "Unknown"; |
164 | d->m_model = Model_Unknown; | 164 | d->m_model = Model_Unknown; |
165 | d->m_vendorstr = "Unknown"; | 165 | d->m_vendorstr = "Unknown"; |
166 | d->m_vendor = Vendor_Unknown; | 166 | d->m_vendor = Vendor_Unknown; |
167 | d->m_systemstr = "Unknown"; | 167 | d->m_systemstr = "Unknown"; |
168 | d->m_system = System_Unknown; | 168 | d->m_system = System_Unknown; |
169 | d->m_sysverstr = "0.0"; | 169 | d->m_sysverstr = "0.0"; |
170 | d->m_rotation = Rot0; | 170 | d->m_rotation = Rot0; |
171 | d->m_direction = CW; | 171 | d->m_direction = CW; |
172 | 172 | ||
173 | d->m_holdtime = 1000; // 1000ms | 173 | d->m_holdtime = 1000; // 1000ms |
174 | d->m_buttons = 0; | 174 | d->m_buttons = 0; |
175 | d->m_cpu_frequencies = new QStrList; | 175 | d->m_cpu_frequencies = new QStrList; |
176 | 176 | ||
177 | 177 | ||
178 | /* mixer */ | 178 | /* mixer */ |
179 | d->m_sound = d->m_vol = d->m_mixer = -1; | 179 | d->m_sound = d->m_vol = d->m_mixer = -1; |
180 | |||
181 | /* System QCopChannel created */ | ||
182 | d->m_initializedButtonQcop = false; | ||
180 | 183 | ||
181 | // New distribution detection code first checks for legacy distributions, | 184 | // New distribution detection code first checks for legacy distributions, |
182 | // identified by /etc/familiar-version or /etc/oz_version. | 185 | // identified by /etc/familiar-version or /etc/oz_version. |
183 | // Then check for OpenEmbedded and lastly, read /etc/issue | 186 | // Then check for OpenEmbedded and lastly, read /etc/issue |
184 | 187 | ||
185 | for ( unsigned int i = 0; i < sizeof distributions; ++i ) | 188 | for ( unsigned int i = 0; i < sizeof distributions; ++i ) |
186 | { | 189 | { |
187 | if ( QFile::exists( distributions[i].sysvfile ) ) | 190 | if ( QFile::exists( distributions[i].sysvfile ) ) |
188 | { | 191 | { |
189 | d->m_systemstr = distributions[i].sysstr; | 192 | d->m_systemstr = distributions[i].sysstr; |
190 | d->m_system = distributions[i].system; | 193 | d->m_system = distributions[i].system; |
191 | d->m_sysverstr = "<Unknown>"; | 194 | d->m_sysverstr = "<Unknown>"; |
192 | QFile f( distributions[i].sysvfile ); | 195 | QFile f( distributions[i].sysvfile ); |
193 | if ( f.open( IO_ReadOnly ) ) | 196 | if ( f.open( IO_ReadOnly ) ) |
194 | { | 197 | { |
195 | QTextStream ts( &f ); | 198 | QTextStream ts( &f ); |
196 | d->m_sysverstr = ts.readLine().replace( QRegExp( "\\\\." ), "" ); | 199 | d->m_sysverstr = ts.readLine().replace( QRegExp( "\\\\." ), "" ); |
197 | } | 200 | } |
198 | break; | 201 | break; |
199 | } | 202 | } |
200 | } | 203 | } |
201 | } | 204 | } |
202 | 205 | ||
203 | void ODevice::systemMessage( const QCString &msg, const QByteArray & ) | 206 | void ODevice::systemMessage( const QCString &msg, const QByteArray & ) |
204 | { | 207 | { |
205 | if ( msg == "deviceButtonMappingChanged()" ) { | 208 | if ( msg == "deviceButtonMappingChanged()" ) { |
206 | reloadButtonMapping(); | 209 | reloadButtonMapping(); |
207 | } | 210 | } |
208 | } | 211 | } |
209 | 212 | ||
210 | void ODevice::init(const QString&) | 213 | void ODevice::init(const QString&) |
211 | { | 214 | { |
212 | } | 215 | } |
213 | 216 | ||
214 | /** | 217 | /** |
215 | * This method initialises the button mapping | 218 | * This method initialises the button mapping |
216 | */ | 219 | */ |
217 | void ODevice::initButtons() | 220 | void ODevice::initButtons() |
218 | { | 221 | { |
219 | if ( d->m_buttons ) | 222 | if ( d->m_buttons ) |
220 | return; | 223 | return; |
221 | 224 | ||
222 | qDebug ( "init Buttons" ); | 225 | qDebug ( "init Buttons" ); |
223 | d->m_buttons = new QValueList <ODeviceButton>; | 226 | d->m_buttons = new QValueList <ODeviceButton>; |
224 | for ( uint i = 0; i < ( sizeof( default_buttons ) / sizeof( default_button )); i++ ) { | 227 | for ( uint i = 0; i < ( sizeof( default_buttons ) / sizeof( default_button )); i++ ) { |
225 | default_button *db = default_buttons + i; | 228 | default_button *db = default_buttons + i; |
226 | ODeviceButton b; | 229 | ODeviceButton b; |
227 | b. setKeycode ( db->code ); | 230 | b. setKeycode ( db->code ); |
228 | b. setUserText ( QObject::tr ( "Button", db->utext )); | 231 | b. setUserText ( QObject::tr ( "Button", db->utext )); |
229 | b. setPixmap ( Resource::loadPixmap ( db->pix )); | 232 | b. setPixmap ( Resource::loadPixmap ( db->pix )); |
230 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( db->fpressedservice ), db->fpressedaction )); | 233 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( db->fpressedservice ), db->fpressedaction )); |
231 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( db->fheldservice ), db->fheldaction )); | 234 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( db->fheldservice ), db->fheldaction )); |
232 | d->m_buttons->append ( b ); | 235 | d->m_buttons->append ( b ); |
233 | } | 236 | } |
234 | 237 | ||
235 | reloadButtonMapping(); | 238 | reloadButtonMapping(); |
236 | |||
237 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); | ||
238 | connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( systemMessage(const QCString&,const QByteArray&))); | ||
239 | } | 239 | } |
240 | 240 | ||
241 | ODevice::~ODevice() | 241 | ODevice::~ODevice() |
242 | { | 242 | { |
243 | // we leak m_devicebuttons and m_cpu_frequency | 243 | // we leak m_devicebuttons and m_cpu_frequency |
244 | // but it's a singleton and it is not so importantant | 244 | // but it's a singleton and it is not so importantant |
245 | // -zecke | 245 | // -zecke |
246 | delete d; | 246 | delete d; |
247 | } | 247 | } |
248 | 248 | ||
249 | bool ODevice::setSoftSuspend ( bool /*soft*/ ) | 249 | bool ODevice::setSoftSuspend ( bool /*soft*/ ) |
250 | { | 250 | { |
251 | return false; | 251 | return false; |
252 | } | 252 | } |
253 | 253 | ||
254 | //#include <linux/apm_bios.h> | 254 | //#include <linux/apm_bios.h> |
255 | 255 | ||
256 | #define APM_IOC_SUSPEND OD_IO( 'A', 2 ) | 256 | #define APM_IOC_SUSPEND OD_IO( 'A', 2 ) |
257 | 257 | ||
258 | /** | 258 | /** |
259 | * This method will try to suspend the device | 259 | * This method will try to suspend the device |
260 | * It only works if the user is the QWS Server and the apm application | 260 | * It only works if the user is the QWS Server and the apm application |
261 | * is installed. | 261 | * is installed. |
262 | * It tries to suspend and then waits some time cause some distributions | 262 | * It tries to suspend and then waits some time cause some distributions |
263 | * do have asynchronus apm implementations. | 263 | * do have asynchronus apm implementations. |
264 | * This method will either fail and return false or it'll suspend the | 264 | * This method will either fail and return false or it'll suspend the |
265 | * device and return once the device got woken up | 265 | * device and return once the device got woken up |
266 | * | 266 | * |
267 | * @return if the device got suspended | 267 | * @return if the device got suspended |
268 | */ | 268 | */ |
269 | bool ODevice::suspend() | 269 | bool ODevice::suspend() |
270 | { | 270 | { |
@@ -616,64 +616,71 @@ const QValueList <ODeviceButton> &ODevice::buttons() | |||
616 | return *d->m_buttons; | 616 | return *d->m_buttons; |
617 | } | 617 | } |
618 | 618 | ||
619 | /** | 619 | /** |
620 | * @return The amount of time that would count as a hold | 620 | * @return The amount of time that would count as a hold |
621 | */ | 621 | */ |
622 | uint ODevice::buttonHoldTime() const | 622 | uint ODevice::buttonHoldTime() const |
623 | { | 623 | { |
624 | return d->m_holdtime; | 624 | return d->m_holdtime; |
625 | } | 625 | } |
626 | 626 | ||
627 | /** | 627 | /** |
628 | * This method return a ODeviceButton for a key code | 628 | * This method return a ODeviceButton for a key code |
629 | * or 0 if no special hardware button is available for the device | 629 | * or 0 if no special hardware button is available for the device |
630 | * | 630 | * |
631 | * @return The devicebutton or 0l | 631 | * @return The devicebutton or 0l |
632 | * @see ODeviceButton | 632 | * @see ODeviceButton |
633 | */ | 633 | */ |
634 | const ODeviceButton *ODevice::buttonForKeycode ( ushort code ) | 634 | const ODeviceButton *ODevice::buttonForKeycode ( ushort code ) |
635 | { | 635 | { |
636 | initButtons(); | 636 | initButtons(); |
637 | 637 | ||
638 | for ( QValueListConstIterator<ODeviceButton> it = d->m_buttons->begin(); it != d->m_buttons->end(); ++it ) { | 638 | for ( QValueListConstIterator<ODeviceButton> it = d->m_buttons->begin(); it != d->m_buttons->end(); ++it ) { |
639 | if ( (*it). keycode() == code ) | 639 | if ( (*it). keycode() == code ) |
640 | return &(*it); | 640 | return &(*it); |
641 | } | 641 | } |
642 | return 0; | 642 | return 0; |
643 | } | 643 | } |
644 | 644 | ||
645 | void ODevice::reloadButtonMapping() | 645 | void ODevice::reloadButtonMapping() |
646 | { | 646 | { |
647 | initButtons(); | 647 | initButtons(); |
648 | |||
649 | if(!d->m_initializedButtonQcop) { | ||
650 | QCopChannel *chan = new QCopChannel("QPE/System", this, "ODevice button channel"); | ||
651 | connect(chan,SIGNAL(received(const QCString&,const QByteArray&)), | ||
652 | this,SLOT(systemMessage(const QCString&,const QByteArray&))); | ||
653 | d->m_initializedButtonQcop = true; | ||
654 | } | ||
648 | 655 | ||
649 | Config cfg ( "ButtonSettings" ); | 656 | Config cfg ( "ButtonSettings" ); |
650 | 657 | ||
651 | for ( uint i = 0; i < d->m_buttons->count(); i++ ) { | 658 | for ( uint i = 0; i < d->m_buttons->count(); i++ ) { |
652 | ODeviceButton &b = ( *d->m_buttons ) [i]; | 659 | ODeviceButton &b = ( *d->m_buttons ) [i]; |
653 | QString group = "Button" + QString::number ( i ); | 660 | QString group = "Button" + QString::number ( i ); |
654 | 661 | ||
655 | QCString pch, hch; | 662 | QCString pch, hch; |
656 | QCString pm, hm; | 663 | QCString pm, hm; |
657 | QByteArray pdata, hdata; | 664 | QByteArray pdata, hdata; |
658 | 665 | ||
659 | if ( cfg. hasGroup ( group )) { | 666 | if ( cfg. hasGroup ( group )) { |
660 | cfg. setGroup ( group ); | 667 | cfg. setGroup ( group ); |
661 | pch = cfg. readEntry ( "PressedActionChannel" ). latin1(); | 668 | pch = cfg. readEntry ( "PressedActionChannel" ). latin1(); |
662 | pm = cfg. readEntry ( "PressedActionMessage" ). latin1(); | 669 | pm = cfg. readEntry ( "PressedActionMessage" ). latin1(); |
663 | // pdata = decodeBase64 ( buttonFile. readEntry ( "PressedActionArgs" )); | 670 | // pdata = decodeBase64 ( buttonFile. readEntry ( "PressedActionArgs" )); |
664 | 671 | ||
665 | hch = cfg. readEntry ( "HeldActionChannel" ). latin1(); | 672 | hch = cfg. readEntry ( "HeldActionChannel" ). latin1(); |
666 | hm = cfg. readEntry ( "HeldActionMessage" ). latin1(); | 673 | hm = cfg. readEntry ( "HeldActionMessage" ). latin1(); |
667 | // hdata = decodeBase64 ( buttonFile. readEntry ( "HeldActionArgs" )); | 674 | // hdata = decodeBase64 ( buttonFile. readEntry ( "HeldActionArgs" )); |
668 | } | 675 | } |
669 | 676 | ||
670 | b. setPressedAction ( OQCopMessage ( pch, pm, pdata )); | 677 | b. setPressedAction ( OQCopMessage ( pch, pm, pdata )); |
671 | 678 | ||
672 | b. setHeldAction ( OQCopMessage ( hch, hm, hdata )); | 679 | b. setHeldAction ( OQCopMessage ( hch, hm, hdata )); |
673 | } | 680 | } |
674 | } | 681 | } |
675 | 682 | ||
676 | void ODevice::remapPressedAction ( int button, const OQCopMessage &action ) | 683 | void ODevice::remapPressedAction ( int button, const OQCopMessage &action ) |
677 | { | 684 | { |
678 | initButtons(); | 685 | initButtons(); |
679 | 686 | ||
diff --git a/libopie2/opiecore/device/odevice.h b/libopie2/opiecore/device/odevice.h index 6f0d036..21fcc3f 100644 --- a/libopie2/opiecore/device/odevice.h +++ b/libopie2/opiecore/device/odevice.h | |||
@@ -328,47 +328,48 @@ private slots: | |||
328 | void playingStopped(); | 328 | void playingStopped(); |
329 | 329 | ||
330 | protected: | 330 | protected: |
331 | void addPreHandler(QWSServer::KeyboardFilter*aFilter); | 331 | void addPreHandler(QWSServer::KeyboardFilter*aFilter); |
332 | void remPreHandler(QWSServer::KeyboardFilter*aFilter); | 332 | void remPreHandler(QWSServer::KeyboardFilter*aFilter); |
333 | void reloadButtonMapping(); | 333 | void reloadButtonMapping(); |
334 | void changeMixerForAlarm( int mixer, const char* file, Sound *snd); | 334 | void changeMixerForAlarm( int mixer, const char* file, Sound *snd); |
335 | 335 | ||
336 | /* ugly virtual hook */ | 336 | /* ugly virtual hook */ |
337 | virtual void virtual_hook( int id, void* data ); | 337 | virtual void virtual_hook( int id, void* data ); |
338 | }; | 338 | }; |
339 | 339 | ||
340 | class ODeviceData { | 340 | class ODeviceData { |
341 | 341 | ||
342 | public: | 342 | public: |
343 | QString m_vendorstr; | 343 | QString m_vendorstr; |
344 | OVendor m_vendor; | 344 | OVendor m_vendor; |
345 | 345 | ||
346 | QString m_modelstr; | 346 | QString m_modelstr; |
347 | OModel m_model; | 347 | OModel m_model; |
348 | 348 | ||
349 | QString m_systemstr; | 349 | QString m_systemstr; |
350 | OSystem m_system; | 350 | OSystem m_system; |
351 | 351 | ||
352 | QString m_sysverstr; | 352 | QString m_sysverstr; |
353 | 353 | ||
354 | Transformation m_rotation; | 354 | Transformation m_rotation; |
355 | ODirection m_direction; | 355 | ODirection m_direction; |
356 | 356 | ||
357 | QValueList <ODeviceButton> *m_buttons; | 357 | QValueList <ODeviceButton> *m_buttons; |
358 | uint m_holdtime; | 358 | uint m_holdtime; |
359 | QStrList *m_cpu_frequencies; | 359 | QStrList *m_cpu_frequencies; |
360 | boolm_initializedButtonQcop : 1; | ||
360 | 361 | ||
361 | /* values for changeMixerForAlarm */ | 362 | /* values for changeMixerForAlarm */ |
362 | int m_sound, m_vol, m_mixer; | 363 | int m_sound, m_vol, m_mixer; |
363 | }; | 364 | }; |
364 | 365 | ||
365 | extern bool isQWS(); | 366 | extern bool isQWS(); |
366 | extern QCString makeChannel ( const char *str ); | 367 | extern QCString makeChannel ( const char *str ); |
367 | } | 368 | } |
368 | } | 369 | } |
369 | 370 | ||
370 | 371 | ||
371 | 372 | ||
372 | 373 | ||
373 | #endif | 374 | #endif |
374 | 375 | ||
diff --git a/libopie2/opiecore/device/odevice_ipaq.cpp b/libopie2/opiecore/device/odevice_ipaq.cpp index 6193ddc..9e01a0c 100644 --- a/libopie2/opiecore/device/odevice_ipaq.cpp +++ b/libopie2/opiecore/device/odevice_ipaq.cpp | |||
@@ -160,67 +160,64 @@ void iPAQ::init(const QString& model) | |||
160 | m_leds [0] = m_leds [1] = Led_Off; | 160 | m_leds [0] = m_leds [1] = Led_Off; |
161 | 161 | ||
162 | m_power_timer = 0; | 162 | m_power_timer = 0; |
163 | 163 | ||
164 | } | 164 | } |
165 | 165 | ||
166 | void iPAQ::initButtons() | 166 | void iPAQ::initButtons() |
167 | { | 167 | { |
168 | if ( d->m_buttons ) | 168 | if ( d->m_buttons ) |
169 | return; | 169 | return; |
170 | 170 | ||
171 | if ( isQWS( ) ) { | 171 | if ( isQWS( ) ) { |
172 | addPreHandler(this); | 172 | addPreHandler(this); |
173 | } | 173 | } |
174 | 174 | ||
175 | d->m_buttons = new QValueList <ODeviceButton>; | 175 | d->m_buttons = new QValueList <ODeviceButton>; |
176 | 176 | ||
177 | for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { | 177 | for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { |
178 | i_button *ib = ipaq_buttons + i; | 178 | i_button *ib = ipaq_buttons + i; |
179 | ODeviceButton b; | 179 | ODeviceButton b; |
180 | 180 | ||
181 | if (( ib->model & d->m_model ) == d->m_model ) { | 181 | if (( ib->model & d->m_model ) == d->m_model ) { |
182 | b. setKeycode ( ib->code ); | 182 | b. setKeycode ( ib->code ); |
183 | b. setUserText ( QObject::tr ( "Button", ib->utext )); | 183 | b. setUserText ( QObject::tr ( "Button", ib->utext )); |
184 | b. setPixmap ( Resource::loadPixmap ( ib->pix )); | 184 | b. setPixmap ( Resource::loadPixmap ( ib->pix )); |
185 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib->fpressedservice ), ib->fpressedaction )); | 185 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib->fpressedservice ), ib->fpressedaction )); |
186 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib->fheldservice ), ib->fheldaction )); | 186 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib->fheldservice ), ib->fheldaction )); |
187 | 187 | ||
188 | d->m_buttons->append ( b ); | 188 | d->m_buttons->append ( b ); |
189 | } | 189 | } |
190 | } | 190 | } |
191 | reloadButtonMapping(); | 191 | reloadButtonMapping(); |
192 | |||
193 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); | ||
194 | connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( systemMessage(const QCString&,const QByteArray&))); | ||
195 | } | 192 | } |
196 | 193 | ||
197 | QValueList <OLed> iPAQ::ledList() const | 194 | QValueList <OLed> iPAQ::ledList() const |
198 | { | 195 | { |
199 | QValueList <OLed> vl; | 196 | QValueList <OLed> vl; |
200 | vl << Led_Power; | 197 | vl << Led_Power; |
201 | 198 | ||
202 | if ( d->m_model == Model_iPAQ_H38xx ) | 199 | if ( d->m_model == Model_iPAQ_H38xx ) |
203 | vl << Led_BlueTooth; | 200 | vl << Led_BlueTooth; |
204 | return vl; | 201 | return vl; |
205 | } | 202 | } |
206 | 203 | ||
207 | QValueList <OLedState> iPAQ::ledStateList ( OLed l ) const | 204 | QValueList <OLedState> iPAQ::ledStateList ( OLed l ) const |
208 | { | 205 | { |
209 | QValueList <OLedState> vl; | 206 | QValueList <OLedState> vl; |
210 | 207 | ||
211 | if ( l == Led_Power ) | 208 | if ( l == Led_Power ) |
212 | vl << Led_Off << Led_On << Led_BlinkSlow << Led_BlinkFast; | 209 | vl << Led_Off << Led_On << Led_BlinkSlow << Led_BlinkFast; |
213 | else if ( l == Led_BlueTooth && d->m_model == Model_iPAQ_H38xx ) | 210 | else if ( l == Led_BlueTooth && d->m_model == Model_iPAQ_H38xx ) |
214 | vl << Led_Off; // << Led_On << ??? | 211 | vl << Led_Off; // << Led_On << ??? |
215 | 212 | ||
216 | return vl; | 213 | return vl; |
217 | } | 214 | } |
218 | 215 | ||
219 | OLedState iPAQ::ledState ( OLed l ) const | 216 | OLedState iPAQ::ledState ( OLed l ) const |
220 | { | 217 | { |
221 | switch ( l ) { | 218 | switch ( l ) { |
222 | case Led_Power: | 219 | case Led_Power: |
223 | return m_leds [0]; | 220 | return m_leds [0]; |
224 | case Led_BlueTooth: | 221 | case Led_BlueTooth: |
225 | return m_leds [1]; | 222 | return m_leds [1]; |
226 | default: | 223 | default: |
diff --git a/libopie2/opiecore/device/odevice_jornada.cpp b/libopie2/opiecore/device/odevice_jornada.cpp index 2cab0c8..8141f1c 100644 --- a/libopie2/opiecore/device/odevice_jornada.cpp +++ b/libopie2/opiecore/device/odevice_jornada.cpp | |||
@@ -111,67 +111,64 @@ struct j_button jornada56x_buttons [] = { | |||
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 | |||
144 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); | ||
145 | connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( systemMessage(const QCString&,const QByteArray&))); | ||
146 | } | 143 | } |
147 | 144 | ||
148 | int Jornada::displayBrightnessResolution() const | 145 | int Jornada::displayBrightnessResolution() const |
149 | { | 146 | { |
150 | return 255; | 147 | return 255; |
151 | } | 148 | } |
152 | 149 | ||
153 | 150 | ||
154 | bool Jornada::setDisplayBrightness( int bright ) | 151 | bool Jornada::setDisplayBrightness( int bright ) |
155 | { | 152 | { |
156 | bool res = false; | 153 | bool res = false; |
157 | 154 | ||
158 | if ( bright > 255 ) | 155 | if ( bright > 255 ) |
159 | bright = 255; | 156 | bright = 255; |
160 | if ( bright < 0 ) | 157 | if ( bright < 0 ) |
161 | bright = 0; | 158 | bright = 0; |
162 | 159 | ||
163 | QString cmdline; | 160 | QString cmdline; |
164 | 161 | ||
165 | if ( !bright ) | 162 | if ( !bright ) |
166 | cmdline = QString().sprintf( "echo 4 > /sys/class/backlight/sa1100fb/power"); | 163 | cmdline = QString().sprintf( "echo 4 > /sys/class/backlight/sa1100fb/power"); |
167 | else | 164 | else |
168 | cmdline = QString().sprintf( "echo 0 > /sys/class/backlight/sa1100fb/power; echo %d > /sys/class/backlight/sa1100fb/brightness", bright ); | 165 | cmdline = QString().sprintf( "echo 0 > /sys/class/backlight/sa1100fb/power; echo %d > /sys/class/backlight/sa1100fb/brightness", bright ); |
169 | 166 | ||
170 | res = ( ::system( (const char*) cmdline ) == 0 ); | 167 | res = ( ::system( (const char*) cmdline ) == 0 ); |
171 | 168 | ||
172 | return res; | 169 | return res; |
173 | } | 170 | } |
174 | 171 | ||
175 | 172 | ||
176 | bool Jornada::suspend( ) | 173 | bool Jornada::suspend( ) |
177 | { | 174 | { |
diff --git a/libopie2/opiecore/device/odevice_yopy.cpp b/libopie2/opiecore/device/odevice_yopy.cpp index a06d7ec..8f22514 100644 --- a/libopie2/opiecore/device/odevice_yopy.cpp +++ b/libopie2/opiecore/device/odevice_yopy.cpp | |||
@@ -80,68 +80,64 @@ void Yopy::init(const QString&) | |||
80 | d->m_rotation = Rot0; | 80 | d->m_rotation = Rot0; |
81 | d->m_systemstr = "Linupy"; | 81 | d->m_systemstr = "Linupy"; |
82 | d->m_system = System_Linupy; | 82 | d->m_system = System_Linupy; |
83 | // Distribution detection code now in the base class | 83 | // Distribution detection code now in the base class |
84 | } | 84 | } |
85 | 85 | ||
86 | 86 | ||
87 | void Yopy::initButtons() | 87 | void Yopy::initButtons() |
88 | { | 88 | { |
89 | if ( d->m_buttons ) | 89 | if ( d->m_buttons ) |
90 | return ; | 90 | return ; |
91 | 91 | ||
92 | d->m_buttons = new QValueList <ODeviceButton>; | 92 | d->m_buttons = new QValueList <ODeviceButton>; |
93 | 93 | ||
94 | for ( uint i = 0; i < ( sizeof( yopy_buttons ) / sizeof( yopy_button ) ); i++ ) | 94 | for ( uint i = 0; i < ( sizeof( yopy_buttons ) / sizeof( yopy_button ) ); i++ ) |
95 | { | 95 | { |
96 | 96 | ||
97 | yopy_button *ib = yopy_buttons + i; | 97 | yopy_button *ib = yopy_buttons + i; |
98 | 98 | ||
99 | ODeviceButton b; | 99 | ODeviceButton b; |
100 | 100 | ||
101 | b. setKeycode ( ib->code ); | 101 | b. setKeycode ( ib->code ); |
102 | b. setUserText ( QObject::tr ( "Button", ib->utext ) ); | 102 | b. setUserText ( QObject::tr ( "Button", ib->utext ) ); |
103 | b. setPixmap ( Resource::loadPixmap ( ib->pix ) ); | 103 | b. setPixmap ( Resource::loadPixmap ( ib->pix ) ); |
104 | b. setFactoryPresetPressedAction | 104 | b. setFactoryPresetPressedAction |
105 | ( OQCopMessage( makeChannel( ib->fpressedservice ), ib->fpressedaction ) ); | 105 | ( OQCopMessage( makeChannel( ib->fpressedservice ), ib->fpressedaction ) ); |
106 | b. setFactoryPresetHeldAction | 106 | b. setFactoryPresetHeldAction |
107 | ( OQCopMessage( makeChannel( ib->fheldservice ), ib->fheldaction ) ); | 107 | ( OQCopMessage( makeChannel( ib->fheldservice ), ib->fheldaction ) ); |
108 | 108 | ||
109 | d->m_buttons->append ( b ); | 109 | d->m_buttons->append ( b ); |
110 | } | 110 | } |
111 | reloadButtonMapping(); | 111 | reloadButtonMapping(); |
112 | |||
113 | QCopChannel *sysch = new QCopChannel( "QPE/System", this ); | ||
114 | connect( sysch, SIGNAL( received(const QCString&,const QByteArray&) ), | ||
115 | this, SLOT( systemMessage(const QCString&,const QByteArray&) ) ); | ||
116 | } | 112 | } |
117 | 113 | ||
118 | 114 | ||
119 | bool Yopy::suspend() | 115 | bool Yopy::suspend() |
120 | { | 116 | { |
121 | /* Opie for Yopy does not implement its own power management at the | 117 | /* Opie for Yopy does not implement its own power management at the |
122 | moment. The public version runs parallel to X, and relies on the | 118 | moment. The public version runs parallel to X, and relies on the |
123 | existing power management features. */ | 119 | existing power management features. */ |
124 | return false; | 120 | return false; |
125 | } | 121 | } |
126 | 122 | ||
127 | 123 | ||
128 | bool Yopy::setDisplayBrightness( int bright ) | 124 | bool Yopy::setDisplayBrightness( int bright ) |
129 | { | 125 | { |
130 | /* The code here works, but is disabled as the current version runs | 126 | /* The code here works, but is disabled as the current version runs |
131 | parallel to X, and relies on the existing backlight demon. */ | 127 | parallel to X, and relies on the existing backlight demon. */ |
132 | #if 0 | 128 | #if 0 |
133 | if ( QFile::exists( "/proc/sys/pm/light" ) ) | 129 | if ( QFile::exists( "/proc/sys/pm/light" ) ) |
134 | { | 130 | { |
135 | int fd = ::open( "/proc/sys/pm/light", O_WRONLY ); | 131 | int fd = ::open( "/proc/sys/pm/light", O_WRONLY ); |
136 | if ( fd >= 0 ) | 132 | if ( fd >= 0 ) |
137 | { | 133 | { |
138 | if ( bright ) | 134 | if ( bright ) |
139 | ::write( fd, "1\n", 2 ); | 135 | ::write( fd, "1\n", 2 ); |
140 | else | 136 | else |
141 | ::write( fd, "0\n", 2 ); | 137 | ::write( fd, "0\n", 2 ); |
142 | ::close( fd ); | 138 | ::close( fd ); |
143 | return true; | 139 | return true; |
144 | } | 140 | } |
145 | } | 141 | } |
146 | #else | 142 | #else |
147 | Q_UNUSED( bright ) | 143 | Q_UNUSED( bright ) |
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp index 733479e..ebe1949 100644 --- a/libopie2/opiecore/device/odevice_zaurus.cpp +++ b/libopie2/opiecore/device/odevice_zaurus.cpp | |||
@@ -209,68 +209,64 @@ void Zaurus::initButtons() | |||
209 | 209 | ||
210 | d->m_buttons = new QValueList <ODeviceButton>; | 210 | d->m_buttons = new QValueList <ODeviceButton>; |
211 | 211 | ||
212 | struct z_button * pz_buttons; | 212 | struct z_button * pz_buttons; |
213 | int buttoncount; | 213 | int buttoncount; |
214 | switch ( d->m_model ) { | 214 | switch ( d->m_model ) { |
215 | case Model_Zaurus_SLC7x0: | 215 | case Model_Zaurus_SLC7x0: |
216 | pz_buttons = z_buttons_c700; | 216 | pz_buttons = z_buttons_c700; |
217 | buttoncount = ARRAY_SIZE(z_buttons_c700); | 217 | buttoncount = ARRAY_SIZE(z_buttons_c700); |
218 | break; | 218 | break; |
219 | default: | 219 | default: |
220 | pz_buttons = z_buttons; | 220 | pz_buttons = z_buttons; |
221 | buttoncount = ARRAY_SIZE(z_buttons); | 221 | buttoncount = ARRAY_SIZE(z_buttons); |
222 | break; | 222 | break; |
223 | } | 223 | } |
224 | 224 | ||
225 | for ( int i = 0; i < buttoncount; i++ ) { | 225 | for ( int i = 0; i < buttoncount; i++ ) { |
226 | struct z_button *zb = pz_buttons + i; | 226 | struct z_button *zb = pz_buttons + i; |
227 | ODeviceButton b; | 227 | ODeviceButton b; |
228 | 228 | ||
229 | b. setKeycode ( zb->code ); | 229 | b. setKeycode ( zb->code ); |
230 | b. setUserText ( QObject::tr ( "Button", zb->utext )); | 230 | b. setUserText ( QObject::tr ( "Button", zb->utext )); |
231 | b. setPixmap ( Resource::loadPixmap ( zb->pix )); | 231 | b. setPixmap ( Resource::loadPixmap ( zb->pix )); |
232 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( zb->fpressedservice ), | 232 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( zb->fpressedservice ), |
233 | zb->fpressedaction )); | 233 | zb->fpressedaction )); |
234 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( zb->fheldservice ), | 234 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( zb->fheldservice ), |
235 | zb->fheldaction )); | 235 | zb->fheldaction )); |
236 | 236 | ||
237 | d->m_buttons->append ( b ); | 237 | d->m_buttons->append ( b ); |
238 | } | 238 | } |
239 | 239 | ||
240 | reloadButtonMapping(); | 240 | reloadButtonMapping(); |
241 | |||
242 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); | ||
243 | connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), | ||
244 | this, SLOT( systemMessage(const QCString&,const QByteArray&))); | ||
245 | } | 241 | } |
246 | 242 | ||
247 | #include <unistd.h> | 243 | #include <unistd.h> |
248 | #include <fcntl.h> | 244 | #include <fcntl.h> |
249 | #include <sys/ioctl.h> | 245 | #include <sys/ioctl.h> |
250 | 246 | ||
251 | //#include <asm/sharp_char.h> // including kernel headers is evil ... | 247 | //#include <asm/sharp_char.h> // including kernel headers is evil ... |
252 | 248 | ||
253 | #define SHARP_DEV_IOCTL_COMMAND_START 0x5680 | 249 | #define SHARP_DEV_IOCTL_COMMAND_START 0x5680 |
254 | 250 | ||
255 | #defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) | 251 | #defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) |
256 | #define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) | 252 | #define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) |
257 | 253 | ||
258 | #define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ | 254 | #define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ |
259 | #define SHARP_BUZ_KEYSOUND 2 /* key sound */ | 255 | #define SHARP_BUZ_KEYSOUND 2 /* key sound */ |
260 | #define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ | 256 | #define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ |
261 | 257 | ||
262 | /* --- for SHARP_BUZZER device --- */ | 258 | /* --- for SHARP_BUZZER device --- */ |
263 | 259 | ||
264 | //#defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) | 260 | //#defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) |
265 | //#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) | 261 | //#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) |
266 | 262 | ||
267 | #define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1) | 263 | #define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1) |
268 | #define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2) | 264 | #define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2) |
269 | #define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3) | 265 | #define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3) |
270 | #define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4) | 266 | #define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4) |
271 | #define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5) | 267 | #define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5) |
272 | 268 | ||
273 | //#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ | 269 | //#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ |
274 | //#define SHARP_BUZ_KEYSOUND 2 /* key sound */ | 270 | //#define SHARP_BUZ_KEYSOUND 2 /* key sound */ |
275 | 271 | ||
276 | //#define SHARP_PDA_ILLCLICKSOUND 3 /* illegal click */ | 272 | //#define SHARP_PDA_ILLCLICKSOUND 3 /* illegal click */ |