summaryrefslogtreecommitdiff
path: root/libopie2/opiecore/device/odevice_simpad.cpp
Unidiff
Diffstat (limited to 'libopie2/opiecore/device/odevice_simpad.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice_simpad.cpp48
1 files changed, 25 insertions, 23 deletions
diff --git a/libopie2/opiecore/device/odevice_simpad.cpp b/libopie2/opiecore/device/odevice_simpad.cpp
index 550da5e..f2805de 100644
--- a/libopie2/opiecore/device/odevice_simpad.cpp
+++ b/libopie2/opiecore/device/odevice_simpad.cpp
@@ -1,56 +1,58 @@
1/* 1/*
2                 This file is part of the Opie Project 2                 This file is part of the Opie Project
3              Copyright (C) The Opie Team <opie-devel@handhelds.org> 3
4 Copyright (C)2002-2005 The Opie Team <opie-devel@handhelds.org>
4 =. 5 =.
5 .=l. 6 .=l.
6           .>+-= 7           .>+-=
7 _;:,     .>    :=|. This program is free software; you can 8 _;:,     .>    :=|. This program is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under 9.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
10.="- .-=="i,     .._ License as published by the Free Software 11.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License, 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version. 13     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_. 14    .%`+i>       _;_.
14    .i_,=:_.      -<s. This program is distributed in the hope that 15    .i_,=:_.      -<s. This program is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of 17 : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more 20..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details. 21++=   -.     .`     .: details.
21 :     =  ...= . :.=- 22:     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU 23 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with 24  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB. 25    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 26 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 27 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
28*/ 29*/
29 30
30#include "odevice_simpad.h" 31#include "odevice_simpad.h"
31 32
32/* QT */ 33/* QT */
33#include <qapplication.h> 34#include <qapplication.h>
34#include <qfile.h> 35#include <qfile.h>
35#include <qtextstream.h> 36#include <qtextstream.h>
36#include <qwindowsystem_qws.h> 37#include <qwindowsystem_qws.h>
37#include <qwidgetlist.h> 38#include <qwidgetlist.h>
38 39
39/* OPIE */ 40/* OPIE */
40#include <qpe/config.h> 41#include <qpe/config.h>
41#include <qpe/resource.h>
42#include <qpe/sound.h> 42#include <qpe/sound.h>
43#include <qpe/qcopenvelope_qws.h> 43#include <qpe/qcopenvelope_qws.h>
44
44#include <opie2/okeyfilter.h> 45#include <opie2/okeyfilter.h>
46#include <opie2/oresource.h>
45 47
46/* STD */ 48/* STD */
47#include <fcntl.h> 49#include <fcntl.h>
48#include <math.h> 50#include <math.h>
49#include <stdlib.h> 51#include <stdlib.h>
50#include <signal.h> 52#include <signal.h>
51#include <sys/ioctl.h> 53#include <sys/ioctl.h>
52#include <sys/time.h> 54#include <sys/time.h>
53#include <unistd.h> 55#include <unistd.h>
54#ifndef QT_NO_SOUND 56#ifndef QT_NO_SOUND
55#include <linux/soundcard.h> 57#include <linux/soundcard.h>
56#endif 58#endif
@@ -162,25 +164,25 @@ void SIMpad::initButtons()
162 return; 164 return;
163 165
164 d->m_buttons = new QValueList <ODeviceButton>; 166 d->m_buttons = new QValueList <ODeviceButton>;
165 167
166 uint size = sizeof(simpad_buttons)/sizeof(s_button); 168 uint size = sizeof(simpad_buttons)/sizeof(s_button);
167 for ( uint i = 0; i < size; i++ ) { 169 for ( uint i = 0; i < size; i++ ) {
168 s_button *sb = simpad_buttons + i; 170 s_button *sb = simpad_buttons + i;
169 ODeviceButton b; 171 ODeviceButton b;
170 172
171 if (( sb->model & d->m_model ) == d->m_model ) { 173 if (( sb->model & d->m_model ) == d->m_model ) {
172 b. setKeycode ( sb->code ); 174 b. setKeycode ( sb->code );
173 b. setUserText ( QObject::tr ( "Button", sb->utext )); 175 b. setUserText ( QObject::tr ( "Button", sb->utext ));
174 b. setPixmap ( Resource::loadPixmap ( sb->pix )); 176 b. setPixmap ( OResource::loadPixmap ( sb->pix ));
175 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( sb->fpressedservice ), sb->fpressedaction )); 177 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( sb->fpressedservice ), sb->fpressedaction ));
176 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( sb->fheldservice ), sb->fheldaction )); 178 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( sb->fheldservice ), sb->fheldaction ));
177 179
178 d->m_buttons->append ( b ); 180 d->m_buttons->append ( b );
179 } 181 }
180 } 182 }
181 reloadButtonMapping(); 183 reloadButtonMapping();
182} 184}
183 185
184// SIMpad boardcontrol register CS3 186// SIMpad boardcontrol register CS3
185#define SIMPAD_BOARDCONTROL "/proc/cs3" 187#define SIMPAD_BOARDCONTROL "/proc/cs3"
186#define SIMPAD_VCC_5V_EN 0x0001 // For 5V PCMCIA 188#define SIMPAD_VCC_5V_EN 0x0001 // For 5V PCMCIA