summaryrefslogtreecommitdiff
path: root/libopie2/opiecore/device/odevice_ipaq.cpp
Unidiff
Diffstat (limited to 'libopie2/opiecore/device/odevice_ipaq.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice_ipaq.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/libopie2/opiecore/device/odevice_ipaq.cpp b/libopie2/opiecore/device/odevice_ipaq.cpp
index 791e409..21fed99 100644
--- a/libopie2/opiecore/device/odevice_ipaq.cpp
+++ b/libopie2/opiecore/device/odevice_ipaq.cpp
@@ -76,194 +76,193 @@ typedef struct {
76typedef struct { 76typedef struct {
77 unsigned char mode; 77 unsigned char mode;
78 unsigned char pwr; 78 unsigned char pwr;
79 unsigned char brightness; 79 unsigned char brightness;
80} FLITE_IN; 80} FLITE_IN;
81 81
82#define LED_ON OD_IOW( 'f', 5, LED_IN ) 82#define LED_ON OD_IOW( 'f', 5, LED_IN )
83#define FLITE_ON OD_IOW( 'f', 7, FLITE_IN ) 83#define FLITE_ON OD_IOW( 'f', 7, FLITE_IN )
84 84
85struct i_button ipaq_buttons [] = { 85struct i_button ipaq_buttons [] = {
86 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, 86 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx,
87 Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), 87 Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"),
88 "devicebuttons/ipaq_calendar", 88 "devicebuttons/ipaq_calendar",
89 "datebook", "nextView()", 89 "datebook", "nextView()",
90 "today", "raise()" }, 90 "today", "raise()" },
91 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, 91 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx,
92 Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), 92 Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"),
93 "devicebuttons/ipaq_contact", 93 "devicebuttons/ipaq_contact",
94 "addressbook", "raise()", 94 "addressbook", "raise()",
95 "addressbook", "beamBusinessCard()" }, 95 "addressbook", "beamBusinessCard()" },
96 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx, 96 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx,
97 Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), 97 Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
98 "devicebuttons/ipaq_menu", 98 "devicebuttons/ipaq_menu",
99 "QPE/TaskBar", "toggleMenu()", 99 "QPE/TaskBar", "toggleMenu()",
100 "QPE/TaskBar", "toggleStartMenu()" }, 100 "QPE/TaskBar", "toggleStartMenu()" },
101 { Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, 101 { Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx,
102 Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), 102 Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"),
103 "devicebuttons/ipaq_mail", 103 "devicebuttons/ipaq_mail",
104 "opiemail", "raise()", 104 "opiemail", "raise()",
105 "opiemail", "newMail()" }, 105 "opiemail", "newMail()" },
106 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, 106 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx,
107 Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), 107 Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
108 "devicebuttons/ipaq_home", 108 "devicebuttons/ipaq_home",
109 "QPE/Launcher", "home()", 109 "QPE/Launcher", "home()",
110 "buttonsettings", "raise()" }, 110 "buttonsettings", "raise()" },
111 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, 111 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx,
112 Qt::Key_F24, QT_TRANSLATE_NOOP("Button", "Record Button"), 112 Qt::Key_F24, QT_TRANSLATE_NOOP("Button", "Record Button"),
113 "devicebuttons/ipaq_record", 113 "devicebuttons/ipaq_record",
114 "QPE/VMemo", "toggleRecord()", 114 "QPE/VMemo", "toggleRecord()",
115 "sound", "raise()" }, 115 "sound", "raise()" },
116}; 116};
117 117
118void iPAQ::init(const QString& model) 118void iPAQ::init(const QString& model)
119{ 119{
120 d->m_vendorstr = "HP"; 120 d->m_vendorstr = "HP";
121 d->m_vendor = Vendor_HP; 121 d->m_vendor = Vendor_HP;
122 122
123 d->m_modelstr = model.mid(model.findRev('H')); 123 d->m_modelstr = model.mid(model.findRev('H'));
124 124
125 if ( d->m_modelstr == "H3100" ) 125 if ( d->m_modelstr == "H3100" )
126 d->m_model = Model_iPAQ_H31xx; 126 d->m_model = Model_iPAQ_H31xx;
127 else if ( d->m_modelstr == "H3600" ) 127 else if ( d->m_modelstr == "H3600" )
128 d->m_model = Model_iPAQ_H36xx; 128 d->m_model = Model_iPAQ_H36xx;
129 else if ( d->m_modelstr == "H3700" ) 129 else if ( d->m_modelstr == "H3700" )
130 d->m_model = Model_iPAQ_H37xx; 130 d->m_model = Model_iPAQ_H37xx;
131 else if ( d->m_modelstr == "H3800" ) 131 else if ( d->m_modelstr == "H3800" )
132 d->m_model = Model_iPAQ_H38xx; 132 d->m_model = Model_iPAQ_H38xx;
133 else if ( d->m_modelstr == "H3900" ) 133 else if ( d->m_modelstr == "H3900" )
134 d->m_model = Model_iPAQ_H39xx; 134 d->m_model = Model_iPAQ_H39xx;
135 else if ( d->m_modelstr == "H5400" ) 135 else if ( d->m_modelstr == "H5400" )
136 d->m_model = Model_iPAQ_H5xxx; 136 d->m_model = Model_iPAQ_H5xxx;
137 else if ( d->m_modelstr == "H2200" ) 137 else if ( d->m_modelstr == "H2200" )
138 d->m_model = Model_iPAQ_H22xx; 138 d->m_model = Model_iPAQ_H22xx;
139 else 139 else
140 d->m_model = Model_Unknown; 140 d->m_model = Model_Unknown;
141 141
142 switch ( d->m_model ) { 142 switch ( d->m_model ) {
143 case Model_iPAQ_H31xx: 143 case Model_iPAQ_H31xx:
144 case Model_iPAQ_H38xx: 144 case Model_iPAQ_H38xx:
145 d->m_rotation = Rot90; 145 d->m_rotation = Rot90;
146 break; 146 break;
147 case Model_iPAQ_H5xxx: 147 case Model_iPAQ_H5xxx:
148 case Model_iPAQ_H22xx: 148 case Model_iPAQ_H22xx:
149 d->m_rotation = Rot0; 149 d->m_rotation = Rot0;
150 break; 150 break;
151 case Model_iPAQ_H36xx: 151 case Model_iPAQ_H36xx:
152 case Model_iPAQ_H37xx: 152 case Model_iPAQ_H37xx:
153 case Model_iPAQ_H39xx: 153 case Model_iPAQ_H39xx:
154 default: 154 default:
155 d->m_rotation = Rot270; 155 d->m_rotation = Rot270;
156 break; 156 break;
157 157
158 } 158 }
159 159
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
166void iPAQ::initButtons() 166void 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 Opie::Core::OKeyFilter::inst()->addPreHandler(this); 172 addPreHandler(this);
173 //QWSServer::setKeyboardFilter ( this );
174 } 173 }
175 174
176 d->m_buttons = new QValueList <ODeviceButton>; 175 d->m_buttons = new QValueList <ODeviceButton>;
177 176
178 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++ ) {
179 i_button *ib = ipaq_buttons + i; 178 i_button *ib = ipaq_buttons + i;
180 ODeviceButton b; 179 ODeviceButton b;
181 180
182 if (( ib->model & d->m_model ) == d->m_model ) { 181 if (( ib->model & d->m_model ) == d->m_model ) {
183 b. setKeycode ( ib->code ); 182 b. setKeycode ( ib->code );
184 b. setUserText ( QObject::tr ( "Button", ib->utext )); 183 b. setUserText ( QObject::tr ( "Button", ib->utext ));
185 b. setPixmap ( Resource::loadPixmap ( ib->pix )); 184 b. setPixmap ( Resource::loadPixmap ( ib->pix ));
186 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib->fpressedservice ), ib->fpressedaction )); 185 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib->fpressedservice ), ib->fpressedaction ));
187 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib->fheldservice ), ib->fheldaction )); 186 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib->fheldservice ), ib->fheldaction ));
188 187
189 d->m_buttons->append ( b ); 188 d->m_buttons->append ( b );
190 } 189 }
191 } 190 }
192 reloadButtonMapping(); 191 reloadButtonMapping();
193 192
194 QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); 193 QCopChannel *sysch = new QCopChannel ( "QPE/System", this );
195 connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( systemMessage(const QCString&,const QByteArray&))); 194 connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( systemMessage(const QCString&,const QByteArray&)));
196} 195}
197 196
198QValueList <OLed> iPAQ::ledList() const 197QValueList <OLed> iPAQ::ledList() const
199{ 198{
200 QValueList <OLed> vl; 199 QValueList <OLed> vl;
201 vl << Led_Power; 200 vl << Led_Power;
202 201
203 if ( d->m_model == Model_iPAQ_H38xx ) 202 if ( d->m_model == Model_iPAQ_H38xx )
204 vl << Led_BlueTooth; 203 vl << Led_BlueTooth;
205 return vl; 204 return vl;
206} 205}
207 206
208QValueList <OLedState> iPAQ::ledStateList ( OLed l ) const 207QValueList <OLedState> iPAQ::ledStateList ( OLed l ) const
209{ 208{
210 QValueList <OLedState> vl; 209 QValueList <OLedState> vl;
211 210
212 if ( l == Led_Power ) 211 if ( l == Led_Power )
213 vl << Led_Off << Led_On << Led_BlinkSlow << Led_BlinkFast; 212 vl << Led_Off << Led_On << Led_BlinkSlow << Led_BlinkFast;
214 else if ( l == Led_BlueTooth && d->m_model == Model_iPAQ_H38xx ) 213 else if ( l == Led_BlueTooth && d->m_model == Model_iPAQ_H38xx )
215 vl << Led_Off; // << Led_On << ??? 214 vl << Led_Off; // << Led_On << ???
216 215
217 return vl; 216 return vl;
218} 217}
219 218
220OLedState iPAQ::ledState ( OLed l ) const 219OLedState iPAQ::ledState ( OLed l ) const
221{ 220{
222 switch ( l ) { 221 switch ( l ) {
223 case Led_Power: 222 case Led_Power:
224 return m_leds [0]; 223 return m_leds [0];
225 case Led_BlueTooth: 224 case Led_BlueTooth:
226 return m_leds [1]; 225 return m_leds [1];
227 default: 226 default:
228 return Led_Off; 227 return Led_Off;
229 } 228 }
230} 229}
231 230
232bool iPAQ::setLedState ( OLed l, OLedState st ) 231bool iPAQ::setLedState ( OLed l, OLedState st )
233{ 232{
234 static int fd = ::open ( "/dev/touchscreen/0", O_RDWR | O_NONBLOCK ); 233 static int fd = ::open ( "/dev/touchscreen/0", O_RDWR | O_NONBLOCK );
235 234
236 if ( l == Led_Power ) { 235 if ( l == Led_Power ) {
237 if ( fd >= 0 ) { 236 if ( fd >= 0 ) {
238 LED_IN leds; 237 LED_IN leds;
239 ::memset ( &leds, 0, sizeof( leds )); 238 ::memset ( &leds, 0, sizeof( leds ));
240 leds. TotalTime = 0; 239 leds. TotalTime = 0;
241 leds. OnTime = 0; 240 leds. OnTime = 0;
242 leds. OffTime = 1; 241 leds. OffTime = 1;
243 leds. OffOnBlink = 2; 242 leds. OffOnBlink = 2;
244 243
245 switch ( st ) { 244 switch ( st ) {
246 case Led_Off : leds. OffOnBlink = 0; break; 245 case Led_Off : leds. OffOnBlink = 0; break;
247 case Led_On : leds. OffOnBlink = 1; break; 246 case Led_On : leds. OffOnBlink = 1; break;
248 case Led_BlinkSlow: leds. OnTime = 10; leds. OffTime = 10; break; 247 case Led_BlinkSlow: leds. OnTime = 10; leds. OffTime = 10; break;
249 case Led_BlinkFast: leds. OnTime = 5; leds. OffTime = 5; break; 248 case Led_BlinkFast: leds. OnTime = 5; leds. OffTime = 5; break;
250 } 249 }
251 250
252 if ( ::ioctl ( fd, LED_ON, &leds ) >= 0 ) { 251 if ( ::ioctl ( fd, LED_ON, &leds ) >= 0 ) {
253 m_leds [0] = st; 252 m_leds [0] = st;
254 return true; 253 return true;
255 } 254 }
256 } 255 }
257 } 256 }
258 return false; 257 return false;
259} 258}
260 259
261 260
262bool iPAQ::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) 261bool iPAQ::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat )
263{ 262{
264 int newkeycode = keycode; 263 int newkeycode = keycode;
265 264
266 switch ( keycode ) { 265 switch ( keycode ) {
267 // H38xx/H39xx have no "Q" key anymore - this is now the Mail key 266 // H38xx/H39xx have no "Q" key anymore - this is now the Mail key
268 case HardKey_Menu: { 267 case HardKey_Menu: {
269 if (( d->m_model == Model_iPAQ_H38xx ) || 268 if (( d->m_model == Model_iPAQ_H38xx ) ||