-rw-r--r-- | libopie/odevice.cpp | 19 | ||||
-rw-r--r-- | libopie/odevice.h | 1 |
2 files changed, 18 insertions, 2 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp index bc43c52..a33d4ad 100644 --- a/libopie/odevice.cpp +++ b/libopie/odevice.cpp | |||
@@ -669,121 +669,136 @@ int iPAQ::displayBrightnessResolution ( ) const | |||
669 | return 2; | 669 | return 2; |
670 | } | 670 | } |
671 | } | 671 | } |
672 | 672 | ||
673 | 673 | ||
674 | bool iPAQ::hasLightSensor ( ) const | 674 | bool iPAQ::hasLightSensor ( ) const |
675 | { | 675 | { |
676 | return true; | 676 | return true; |
677 | } | 677 | } |
678 | 678 | ||
679 | int iPAQ::readLightSensor ( ) | 679 | int iPAQ::readLightSensor ( ) |
680 | { | 680 | { |
681 | int fd; | 681 | int fd; |
682 | int val = -1; | 682 | int val = -1; |
683 | 683 | ||
684 | if (( fd = ::open ( "/proc/hal/light_sensor", O_RDONLY )) >= 0 ) { | 684 | if (( fd = ::open ( "/proc/hal/light_sensor", O_RDONLY )) >= 0 ) { |
685 | char buffer [8]; | 685 | char buffer [8]; |
686 | 686 | ||
687 | if ( ::read ( fd, buffer, 5 ) == 5 ) { | 687 | if ( ::read ( fd, buffer, 5 ) == 5 ) { |
688 | char *endptr; | 688 | char *endptr; |
689 | 689 | ||
690 | buffer [4] = 0; | 690 | buffer [4] = 0; |
691 | val = ::strtol ( buffer + 2, &endptr, 16 ); | 691 | val = ::strtol ( buffer + 2, &endptr, 16 ); |
692 | 692 | ||
693 | if ( *endptr != 0 ) | 693 | if ( *endptr != 0 ) |
694 | val = -1; | 694 | val = -1; |
695 | } | 695 | } |
696 | ::close ( fd ); | 696 | ::close ( fd ); |
697 | } | 697 | } |
698 | 698 | ||
699 | return val; | 699 | return val; |
700 | } | 700 | } |
701 | 701 | ||
702 | int iPAQ::lightSensorResolution ( ) const | 702 | int iPAQ::lightSensorResolution ( ) const |
703 | { | 703 | { |
704 | return 256; | 704 | return 256; |
705 | } | 705 | } |
706 | 706 | ||
707 | /************************************************** | 707 | /************************************************** |
708 | * | 708 | * |
709 | * Zaurus | 709 | * Zaurus |
710 | * | 710 | * |
711 | **************************************************/ | 711 | **************************************************/ |
712 | 712 | ||
713 | 713 | ||
714 | 714 | ||
715 | void Zaurus::init ( ) | 715 | void Zaurus::init ( ) |
716 | { | 716 | { |
717 | d-> m_modelstr = "Zaurus SL5000"; | ||
718 | d-> m_model = Model_Zaurus_SL5000; | ||
719 | d-> m_vendorstr = "Sharp"; | 717 | d-> m_vendorstr = "Sharp"; |
720 | d-> m_vendor = Vendor_Sharp; | 718 | d-> m_vendor = Vendor_Sharp; |
721 | 719 | ||
722 | QFile f ( "/proc/filesystems" ); | 720 | QFile f ( "/proc/filesystems" ); |
723 | 721 | ||
724 | if ( f. open ( IO_ReadOnly ) && ( QTextStream ( &f ). read ( ). find ( "\tjffs2\n" ) >= 0 )) { | 722 | if ( f. open ( IO_ReadOnly ) && ( QTextStream ( &f ). read ( ). find ( "\tjffs2\n" ) >= 0 )) { |
725 | d-> m_systemstr = "OpenZaurus"; | 723 | d-> m_systemstr = "OpenZaurus"; |
726 | d-> m_system = System_OpenZaurus; | 724 | d-> m_system = System_OpenZaurus; |
727 | 725 | ||
728 | f. close ( ); | 726 | f. close ( ); |
729 | 727 | ||
730 | f. setName ( "/etc/oz_version" ); | 728 | f. setName ( "/etc/oz_version" ); |
731 | if ( f. open ( IO_ReadOnly )) { | 729 | if ( f. open ( IO_ReadOnly )) { |
732 | QTextStream ts ( &f ); | 730 | QTextStream ts ( &f ); |
733 | d-> m_sysverstr = ts. readLine ( );//. mid ( 10 ); | 731 | d-> m_sysverstr = ts. readLine ( );//. mid ( 10 ); |
734 | f. close ( ); | 732 | f. close ( ); |
735 | } | 733 | } |
736 | } | 734 | } |
737 | else { | 735 | else { |
738 | d-> m_systemstr = "Zaurus"; | 736 | d-> m_systemstr = "Zaurus"; |
739 | d-> m_system = System_Zaurus; | 737 | d-> m_system = System_Zaurus; |
740 | } | 738 | } |
741 | 739 | ||
740 | f. setName ( "/proc/deviceinfo/product" ); | ||
741 | if ( f. open ( IO_ReadOnly ) ) { | ||
742 | QTextStream ts ( &f ); | ||
743 | QString model = ts. readLine ( ); | ||
744 | f. close ( ); | ||
745 | if ( model == "SL-5000D" ) { | ||
746 | d-> m_model = Model_Zaurus_SL5000; | ||
747 | d-> m_modelstr = "Zaurus SL-5000D"; | ||
748 | } else if ( model == "SL-5500" ) { | ||
749 | d-> m_model = Model_Zaurus_SL5500; | ||
750 | d-> m_modelstr = "Zaurus SL-5500"; | ||
751 | } | ||
752 | } | ||
753 | else { | ||
754 | d-> m_model = Model_Zaurus_SL5000; | ||
755 | d-> m_modelstr = "Zaurus SL-5000D (unverified)"; | ||
756 | } | ||
742 | 757 | ||
743 | m_leds [0] = Led_Off; | 758 | m_leds [0] = Led_Off; |
744 | } | 759 | } |
745 | 760 | ||
746 | #include <unistd.h> | 761 | #include <unistd.h> |
747 | #include <fcntl.h> | 762 | #include <fcntl.h> |
748 | #include <sys/ioctl.h> | 763 | #include <sys/ioctl.h> |
749 | 764 | ||
750 | //#include <asm/sharp_char.h> // including kernel headers is evil ... | 765 | //#include <asm/sharp_char.h> // including kernel headers is evil ... |
751 | 766 | ||
752 | #define SHARP_DEV_IOCTL_COMMAND_START 0x5680 | 767 | #define SHARP_DEV_IOCTL_COMMAND_START 0x5680 |
753 | 768 | ||
754 | #defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) | 769 | #defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) |
755 | #define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) | 770 | #define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) |
756 | 771 | ||
757 | #define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ | 772 | #define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ |
758 | #define SHARP_BUZ_KEYSOUND 2 /* key sound */ | 773 | #define SHARP_BUZ_KEYSOUND 2 /* key sound */ |
759 | #define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ | 774 | #define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ |
760 | 775 | ||
761 | /* --- for SHARP_BUZZER device --- */ | 776 | /* --- for SHARP_BUZZER device --- */ |
762 | 777 | ||
763 | //#defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) | 778 | //#defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) |
764 | //#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) | 779 | //#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) |
765 | 780 | ||
766 | #define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1) | 781 | #define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1) |
767 | #define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2) | 782 | #define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2) |
768 | #define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3) | 783 | #define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3) |
769 | #define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4) | 784 | #define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4) |
770 | #define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5) | 785 | #define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5) |
771 | 786 | ||
772 | //#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ | 787 | //#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ |
773 | //#define SHARP_BUZ_KEYSOUND 2 /* key sound */ | 788 | //#define SHARP_BUZ_KEYSOUND 2 /* key sound */ |
774 | 789 | ||
775 | //#define SHARP_PDA_ILLCLICKSOUND 3 /* illegal click */ | 790 | //#define SHARP_PDA_ILLCLICKSOUND 3 /* illegal click */ |
776 | //#define SHARP_PDA_WARNSOUND 4 /* warning occurred */ | 791 | //#define SHARP_PDA_WARNSOUND 4 /* warning occurred */ |
777 | //#define SHARP_PDA_ERRORSOUND 5 /* error occurred */ | 792 | //#define SHARP_PDA_ERRORSOUND 5 /* error occurred */ |
778 | //#define SHARP_PDA_CRITICALSOUND 6 /* critical error occurred */ | 793 | //#define SHARP_PDA_CRITICALSOUND 6 /* critical error occurred */ |
779 | //#define SHARP_PDA_SYSSTARTSOUND 7 /* system start */ | 794 | //#define SHARP_PDA_SYSSTARTSOUND 7 /* system start */ |
780 | //#define SHARP_PDA_SYSTEMENDSOUND 8 /* system shutdown */ | 795 | //#define SHARP_PDA_SYSTEMENDSOUND 8 /* system shutdown */ |
781 | //#define SHARP_PDA_APPSTART 9 /* application start */ | 796 | //#define SHARP_PDA_APPSTART 9 /* application start */ |
782 | //#define SHARP_PDA_APPQUIT 10 /* application ends */ | 797 | //#define SHARP_PDA_APPQUIT 10 /* application ends */ |
783 | 798 | ||
784 | //#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ | 799 | //#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ |
785 | //#define SHARP_BUZ_DAILY_ALARM 12 /* daily alarm */ | 800 | //#define SHARP_BUZ_DAILY_ALARM 12 /* daily alarm */ |
786 | //#define SHARP_BUZ_GOT_PHONE_CALL 13 /* phone call sound */ | 801 | //#define SHARP_BUZ_GOT_PHONE_CALL 13 /* phone call sound */ |
787 | //#define SHARP_BUZ_GOT_MAIL 14 /* mail sound */ | 802 | //#define SHARP_BUZ_GOT_MAIL 14 /* mail sound */ |
788 | // | 803 | // |
789 | 804 | ||
diff --git a/libopie/odevice.h b/libopie/odevice.h index e50009c..86491d4 100644 --- a/libopie/odevice.h +++ b/libopie/odevice.h | |||
@@ -1,94 +1,95 @@ | |||
1 | /* This file is part of the OPIE libraries | 1 | /* This file is part of the OPIE libraries |
2 | Copyright (C) 2002 Robert Griebl (sandman@handhelds.org) | 2 | Copyright (C) 2002 Robert Griebl (sandman@handhelds.org) |
3 | 3 | ||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Library General Public | 5 | modify it under the terms of the GNU Library General Public |
6 | License as published by the Free Software Foundation; either | 6 | License as published by the Free Software Foundation; either |
7 | version 2 of the License, or (at your option) any later version. | 7 | version 2 of the License, or (at your option) any later version. |
8 | 8 | ||
9 | This library is distributed in the hope that it will be useful, | 9 | This library is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | Library General Public License for more details. | 12 | Library General Public License for more details. |
13 | 13 | ||
14 | You should have received a copy of the GNU Library General Public License | 14 | You should have received a copy of the GNU Library General Public License |
15 | along with this library; see the file COPYING.LIB. If not, write to | 15 | along with this library; see the file COPYING.LIB. If not, write to |
16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
17 | Boston, MA 02111-1307, USA. | 17 | Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #ifndef _LIBOPIE_ODEVICE_H_ | 20 | #ifndef _LIBOPIE_ODEVICE_H_ |
21 | #define _LIBOPIE_ODEVICE_H_ | 21 | #define _LIBOPIE_ODEVICE_H_ |
22 | 22 | ||
23 | #include <qstring.h> | 23 | #include <qstring.h> |
24 | #include <qnamespace.h> | 24 | #include <qnamespace.h> |
25 | 25 | ||
26 | class ODeviceData; | 26 | class ODeviceData; |
27 | 27 | ||
28 | namespace Opie { | 28 | namespace Opie { |
29 | 29 | ||
30 | enum OModel { | 30 | enum OModel { |
31 | Model_Unknown, | 31 | Model_Unknown, |
32 | 32 | ||
33 | Model_Series_Mask = 0xff000000, | 33 | Model_Series_Mask = 0xff000000, |
34 | 34 | ||
35 | Model_iPAQ = ( 1 << 24 ), | 35 | Model_iPAQ = ( 1 << 24 ), |
36 | 36 | ||
37 | Model_iPAQ_All = ( Model_iPAQ | 0xffffff ), | 37 | Model_iPAQ_All = ( Model_iPAQ | 0xffffff ), |
38 | Model_iPAQ_H31xx = ( Model_iPAQ | 0x000001 ), | 38 | Model_iPAQ_H31xx = ( Model_iPAQ | 0x000001 ), |
39 | Model_iPAQ_H36xx = ( Model_iPAQ | 0x000002 ), | 39 | Model_iPAQ_H36xx = ( Model_iPAQ | 0x000002 ), |
40 | Model_iPAQ_H37xx = ( Model_iPAQ | 0x000004 ), | 40 | Model_iPAQ_H37xx = ( Model_iPAQ | 0x000004 ), |
41 | Model_iPAQ_H38xx = ( Model_iPAQ | 0x000008 ), | 41 | Model_iPAQ_H38xx = ( Model_iPAQ | 0x000008 ), |
42 | Model_iPAQ_H39xx = ( Model_iPAQ | 0x000010 ), | 42 | Model_iPAQ_H39xx = ( Model_iPAQ | 0x000010 ), |
43 | 43 | ||
44 | Model_Zaurus = ( 2 << 24 ), | 44 | Model_Zaurus = ( 2 << 24 ), |
45 | 45 | ||
46 | Model_Zaurus_SL5000 = ( Model_Zaurus | 0x000001 ), | 46 | Model_Zaurus_SL5000 = ( Model_Zaurus | 0x000001 ), |
47 | Model_Zaurus_SL5500 = ( Model_Zaurus | 0x000002 ), | ||
47 | }; | 48 | }; |
48 | 49 | ||
49 | enum OVendor { | 50 | enum OVendor { |
50 | Vendor_Unknown, | 51 | Vendor_Unknown, |
51 | 52 | ||
52 | Vendor_HP, | 53 | Vendor_HP, |
53 | Vendor_Sharp | 54 | Vendor_Sharp |
54 | }; | 55 | }; |
55 | 56 | ||
56 | enum OSystem { | 57 | enum OSystem { |
57 | System_Unknown, | 58 | System_Unknown, |
58 | 59 | ||
59 | System_Familiar, | 60 | System_Familiar, |
60 | System_Zaurus, | 61 | System_Zaurus, |
61 | System_OpenZaurus | 62 | System_OpenZaurus |
62 | }; | 63 | }; |
63 | 64 | ||
64 | enum OLedState { | 65 | enum OLedState { |
65 | Led_Off, | 66 | Led_Off, |
66 | Led_On, | 67 | Led_On, |
67 | Led_BlinkSlow, | 68 | Led_BlinkSlow, |
68 | Led_BlinkFast | 69 | Led_BlinkFast |
69 | }; | 70 | }; |
70 | 71 | ||
71 | enum OLed { | 72 | enum OLed { |
72 | Led_Mail, | 73 | Led_Mail, |
73 | Led_Power, | 74 | Led_Power, |
74 | Led_BlueTooth | 75 | Led_BlueTooth |
75 | }; | 76 | }; |
76 | 77 | ||
77 | enum OHardKey { | 78 | enum OHardKey { |
78 | HardKey_Datebook = Qt::Key_F9, | 79 | HardKey_Datebook = Qt::Key_F9, |
79 | HardKey_Contacts = Qt::Key_F10, | 80 | HardKey_Contacts = Qt::Key_F10, |
80 | HardKey_Menu = Qt::Key_F11, | 81 | HardKey_Menu = Qt::Key_F11, |
81 | HardKey_Home = Qt::Key_F12, | 82 | HardKey_Home = Qt::Key_F12, |
82 | HardKey_Mail = Qt::Key_F14, | 83 | HardKey_Mail = Qt::Key_F14, |
83 | HardKey_Record = Qt::Key_F24, | 84 | HardKey_Record = Qt::Key_F24, |
84 | HardKey_Suspend = Qt::Key_F34, | 85 | HardKey_Suspend = Qt::Key_F34, |
85 | HardKey_Backlight = Qt::Key_F35, | 86 | HardKey_Backlight = Qt::Key_F35, |
86 | }; | 87 | }; |
87 | 88 | ||
88 | 89 | ||
89 | class ODevice | 90 | class ODevice |
90 | { | 91 | { |
91 | private: | 92 | private: |
92 | ODevice ( const ODevice & ); | 93 | ODevice ( const ODevice & ); |
93 | 94 | ||
94 | protected: | 95 | protected: |