summaryrefslogtreecommitdiff
authorchicken <chicken>2005-02-18 13:34:11 (UTC)
committer chicken <chicken>2005-02-18 13:34:11 (UTC)
commita0d6cdf75181b918775431f1de222f6906d0f40c (patch) (unidiff)
tree01ef66e2796ad1b775167b1d966851c3afed83e7
parent0f1ae1478122e2f65f8d477d9baad8de15df1eb2 (diff)
downloadopie-a0d6cdf75181b918775431f1de222f6906d0f40c.zip
opie-a0d6cdf75181b918775431f1de222f6906d0f40c.tar.gz
opie-a0d6cdf75181b918775431f1de222f6906d0f40c.tar.bz2
first bits of jornada 720 device code
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice.h1
-rw-r--r--libopie2/opiecore/device/odevice_jornada.cpp28
2 files changed, 22 insertions, 7 deletions
diff --git a/libopie2/opiecore/device/odevice.h b/libopie2/opiecore/device/odevice.h
index 96a41fc..c434216 100644
--- a/libopie2/opiecore/device/odevice.h
+++ b/libopie2/opiecore/device/odevice.h
@@ -10,128 +10,129 @@
10.="- .-=="i,     .._ License as published by the Free Software 10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License, 11 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version. 12     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_. 13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This program is distributed in the hope that 14    .i_,=:_.      -<s. This program is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of 16    : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more 19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details. 20++=   -.     .`     .: details.
21 :     =  ...= . :.=- 21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU 22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with 23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB. 24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29 29
30#ifndef ODEVICE_H_ 30#ifndef ODEVICE_H_
31#define ODEVICE_H_ 31#define ODEVICE_H_
32 32
33/* OPIE */ 33/* OPIE */
34#include <opie2/odevicebutton.h> 34#include <opie2/odevicebutton.h>
35#include <qpe/qpeapplication.h> /* for Transformation enum.. */ 35#include <qpe/qpeapplication.h> /* for Transformation enum.. */
36 36
37/* QT */ 37/* QT */
38#include <qnamespace.h> 38#include <qnamespace.h>
39#include <qobject.h> 39#include <qobject.h>
40#include <qstring.h> 40#include <qstring.h>
41 41
42 42
43#include <qstrlist.h> 43#include <qstrlist.h>
44#include <qwindowsystem_qws.h> 44#include <qwindowsystem_qws.h>
45 45
46 46
47class Sound; 47class Sound;
48 48
49namespace Opie{ 49namespace Opie{
50namespace Core{ 50namespace Core{
51 51
52class ODeviceData; 52class ODeviceData;
53/** 53/**
54 * The available devices 54 * The available devices
55 */ 55 */
56enum OModel { 56enum OModel {
57 Model_Unknown, // = 0 57 Model_Unknown, // = 0
58 58
59 Model_Series_Mask = 0xff000000, 59 Model_Series_Mask = 0xff000000,
60 60
61 Model_iPAQ = ( 1 << 24 ), 61 Model_iPAQ = ( 1 << 24 ),
62 62
63 Model_iPAQ_All = ( Model_iPAQ | 0xffffff ), 63 Model_iPAQ_All = ( Model_iPAQ | 0xffffff ),
64 Model_iPAQ_H31xx = ( Model_iPAQ | 0x000001 ), 64 Model_iPAQ_H31xx = ( Model_iPAQ | 0x000001 ),
65 Model_iPAQ_H36xx = ( Model_iPAQ | 0x000002 ), 65 Model_iPAQ_H36xx = ( Model_iPAQ | 0x000002 ),
66 Model_iPAQ_H37xx = ( Model_iPAQ | 0x000004 ), 66 Model_iPAQ_H37xx = ( Model_iPAQ | 0x000004 ),
67 Model_iPAQ_H38xx = ( Model_iPAQ | 0x000008 ), 67 Model_iPAQ_H38xx = ( Model_iPAQ | 0x000008 ),
68 Model_iPAQ_H39xx = ( Model_iPAQ | 0x000010 ), 68 Model_iPAQ_H39xx = ( Model_iPAQ | 0x000010 ),
69 Model_iPAQ_H5xxx = ( Model_iPAQ | 0x000020 ), 69 Model_iPAQ_H5xxx = ( Model_iPAQ | 0x000020 ),
70 Model_iPAQ_H22xx = ( Model_iPAQ | 0x000040 ), 70 Model_iPAQ_H22xx = ( Model_iPAQ | 0x000040 ),
71 71
72 Model_Jornada = ( 6 << 24 ), 72 Model_Jornada = ( 6 << 24 ),
73 Model_Jornada_56x = ( Model_Jornada | 0x000001 ), 73 Model_Jornada_56x = ( Model_Jornada | 0x000001 ),
74 Model_Jornada_720 = ( Model_Jornada | 0x000002 ),
74 75
75 Model_Zaurus = ( 2 << 24 ), 76 Model_Zaurus = ( 2 << 24 ),
76 77
77 Model_Zaurus_SL5000 = ( Model_Zaurus | 0x000001 ), 78 Model_Zaurus_SL5000 = ( Model_Zaurus | 0x000001 ),
78 Model_Zaurus_SL5500 = ( Model_Zaurus | 0x000002 ), 79 Model_Zaurus_SL5500 = ( Model_Zaurus | 0x000002 ),
79 Model_Zaurus_SLA300 = ( Model_Zaurus | 0x000003 ), 80 Model_Zaurus_SLA300 = ( Model_Zaurus | 0x000003 ),
80 Model_Zaurus_SLB600 = ( Model_Zaurus | 0x000004 ), 81 Model_Zaurus_SLB600 = ( Model_Zaurus | 0x000004 ),
81 Model_Zaurus_SLC7x0 = ( Model_Zaurus | 0x000005 ), 82 Model_Zaurus_SLC7x0 = ( Model_Zaurus | 0x000005 ),
82 Model_Zaurus_SL6000 = ( Model_Zaurus | 0x000006 ), 83 Model_Zaurus_SL6000 = ( Model_Zaurus | 0x000006 ),
83 Model_Zaurus_SLC3000 = ( Model_Zaurus | 0x000007 ), 84 Model_Zaurus_SLC3000 = ( Model_Zaurus | 0x000007 ),
84 85
85 Model_SIMpad = ( 3 << 24 ), 86 Model_SIMpad = ( 3 << 24 ),
86 87
87 Model_SIMpad_All = ( Model_SIMpad | 0xffffff ), 88 Model_SIMpad_All = ( Model_SIMpad | 0xffffff ),
88 Model_SIMpad_CL4 = ( Model_SIMpad | 0x000001 ), 89 Model_SIMpad_CL4 = ( Model_SIMpad | 0x000001 ),
89 Model_SIMpad_SL4 = ( Model_SIMpad | 0x000002 ), 90 Model_SIMpad_SL4 = ( Model_SIMpad | 0x000002 ),
90 Model_SIMpad_SLC = ( Model_SIMpad | 0x000004 ), 91 Model_SIMpad_SLC = ( Model_SIMpad | 0x000004 ),
91 Model_SIMpad_TSinus = ( Model_SIMpad | 0x000008 ), 92 Model_SIMpad_TSinus = ( Model_SIMpad | 0x000008 ),
92 93
93 Model_Ramses = ( 4 << 24 ), 94 Model_Ramses = ( 4 << 24 ),
94 95
95 Model_Ramses_All = ( Model_Ramses | 0xffffff ), 96 Model_Ramses_All = ( Model_Ramses | 0xffffff ),
96 Model_Ramses_MNCI = ( Model_Ramses | 0x000001 ), 97 Model_Ramses_MNCI = ( Model_Ramses | 0x000001 ),
97 Model_Ramses_MNCIRX = ( Model_Ramses | 0x000002 ), 98 Model_Ramses_MNCIRX = ( Model_Ramses | 0x000002 ),
98 99
99 Model_Yopy = ( 5 << 24 ), 100 Model_Yopy = ( 5 << 24 ),
100 101
101 Model_Yopy_All = ( Model_Yopy | 0xffffff ), 102 Model_Yopy_All = ( Model_Yopy | 0xffffff ),
102 Model_Yopy_3000 = ( Model_Yopy | 0x000001 ), 103 Model_Yopy_3000 = ( Model_Yopy | 0x000001 ),
103 Model_Yopy_3500 = ( Model_Yopy | 0x000002 ), 104 Model_Yopy_3500 = ( Model_Yopy | 0x000002 ),
104 Model_Yopy_3700 = ( Model_Yopy | 0x000003 ), 105 Model_Yopy_3700 = ( Model_Yopy | 0x000003 ),
105 106
106 Model_Beagle = ( 6 << 24 ), 107 Model_Beagle = ( 6 << 24 ),
107 108
108 Model_Beagle_All = ( Model_Beagle | 0xffffff ), 109 Model_Beagle_All = ( Model_Beagle | 0xffffff ),
109 Model_Beagle_PA100 = ( Model_Beagle | 0x000001 ), 110 Model_Beagle_PA100 = ( Model_Beagle | 0x000001 ),
110 111
111 Model_GenuineIntel = ( 7 << 24 ) 112 Model_GenuineIntel = ( 7 << 24 )
112 113
113}; 114};
114 115
115/** 116/**
116 * The vendor of the device 117 * The vendor of the device
117 */ 118 */
118enum OVendor { 119enum OVendor {
119 Vendor_Unknown, 120 Vendor_Unknown,
120 121
121 Vendor_HP, 122 Vendor_HP,
122 Vendor_Sharp, 123 Vendor_Sharp,
123 Vendor_SIEMENS, 124 Vendor_SIEMENS,
124 Vendor_MundN, 125 Vendor_MundN,
125 Vendor_GMate, 126 Vendor_GMate,
126 Vendor_MasterIA, 127 Vendor_MasterIA,
127 Vendor_GenuineIntel 128 Vendor_GenuineIntel
128}; 129};
129 130
130/** 131/**
131 * The System used 132 * The System used
132 */ 133 */
133enum OSystem { 134enum OSystem {
134 System_Unknown, 135 System_Unknown,
135 136
136 System_Familiar, 137 System_Familiar,
137 System_Zaurus, 138 System_Zaurus,
diff --git a/libopie2/opiecore/device/odevice_jornada.cpp b/libopie2/opiecore/device/odevice_jornada.cpp
index 7d080ba..c7ed4bc 100644
--- a/libopie2/opiecore/device/odevice_jornada.cpp
+++ b/libopie2/opiecore/device/odevice_jornada.cpp
@@ -47,138 +47,152 @@
47#include <stdlib.h> 47#include <stdlib.h>
48#include <signal.h> 48#include <signal.h>
49#include <sys/ioctl.h> 49#include <sys/ioctl.h>
50#include <sys/time.h> 50#include <sys/time.h>
51#include <unistd.h> 51#include <unistd.h>
52#ifndef QT_NO_SOUND 52#ifndef QT_NO_SOUND
53#include <linux/soundcard.h> 53#include <linux/soundcard.h>
54#endif 54#endif
55 55
56/* KERNEL */ 56/* KERNEL */
57#define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) 57#define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 ))
58 58
59#define OD_IO(type,number) OD_IOC(0,type,number,0) 59#define OD_IO(type,number) OD_IOC(0,type,number,0)
60#define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size)) 60#define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size))
61#define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size)) 61#define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size))
62#define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size)) 62#define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size))
63 63
64typedef struct { 64typedef struct {
65 unsigned char OffOnBlink; /* 0=off 1=on 2=Blink */ 65 unsigned char OffOnBlink; /* 0=off 1=on 2=Blink */
66 unsigned char TotalTime; /* Units of 5 seconds */ 66 unsigned char TotalTime; /* Units of 5 seconds */
67 unsigned char OnTime; /* units of 100m/s */ 67 unsigned char OnTime; /* units of 100m/s */
68 unsigned char OffTime; /* units of 100m/s */ 68 unsigned char OffTime; /* units of 100m/s */
69} LED_IN; 69} LED_IN;
70 70
71typedef struct { 71typedef struct {
72 unsigned char mode; 72 unsigned char mode;
73 unsigned char pwr; 73 unsigned char pwr;
74 unsigned char brightness; 74 unsigned char brightness;
75} FLITE_IN; 75} FLITE_IN;
76 76
77#define LED_ON OD_IOW( 'f', 5, LED_IN ) 77#define LED_ON OD_IOW( 'f', 5, LED_IN )
78#define FLITE_ON OD_IOW( 'f', 7, FLITE_IN ) 78#define FLITE_ON OD_IOW( 'f', 7, FLITE_IN )
79 79
80using namespace Opie::Core; 80using namespace Opie::Core;
81using namespace Opie::Core::Internal; 81using namespace Opie::Core::Internal;
82 82
83struct j_button jornada56x_buttons [] = { 83struct j_button jornada56x_buttons [] = {
84 { Model_Jornada_56x, 84 { Model_Jornada_56x,
85 Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Calendar Button"), 85 Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Calendar Button"),
86 "devicebuttons/jornada56x_calendar", 86 "devicebuttons/jornada56x_calendar",
87 "datebook", "nextView()", 87 "datebook", "nextView()",
88 "today", "raise()" }, 88 "today", "raise()" },
89 { Model_Jornada_56x, 89 { Model_Jornada_56x,
90 Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Contacts Button"), 90 Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Contacts Button"),
91 "devicebuttons/jornada56x_contact", 91 "devicebuttons/jornada56x_contact",
92 "addressbook", "raise()", 92 "addressbook", "raise()",
93 "addressbook", "beamBusinessCard()" }, 93 "addressbook", "beamBusinessCard()" },
94 { Model_Jornada_56x, 94 { Model_Jornada_56x,
95 Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Todo Button"), 95 Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Todo Button"),
96 "devicebuttons/jornada56x_todo", 96 "devicebuttons/jornada56x_todo",
97 "todolist", "raise()", 97 "todolist", "raise()",
98 "todolist", "create()" }, 98 "todolist", "create()" },
99 { Model_Jornada_56x, 99 { Model_Jornada_56x,
100 Qt::Key_F8, QT_TRANSLATE_NOOP("Button", "Home Button"), 100 Qt::Key_F8, QT_TRANSLATE_NOOP("Button", "Home Button"),
101 "devicebuttons/jornada56x_home", 101 "devicebuttons/jornada56x_home",
102 "QPE/Launcher", "home()", 102 "QPE/Launcher", "home()",
103 "buttonsettings", "raise()" }, 103 "buttonsettings", "raise()" },
104 { Model_Jornada_56x, 104 { Model_Jornada_56x,
105 Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Record Button"), 105 Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Record Button"),
106 "devicebuttons/jornada56x_record", 106 "devicebuttons/jornada56x_record",
107 "QPE/VMemo", "toggleRecord()", 107 "QPE/VMemo", "toggleRecord()",
108 "sound", "raise()" }, 108 "sound", "raise()" },
109}; 109};
110 110
111void Jornada::init(const QString&) 111void Jornada::init(const QString& cpu_info)
112{ 112{
113 d->m_vendorstr = "HP"; 113 d->m_vendorstr = "HP";
114 d->m_vendor = Vendor_HP; 114 d->m_vendor = Vendor_HP;
115 d->m_modelstr = "Jornada 56x"; 115
116 d->m_model = Model_Jornada_56x; 116 QString model;
117 d->m_rotation = Rot0; 117 int loc = cpu_info.find( ":" );
118 if ( loc != -1 )
119 model = cpu_info.mid( loc+2 ).simplifyWhiteSpace();
120 else
121 model = cpu_info;
122
123 if ( model == "HP Jornada 56x" ) {
124 d->m_modelstr = "Jornada 56x";
125 d->m_model = Model_Jornada_56x;
126 } else if ( model == "HP Jornada 720" ) {
127 d->m_modelstr = "Jornada 720";
128 d->m_model = Model_Jornada_720;
129 }
130
131 d->m_rotation = Rot0; //all Jornadas need this rotation
118 //Distribution detecting code is now in base class 132 //Distribution detecting code is now in base class
119} 133}
120 134
121void Jornada::initButtons() 135void Jornada::initButtons()
122{ 136{
123 if ( d->m_buttons ) 137 if ( d->m_buttons )
124 return; 138 return;
125 139
126 d->m_buttons = new QValueList <ODeviceButton>; 140 d->m_buttons = new QValueList <ODeviceButton>;
127 141
128 for ( uint i = 0; i < ( sizeof( jornada56x_buttons ) / sizeof( j_button )); i++ ) { 142 for ( uint i = 0; i < ( sizeof( jornada56x_buttons ) / sizeof( j_button )); i++ ) {
129 j_button *ib = jornada56x_buttons + i; 143 j_button *ib = jornada56x_buttons + i;
130 ODeviceButton b; 144 ODeviceButton b;
131 145
132 if (( ib->model & d->m_model ) == d->m_model ) { 146 if (( ib->model & d->m_model ) == d->m_model ) {
133 b. setKeycode ( ib->code ); 147 b. setKeycode ( ib->code );
134 b. setUserText ( QObject::tr ( "Button", ib->utext )); 148 b. setUserText ( QObject::tr ( "Button", ib->utext ));
135 b. setPixmap ( Resource::loadPixmap ( ib->pix )); 149 b. setPixmap ( Resource::loadPixmap ( ib->pix ));
136 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib->fpressedservice ), ib->fpressedaction )); 150 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib->fpressedservice ), ib->fpressedaction ));
137 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib->fheldservice ), ib->fheldaction )); 151 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib->fheldservice ), ib->fheldaction ));
138 152
139 d->m_buttons->append ( b ); 153 d->m_buttons->append ( b );
140 } 154 }
141 } 155 }
142 reloadButtonMapping(); 156 reloadButtonMapping();
143} 157}
144 158
145int Jornada::displayBrightnessResolution() const 159int Jornada::displayBrightnessResolution() const
146{ 160{
147 return 255; 161 return 255;
148} 162}
149 163
150 164
151bool Jornada::setDisplayBrightness( int bright ) 165bool Jornada::setDisplayBrightness( int bright )
152{ 166{
153 bool res = false; 167 bool res = false;
154 168
155 if ( bright > 255 ) 169 if ( bright > 255 )
156 bright = 255; 170 bright = 255;
157 if ( bright < 0 ) 171 if ( bright < 0 )
158 bright = 0; 172 bright = 0;
159 173
160 QString cmdline; 174 QString cmdline;
161 175
162 if ( !bright ) 176 if ( !bright )
163 cmdline = QString::fromLatin1( "echo 4 > /sys/class/backlight/sa1100fb/power"); 177 cmdline = QString::fromLatin1( "echo 4 > /sys/class/backlight/*/power");
164 else 178 else
165 cmdline = QString::fromLatin1( "echo 0 > /sys/class/backlight/sa1100fb/power; echo %1 > /sys/class/backlight/sa1100fb/brightness" ).arg( bright ); 179 cmdline = QString::fromLatin1( "echo 0 > /sys/class/backlight/*/power; echo %1 > /sys/class/backlight/*/brightness" ).arg( bright );
166 180
167 // No Global::shellQuote as we gurantee it to be sane 181 // No Global::shellQuote as we gurantee it to be sane
168 res = ( ::system( QFile::encodeName(cmdline) ) == 0 ); 182 res = ( ::system( QFile::encodeName(cmdline) ) == 0 );
169 183
170 return res; 184 return res;
171} 185}
172 186
173 187
174bool Jornada::setDisplayStatus ( bool on ) 188bool Jornada::setDisplayStatus ( bool on )
175{ 189{
176 bool res = false; 190 bool res = false;
177 191
178 QString cmdline = QString::fromLatin1( "echo %1 > /sys/class/lcd/sa1100fb/power; echo %2 > /sys/class/backlight/sa1100fb/power").arg( on ? "0" : "4" ).arg( on ? "0" : "4" ); 192 QString cmdline = QString::fromLatin1( "echo %1 > /sys/class/lcd/*/power; echo %2 > /sys/class/backlight/*/power").arg( on ? "0" : "4" ).arg( on ? "0" : "4" );
179 193
180 res = ( ::system( QFile::encodeName(cmdline) ) == 0 ); 194 res = ( ::system( QFile::encodeName(cmdline) ) == 0 );
181 195
182 return res; 196 return res;
183} 197}
184 198