-rw-r--r-- | libopie/odevice.cpp | 4 | ||||
-rw-r--r-- | libopie/odevice.h | 2 |
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 | |||
@@ -764,49 +764,49 @@ bool ODevice::hasLightSensor ( ) const | |||
764 | int ODevice::readLightSensor ( ) | 764 | int 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 | */ |
772 | int ODevice::lightSensorResolution ( ) const | 772 | int 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 | */ |
780 | const QStrList &ODevice::allowedCpuFrequencies ( ) const | 780 | const 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 | */ |
791 | bool ODevice::setCurrentCpuFrequency(uint index) | 791 | bool 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 | ||
@@ -899,49 +899,51 @@ void ODevice::remapPressedAction ( int button, const OQCopMessage &action ) | |||
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 | ||
904 | void ODevice::remapHeldAction ( int button, const OQCopMessage &action ) | 904 | void 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 | } |
923 | void 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 | ||
933 | void iPAQ::init ( ) | 935 | void 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" ) |
diff --git a/libopie/odevice.h b/libopie/odevice.h index f2f6467..a232d69 100644 --- a/libopie/odevice.h +++ b/libopie/odevice.h | |||
@@ -219,30 +219,32 @@ public: | |||
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 | ||
235 | signals: | 235 | signals: |
236 | void buttonMappingChanged ( ); | 236 | void buttonMappingChanged ( ); |
237 | 237 | ||
238 | private slots: | 238 | private slots: |
239 | void systemMessage ( const QCString &, const QByteArray & ); | 239 | void systemMessage ( const QCString &, const QByteArray & ); |
240 | 240 | ||
241 | protected: | 241 | protected: |
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 | ||