summaryrefslogtreecommitdiff
path: root/libopie
Unidiff
Diffstat (limited to 'libopie') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/odevice.cpp4
-rw-r--r--libopie/odevice.h2
2 files changed, 5 insertions, 1 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp
index d6e6892..993aedf 100644
--- a/libopie/odevice.cpp
+++ b/libopie/odevice.cpp
@@ -756,65 +756,65 @@ bool ODevice::setLedState ( OLed which, OLedState st )
756bool ODevice::hasLightSensor ( ) const 756bool ODevice::hasLightSensor ( ) const
757{ 757{
758 return false; 758 return false;
759} 759}
760 760
761/** 761/**
762 * @return a value from the light senso 762 * @return a value from the light senso
763 */ 763 */
764int ODevice::readLightSensor ( ) 764int ODevice::readLightSensor ( )
765{ 765{
766 return -1; 766 return -1;
767} 767}
768 768
769/** 769/**
770 * @return the light sensor resolution whatever that is ;) 770 * @return the light sensor resolution whatever that is ;)
771 */ 771 */
772int ODevice::lightSensorResolution ( ) const 772int ODevice::lightSensorResolution ( ) const
773{ 773{
774 return 0; 774 return 0;
775} 775}
776 776
777/** 777/**
778 * @return a list with CPU frequencies supported by the hardware 778 * @return a list with CPU frequencies supported by the hardware
779 */ 779 */
780const QStrList &ODevice::allowedCpuFrequencies ( ) const 780const QStrList &ODevice::allowedCpuFrequencies ( ) const
781{ 781{
782 return *d->m_cpu_frequencies; 782 return *d->m_cpu_frequencies;
783} 783}
784 784
785 785
786/** 786/**
787 * Set desired CPU frequency 787 * Set desired CPU frequency
788 * 788 *
789 * @param index index into d->m_cpu_frequencies of the frequency to be set 789 * @param index index into d->m_cpu_frequencies of the frequency to be set
790 */ 790 */
791bool ODevice::setCurrentCpuFrequency(uint index) 791bool ODevice::setCurrentCpuFrequency(uint index)
792{ 792{
793 if (index >= d->m_cpu_frequencies->count()) 793 if (index >= d->m_cpu_frequencies->count())
794 return false; 794 return false;
795 795
796 char *freq = d->m_cpu_frequencies->at(index); 796 char *freq = d->m_cpu_frequencies->at(index);
797 qWarning("set freq to %s", freq); 797 qWarning("set freq to %s", freq);
798 798
799 int fd; 799 int fd;
800 800
801 if ((fd = ::open("/proc/sys/cpu/0/speed", O_WRONLY)) >= 0) { 801 if ((fd = ::open("/proc/sys/cpu/0/speed", O_WRONLY)) >= 0) {
802 char writeCommand[50]; 802 char writeCommand[50];
803 const int count = sprintf(writeCommand, "%s\n", freq); 803 const int count = sprintf(writeCommand, "%s\n", freq);
804 int res = (::write(fd, writeCommand, count) != -1); 804 int res = (::write(fd, writeCommand, count) != -1);
805 ::close(fd); 805 ::close(fd);
806 return res; 806 return res;
807 } 807 }
808 808
809 return false; 809 return false;
810} 810}
811 811
812 812
813/** 813/**
814 * @return a list of hardware buttons 814 * @return a list of hardware buttons
815 */ 815 */
816const QValueList <ODeviceButton> &ODevice::buttons ( ) 816const QValueList <ODeviceButton> &ODevice::buttons ( )
817{ 817{
818 initButtons ( ); 818 initButtons ( );
819 819
820 return *d-> m_buttons; 820 return *d-> m_buttons;
@@ -891,65 +891,67 @@ void ODevice::remapPressedAction ( int button, const OQCopMessage &action )
891 891
892 mb_chan=b. pressedAction ( ). channel ( ); 892 mb_chan=b. pressedAction ( ). channel ( );
893 893
894 Config buttonFile ( "ButtonSettings" ); 894 Config buttonFile ( "ButtonSettings" );
895 buttonFile. setGroup ( "Button" + QString::number ( button )); 895 buttonFile. setGroup ( "Button" + QString::number ( button ));
896 buttonFile. writeEntry ( "PressedActionChannel", (const char*) mb_chan); 896 buttonFile. writeEntry ( "PressedActionChannel", (const char*) mb_chan);
897 buttonFile. writeEntry ( "PressedActionMessage", (const char*) b. pressedAction ( ). message ( )); 897 buttonFile. writeEntry ( "PressedActionMessage", (const char*) b. pressedAction ( ). message ( ));
898 898
899 //buttonFile. writeEntry ( "PressedActionArgs", encodeBase64 ( b. pressedAction ( ). data ( ))); 899 //buttonFile. writeEntry ( "PressedActionArgs", encodeBase64 ( b. pressedAction ( ). data ( )));
900 900
901 QCopEnvelope ( "QPE/System", "deviceButtonMappingChanged()" ); 901 QCopEnvelope ( "QPE/System", "deviceButtonMappingChanged()" );
902} 902}
903 903
904void ODevice::remapHeldAction ( int button, const OQCopMessage &action ) 904void ODevice::remapHeldAction ( int button, const OQCopMessage &action )
905{ 905{
906 initButtons ( ); 906 initButtons ( );
907 907
908 if ( button >= (int) d-> m_buttons-> count ( )) 908 if ( button >= (int) d-> m_buttons-> count ( ))
909 return; 909 return;
910 910
911 ODeviceButton &b = ( *d-> m_buttons ) [button]; 911 ODeviceButton &b = ( *d-> m_buttons ) [button];
912 b. setHeldAction ( action ); 912 b. setHeldAction ( action );
913 913
914 Config buttonFile ( "ButtonSettings" ); 914 Config buttonFile ( "ButtonSettings" );
915 buttonFile. setGroup ( "Button" + QString::number ( button )); 915 buttonFile. setGroup ( "Button" + QString::number ( button ));
916 buttonFile. writeEntry ( "HeldActionChannel", (const char *) b. heldAction ( ). channel ( )); 916 buttonFile. writeEntry ( "HeldActionChannel", (const char *) b. heldAction ( ). channel ( ));
917 buttonFile. writeEntry ( "HeldActionMessage", (const char *) b. heldAction ( ). message ( )); 917 buttonFile. writeEntry ( "HeldActionMessage", (const char *) b. heldAction ( ). message ( ));
918 918
919 //buttonFile. writeEntry ( "HeldActionArgs", decodeBase64 ( b. heldAction ( ). data ( ))); 919 //buttonFile. writeEntry ( "HeldActionArgs", decodeBase64 ( b. heldAction ( ). data ( )));
920 920
921 QCopEnvelope ( "QPE/System", "deviceButtonMappingChanged()" ); 921 QCopEnvelope ( "QPE/System", "deviceButtonMappingChanged()" );
922} 922}
923void ODevice::virtual_hook( int id, void* data ) {
923 924
925}
924 926
925 927
926 928
927/************************************************** 929/**************************************************
928 * 930 *
929 * iPAQ 931 * iPAQ
930 * 932 *
931 **************************************************/ 933 **************************************************/
932 934
933void iPAQ::init ( ) 935void iPAQ::init ( )
934{ 936{
935 d-> m_vendorstr = "HP"; 937 d-> m_vendorstr = "HP";
936 d-> m_vendor = Vendor_HP; 938 d-> m_vendor = Vendor_HP;
937 939
938 QFile f ( "/proc/hal/model" ); 940 QFile f ( "/proc/hal/model" );
939 941
940 if ( f. open ( IO_ReadOnly )) { 942 if ( f. open ( IO_ReadOnly )) {
941 QTextStream ts ( &f ); 943 QTextStream ts ( &f );
942 944
943 d-> m_modelstr = "H" + ts. readLine ( ); 945 d-> m_modelstr = "H" + ts. readLine ( );
944 946
945 if ( d-> m_modelstr == "H3100" ) 947 if ( d-> m_modelstr == "H3100" )
946 d-> m_model = Model_iPAQ_H31xx; 948 d-> m_model = Model_iPAQ_H31xx;
947 else if ( d-> m_modelstr == "H3600" ) 949 else if ( d-> m_modelstr == "H3600" )
948 d-> m_model = Model_iPAQ_H36xx; 950 d-> m_model = Model_iPAQ_H36xx;
949 else if ( d-> m_modelstr == "H3700" ) 951 else if ( d-> m_modelstr == "H3700" )
950 d-> m_model = Model_iPAQ_H37xx; 952 d-> m_model = Model_iPAQ_H37xx;
951 else if ( d-> m_modelstr == "H3800" ) 953 else if ( d-> m_modelstr == "H3800" )
952 d-> m_model = Model_iPAQ_H38xx; 954 d-> m_model = Model_iPAQ_H38xx;
953 else if ( d-> m_modelstr == "H3900" ) 955 else if ( d-> m_modelstr == "H3900" )
954 d-> m_model = Model_iPAQ_H39xx; 956 d-> m_model = Model_iPAQ_H39xx;
955 else 957 else
diff --git a/libopie/odevice.h b/libopie/odevice.h
index f2f6467..a232d69 100644
--- a/libopie/odevice.h
+++ b/libopie/odevice.h
@@ -211,38 +211,40 @@ public:
211 211
212 /** 212 /**
213 * Returns the DeviceButton for the \a keyCode. If \a keyCode is not found, it 213 * Returns the DeviceButton for the \a keyCode. If \a keyCode is not found, it
214 * returns 0L 214 * returns 0L
215 */ 215 */
216 const ODeviceButton *buttonForKeycode ( ushort keyCode ); 216 const ODeviceButton *buttonForKeycode ( ushort keyCode );
217 217
218 /** 218 /**
219 * Reassigns the pressed action for \a button. To return to the factory 219 * Reassigns the pressed action for \a button. To return to the factory
220 * default pass an empty string as \a qcopMessage. 220 * default pass an empty string as \a qcopMessage.
221 */ 221 */
222 void remapPressedAction ( int button, const OQCopMessage &qcopMessage ); 222 void remapPressedAction ( int button, const OQCopMessage &qcopMessage );
223 223
224 /** 224 /**
225 * Reassigns the held action for \a button. To return to the factory 225 * Reassigns the held action for \a button. To return to the factory
226 * default pass an empty string as \a qcopMessage. 226 * default pass an empty string as \a qcopMessage.
227 */ 227 */
228 void remapHeldAction ( int button, const OQCopMessage &qcopMessage ); 228 void remapHeldAction ( int button, const OQCopMessage &qcopMessage );
229 229
230 /** 230 /**
231 * How long (in ms) you have to press a button for a "hold" action 231 * How long (in ms) you have to press a button for a "hold" action
232 */ 232 */
233 uint buttonHoldTime ( ) const; 233 uint buttonHoldTime ( ) const;
234 234
235signals: 235signals:
236 void buttonMappingChanged ( ); 236 void buttonMappingChanged ( );
237 237
238private slots: 238private slots:
239 void systemMessage ( const QCString &, const QByteArray & ); 239 void systemMessage ( const QCString &, const QByteArray & );
240 240
241protected: 241protected:
242 void reloadButtonMapping ( ); 242 void reloadButtonMapping ( );
243 /* ugly virtual hook */
244 virtual void virtual_hook( int id, void* data );
243}; 245};
244 246
245} 247}
246 248
247#endif 249#endif
248 250