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,68 +1,70 @@
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
57 59
58namespace Opie { 60namespace Opie {
59namespace Core { 61namespace Core {
60namespace Internal { 62namespace Internal {
61namespace { 63namespace {
62struct s_button { 64struct s_button {
63 uint model; 65 uint model;
64 Qt::Key code; 66 Qt::Key code;
65 char *utext; 67 char *utext;
66 char *pix; 68 char *pix;
67 char *fpressedservice; 69 char *fpressedservice;
68 char *fpressedaction; 70 char *fpressedaction;
@@ -150,49 +152,49 @@ void SIMpad::init(const QString&)
150 } 152 }
151 153
152 //Distribution detecting code is now in base class 154 //Distribution detecting code is now in base class
153 m_leds [0] = m_leds [1] = Led_Off; 155 m_leds [0] = m_leds [1] = Led_Off;
154 156
155 m_power_timer = 0; 157 m_power_timer = 0;
156 158
157} 159}
158 160
159void SIMpad::initButtons() 161void SIMpad::initButtons()
160{ 162{
161 if ( d->m_buttons ) 163 if ( d->m_buttons )
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
187#define SIMPAD_VCC_3V_EN 0x0002 // FOR 3.3V PCMCIA 189#define SIMPAD_VCC_3V_EN 0x0002 // FOR 3.3V PCMCIA
188#define SIMPAD_EN1 0x0004 // This is only for EPROM's 190#define SIMPAD_EN1 0x0004 // This is only for EPROM's
189#define SIMPAD_EN0 0x0008 // Both should be enable for 3.3V or 5V 191#define SIMPAD_EN0 0x0008 // Both should be enable for 3.3V or 5V
190#define SIMPAD_DISPLAY_ON 0x0010 192#define SIMPAD_DISPLAY_ON 0x0010
191#define SIMPAD_PCMCIA_BUFF_DIS 0x0020 193#define SIMPAD_PCMCIA_BUFF_DIS 0x0020
192#define SIMPAD_MQ_RESET 0x0040 194#define SIMPAD_MQ_RESET 0x0040
193#define SIMPAD_PCMCIA_RESET 0x0080 195#define SIMPAD_PCMCIA_RESET 0x0080
194#define SIMPAD_DECT_POWER_ON 0x0100 196#define SIMPAD_DECT_POWER_ON 0x0100
195#define SIMPAD_IRDA_SD 0x0200 // Shutdown for powersave 197#define SIMPAD_IRDA_SD 0x0200 // Shutdown for powersave
196#define SIMPAD_RS232_ON 0x0400 198#define SIMPAD_RS232_ON 0x0400
197#define SIMPAD_SD_MEDIAQ 0x0800 // Shutdown for powersave 199#define SIMPAD_SD_MEDIAQ 0x0800 // Shutdown for powersave
198#define SIMPAD_LED2_ON 0x1000 200#define SIMPAD_LED2_ON 0x1000