author | llornkcor <llornkcor> | 2006-04-23 20:19:27 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2006-04-23 20:19:27 (UTC) |
commit | 226ccbb7d87a54411d640432f0ac19cbd942aa01 (patch) (unidiff) | |
tree | 6d343d37cc3e9c2c4b9a8148a8f7cb32d110c322 /libopie2 | |
parent | fce7a143353e2bdd41d878c6f0a1224e0f2a158e (diff) | |
download | opie-226ccbb7d87a54411d640432f0ac19cbd942aa01.zip opie-226ccbb7d87a54411d640432f0ac19cbd942aa01.tar.gz opie-226ccbb7d87a54411d640432f0ac19cbd942aa01.tar.bz2 |
add support for HTC Universal device
-rw-r--r-- | libopie2/opiecore/device/device.pro | 6 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice.cpp | 3 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice.h | 9 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_htc.h | 154 |
4 files changed, 168 insertions, 4 deletions
diff --git a/libopie2/opiecore/device/device.pro b/libopie2/opiecore/device/device.pro index 8469398..0954733 100644 --- a/libopie2/opiecore/device/device.pro +++ b/libopie2/opiecore/device/device.pro | |||
@@ -9,7 +9,8 @@ HEADERS += device/odevice.h \ | |||
9 | device/odevice_zaurus.h \ | 9 | device/odevice_zaurus.h \ |
10 | device/odevice_genuineintel.h \ | 10 | device/odevice_genuineintel.h \ |
11 | device/odevice_yopy.h \ | 11 | device/odevice_yopy.h \ |
12 | device/odevice_mypal.h | 12 | device/odevice_mypal.h \ |
13 | device/odevice_htc.h | ||
13 | 14 | ||
14 | SOURCES += device/odevice.cpp \ | 15 | SOURCES += device/odevice.cpp \ |
15 | device/odevicebutton.cpp \ | 16 | device/odevicebutton.cpp \ |
@@ -22,5 +23,6 @@ SOURCES += device/odevice.cpp \ | |||
22 | device/odevice_zaurus.cpp \ | 23 | device/odevice_zaurus.cpp \ |
23 | device/odevice_genuineintel.cpp \ | 24 | device/odevice_genuineintel.cpp \ |
24 | device/odevice_yopy.cpp \ | 25 | device/odevice_yopy.cpp \ |
25 | device/odevice_mypal.cpp | 26 | device/odevice_mypal.cpp \ |
27 | device/odevice_htc.cpp | ||
26 | 28 | ||
diff --git a/libopie2/opiecore/device/odevice.cpp b/libopie2/opiecore/device/odevice.cpp index 7b99eb4..c6e031f 100644 --- a/libopie2/opiecore/device/odevice.cpp +++ b/libopie2/opiecore/device/odevice.cpp | |||
@@ -37,6 +37,7 @@ | |||
37 | #include "odevice_yopy.h" | 37 | #include "odevice_yopy.h" |
38 | #include "odevice_zaurus.h" | 38 | #include "odevice_zaurus.h" |
39 | #include "odevice_genuineintel.h" | 39 | #include "odevice_genuineintel.h" |
40 | #include "odevice_htc.h" | ||
40 | 41 | ||
41 | /* QT */ | 42 | /* QT */ |
42 | #include <qapplication.h> | 43 | #include <qapplication.h> |
@@ -144,6 +145,8 @@ ODevice *ODevice::inst() | |||
144 | else if ( line.contains( "jornada", false ) ) dev = new Internal::Jornada(); | 145 | else if ( line.contains( "jornada", false ) ) dev = new Internal::Jornada(); |
145 | else if ( line.contains( "ramses", false ) ) dev = new Internal::Ramses(); | 146 | else if ( line.contains( "ramses", false ) ) dev = new Internal::Ramses(); |
146 | else if ( line.contains( "Tradesquare.NL", false ) ) dev = new Internal::Beagle(); | 147 | else if ( line.contains( "Tradesquare.NL", false ) ) dev = new Internal::Beagle(); |
148 | else if ( line.contains( "HTC", false ) ) dev = new Internal::HTC(); | ||
149 | |||
147 | else qWarning( "ODevice() - unknown hardware - using default." ); | 150 | else qWarning( "ODevice() - unknown hardware - using default." ); |
148 | break; | 151 | break; |
149 | } else if ( line.startsWith( "vendor_id" ) ) { | 152 | } else if ( line.startsWith( "vendor_id" ) ) { |
diff --git a/libopie2/opiecore/device/odevice.h b/libopie2/opiecore/device/odevice.h index c70d2af..0c78277 100644 --- a/libopie2/opiecore/device/odevice.h +++ b/libopie2/opiecore/device/odevice.h | |||
@@ -120,7 +120,11 @@ enum OModel { | |||
120 | Model_MyPal_All = ( Model_MyPal | 0xffff ), | 120 | Model_MyPal_All = ( Model_MyPal | 0xffff ), |
121 | Model_MyPal_620 = ( Model_MyPal | 0x0001 ), | 121 | Model_MyPal_620 = ( Model_MyPal | 0x0001 ), |
122 | Model_MyPal_716 = ( Model_MyPal | 0x0002 ), | 122 | Model_MyPal_716 = ( Model_MyPal | 0x0002 ), |
123 | Model_MyPal_730 = ( Model_MyPal | 0x0003 ) | 123 | Model_MyPal_730 = ( Model_MyPal | 0x0003 ), |
124 | |||
125 | Model_HTC = ( 9 << 16 ), | ||
126 | Model_HTC_All = ( Model_HTC | 0xffff ), | ||
127 | Model_HTC_Universal = ( Model_HTC | 0x0001 ) | ||
124 | }; | 128 | }; |
125 | 129 | ||
126 | /** | 130 | /** |
@@ -136,7 +140,8 @@ enum OVendor { | |||
136 | Vendor_GMate, | 140 | Vendor_GMate, |
137 | Vendor_MasterIA, | 141 | Vendor_MasterIA, |
138 | Vendor_GenuineIntel, | 142 | Vendor_GenuineIntel, |
139 | Vendor_Asus | 143 | Vendor_Asus, |
144 | Vendor_HTC | ||
140 | }; | 145 | }; |
141 | 146 | ||
142 | /** | 147 | /** |
diff --git a/libopie2/opiecore/device/odevice_htc.h b/libopie2/opiecore/device/odevice_htc.h new file mode 100644 index 0000000..5b707c8 --- a/dev/null +++ b/libopie2/opiecore/device/odevice_htc.h | |||
@@ -0,0 +1,154 @@ | |||
1 | /* | ||
2 | This file is part of the Opie Project | ||
3 | Copyright (C) 2002-2005 The Opie Team <opie-devel@handhelds.org> | ||
4 | =. Copyright (C) 2002-2005 Michael 'Mickey' Lauer <mickey@Vanille.de> | ||
5 | .=l. | ||
6 | .>+-= | ||
7 | _;:, .> :=|. This program is free software; you can | ||
8 | .> <`_, > . <= redistribute it and/or modify it under | ||
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
10 | .="- .-=="i, .._ License as published by the Free Software | ||
11 | - . .-<_> .<> Foundation; version 2 of the License. | ||
12 | ._= =} : | ||
13 | .%`+i> _;_. | ||
14 | .i_,=:_. -<s. This program is distributed in the hope that | ||
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
16 | : .. .:, . . . without even the implied warranty of | ||
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
19 | ..}^=.= = ; Library General Public License for more | ||
20 | ++= -. .` .: details. | ||
21 | : = ...= . :.=- | ||
22 | -. .:....=;==+<; You should have received a copy of the GNU | ||
23 | -_. . . )=. = Library General Public License along with | ||
24 | -- :-=` this library; see the file COPYING.LIB. | ||
25 | If not, write to the Free Software Foundation, | ||
26 | Inc., 59 Temple Place - Suite 330, | ||
27 | Boston, MA 02111-1307, USA. | ||
28 | */ | ||
29 | |||
30 | #ifndef ODEVICE_HTC | ||
31 | #define ODEVICE_HTC | ||
32 | |||
33 | #include "odevice_abstractmobiledevice.h" | ||
34 | |||
35 | /* QT */ | ||
36 | #include <qfile.h> | ||
37 | #include <qwindowsystem_qws.h> | ||
38 | |||
39 | #ifndef ARRAY_SIZE | ||
40 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) | ||
41 | #endif | ||
42 | |||
43 | // _IO and friends are only defined in kernel headers ... | ||
44 | #define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) | ||
45 | #define OD_IO(type,number) OD_IOC(0,type,number,0) | ||
46 | #define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size)) | ||
47 | #define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size)) | ||
48 | #define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size)) | ||
49 | |||
50 | // Audio | ||
51 | #define SHARP_DEV_IOCTL_COMMAND_START 0x5680 | ||
52 | |||
53 | #define SHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) | ||
54 | #define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) | ||
55 | |||
56 | #define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ | ||
57 | #define SHARP_BUZ_KEYSOUND 2 /* key sound */ | ||
58 | #define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ | ||
59 | |||
60 | #define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1) | ||
61 | #define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2) | ||
62 | #define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3) | ||
63 | #define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4) | ||
64 | #define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5) | ||
65 | |||
66 | // LED | ||
67 | #define SHARP_LED_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) | ||
68 | #define SHARP_LED_SETSTATUS (SHARP_LED_IOCTL_START+1) | ||
69 | #define SHARP_LED_MAIL_EXISTS 9 /* mail status (exists or not) */ | ||
70 | |||
71 | #define LED_MAIL_NO_UNREAD_MAIL 0 /* for SHARP_LED_MAIL_EXISTS */ | ||
72 | #define LED_MAIL_NEWMAIL_EXISTS 1 /* for SHARP_LED_MAIL_EXISTS */ | ||
73 | #define LED_MAIL_UNREAD_MAIL_EX 2 /* for SHARP_LED_MAIL_EXISTS */ | ||
74 | |||
75 | // Rotation and Power Management | ||
76 | #define SHARP_IOCTL_GET_ROTATION 0x413c | ||
77 | |||
78 | #define APM_IOCGEVTSRC OD_IOR( 'A', 203, int ) | ||
79 | #define APM_IOCSEVTSRC OD_IORW( 'A', 204, int ) | ||
80 | #define APM_EVT_POWER_BUTTON (1 << 0) | ||
81 | |||
82 | // Brightness Embedix | ||
83 | #define SHARP_FL_IOCTL_DEVICE "/dev/sharp_fl" | ||
84 | #define SHARP_FL_IOCTL_ON 1 | ||
85 | #define SHARP_FL_IOCTL_OFF 2 | ||
86 | #define SHARP_FL_IOCTL_STEP_CONTRAST 100 | ||
87 | #define SHARP_FL_IOCTL_GET_STEP_CONTRAST 101 | ||
88 | #define SHARP_FL_IOCTL_GET_STEP 102 | ||
89 | |||
90 | // Vesa Standard | ||
91 | #define FB_BLANK_UNBLANK 0 | ||
92 | #define FB_BLANK_POWERDOWN 4 | ||
93 | |||
94 | namespace Opie { | ||
95 | namespace Core { | ||
96 | namespace Internal { | ||
97 | |||
98 | class HTC : public OAbstractMobileDevice, public QWSServer::KeyboardFilter | ||
99 | { | ||
100 | Q_OBJECT | ||
101 | |||
102 | protected: | ||
103 | virtual void init(const QString&); | ||
104 | virtual void initButtons(); | ||
105 | void initHingeSensor(); | ||
106 | |||
107 | protected slots: | ||
108 | void hingeSensorTriggered(); | ||
109 | void systemMessage( const QCString &msg, const QByteArray & ); | ||
110 | |||
111 | public: | ||
112 | virtual bool setDisplayBrightness( int b ); | ||
113 | virtual bool setDisplayStatus( bool on ); | ||
114 | virtual int displayBrightnessResolution() const; | ||
115 | |||
116 | virtual void playAlarmSound(); | ||
117 | virtual void playKeySound(); | ||
118 | virtual void playTouchSound(); | ||
119 | |||
120 | virtual QValueList <OLed> ledList() const; | ||
121 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; | ||
122 | virtual OLedState ledState( OLed led ) const; | ||
123 | virtual bool setLedState( OLed led, OLedState st ); | ||
124 | |||
125 | virtual bool hasHingeSensor() const; | ||
126 | virtual OHingeStatus readHingeSensor() const; | ||
127 | |||
128 | virtual Transformation rotation() const; | ||
129 | virtual ODirection direction() const; | ||
130 | virtual bool suspend(); | ||
131 | |||
132 | protected: | ||
133 | virtual void buzzer( int snd ); | ||
134 | virtual bool filter( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); | ||
135 | |||
136 | QString m_backlightdev; | ||
137 | OLedState m_leds[1]; | ||
138 | bool m_embedix; | ||
139 | QFile m_hinge; | ||
140 | }; | ||
141 | |||
142 | struct htc_button { | ||
143 | Qt::Key code; | ||
144 | char *utext; | ||
145 | char *pix; | ||
146 | char *fpressedservice; | ||
147 | char *fpressedaction; | ||
148 | char *fheldservice; | ||
149 | char *fheldaction; | ||
150 | }; | ||
151 | } | ||
152 | } | ||
153 | } | ||
154 | #endif | ||