summaryrefslogtreecommitdiff
path: root/libopie2/opiecore
Unidiff
Diffstat (limited to 'libopie2/opiecore') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice.cpp2
-rw-r--r--libopie2/opiecore/device/odevice_zaurus.cpp26
2 files changed, 8 insertions, 20 deletions
diff --git a/libopie2/opiecore/device/odevice.cpp b/libopie2/opiecore/device/odevice.cpp
index cf2061b..af77ed1 100644
--- a/libopie2/opiecore/device/odevice.cpp
+++ b/libopie2/opiecore/device/odevice.cpp
@@ -109,26 +109,24 @@ struct default_button default_buttons [] = {
109 "devicebuttons/z_menu", 109 "devicebuttons/z_menu",
110 "QPE/TaskBar", "toggleMenu()", 110 "QPE/TaskBar", "toggleMenu()",
111 "QPE/TaskBar", "toggleStartMenu()" }, 111 "QPE/TaskBar", "toggleStartMenu()" },
112 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), 112 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"),
113 "devicebuttons/z_mail", 113 "devicebuttons/z_mail",
114 "opiemail", "raise()", 114 "opiemail", "raise()",
115 "opiemail", "newMail()" }, 115 "opiemail", "newMail()" },
116}; 116};
117 117
118ODevice *ODevice::inst() 118ODevice *ODevice::inst()
119{ 119{
120 static ODevice *dev = 0; 120 static ODevice *dev = 0;
121
122 // rewrite this to only use /proc/cpuinfo or so
123 QString cpu_info; 121 QString cpu_info;
124 122
125 if ( !dev ) 123 if ( !dev )
126 { 124 {
127 QFile f( PATH_PROC_CPUINFO ); 125 QFile f( PATH_PROC_CPUINFO );
128 if ( f.open( IO_ReadOnly ) ) 126 if ( f.open( IO_ReadOnly ) )
129 { 127 {
130 QTextStream s( &f ); 128 QTextStream s( &f );
131 while ( !s.atEnd() ) 129 while ( !s.atEnd() )
132 { 130 {
133 QString line; 131 QString line;
134 line = s.readLine(); 132 line = s.readLine();
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp
index 3bd7f6e..e9b163a 100644
--- a/libopie2/opiecore/device/odevice_zaurus.cpp
+++ b/libopie2/opiecore/device/odevice_zaurus.cpp
@@ -105,72 +105,62 @@ struct z_button z_buttons_c700 [] = {
105 { Qt::Key_F15, QT_TRANSLATE_NOOP("Button", "Hinge1"), 105 { Qt::Key_F15, QT_TRANSLATE_NOOP("Button", "Hinge1"),
106 "devicebuttons/z_hinge1", 106 "devicebuttons/z_hinge1",
107 "QPE/Rotation", "rotateDefault()",0}, 107 "QPE/Rotation", "rotateDefault()",0},
108 { Qt::Key_F16, QT_TRANSLATE_NOOP("Button", "Hinge2"), 108 { Qt::Key_F16, QT_TRANSLATE_NOOP("Button", "Hinge2"),
109 "devicebuttons/z_hinge2", 109 "devicebuttons/z_hinge2",
110 "QPE/Rotation", "rotateDefault()",0}, 110 "QPE/Rotation", "rotateDefault()",0},
111 { Qt::Key_F17, QT_TRANSLATE_NOOP("Button", "Hinge3"), 111 { Qt::Key_F17, QT_TRANSLATE_NOOP("Button", "Hinge3"),
112 "devicebuttons/z_hinge3", 112 "devicebuttons/z_hinge3",
113 "QPE/Rotation", "rotateDefault()",0}, 113 "QPE/Rotation", "rotateDefault()",0},
114}; 114};
115 115
116// FIXME This gets unnecessary complicated. We should think about splitting the Zaurus 116// FIXME This gets unnecessary complicated. We should think about splitting the Zaurus
117// class up into individual classes. We need three classes 117// class up into individual classes. We would need three classes
118// 118//
119// Zaurus-Collie (SA-model w/ 320x240 lcd, for SL5500 and SL5000) 119// Zaurus-Collie (SA-model w/ 320x240 lcd, for SL5500 and SL5000)
120// Zaurus-Poodle (PXA-model w/ 320x240 lcd, for SL5600) 120// Zaurus-Poodle (PXA-model w/ 320x240 lcd, for SL5600)
121// Zaurus-Corgi (PXA-model w/ 640x480 lcd, for C700, C750, C760, C860, C3000) 121// Zaurus-Corgi (PXA-model w/ 640x480 lcd, for C700, C750, C760, C860, C3000, C1000)
122// Zaurus-Tosa (PXA-model w/ 480x640 lcd, for SL6000) 122// Zaurus-Tosa (PXA-model w/ 480x640 lcd, for SL6000)
123//
124// Only question right now is: Do we really need to do it? Because as soon
125// as the OpenZaurus kernel is ready, there will be a unified interface for all
126// Zaurus models (concerning apm, backlight, buttons, etc.)
127//
128// Comments? - mickeyl.
129 123
130void Zaurus::init(const QString& cpu_info) 124void Zaurus::init(const QString& cpu_info)
131{ 125{
132 // Set the time to wait until the system is realy suspended 126 // Set the time to wait until the system is really suspended
133 // the delta between apm --suspend and sleeping 127 // the delta between apm --suspend and sleeping
134 setAPMTimeOut( 15000 ); 128 setAPMTimeOut( 15000 );
135 129
136 // generic distribution code already scanned /etc/issue at that point - 130 // generic distribution code already scanned /etc/issue at that point -
137 // embedix releases contain "Embedix <version> | Linux for Embedded Devices" 131 // embedix releases contain "Embedix <version> | Linux for Embedded Devices"
138 if ( d->m_sysverstr.contains( "embedix", false ) ) 132 if ( d->m_sysverstr.contains( "embedix", false ) )
139 { 133 {
140 d->m_vendorstr = "Sharp"; 134 d->m_vendorstr = "Sharp";
141 d->m_vendor = Vendor_Sharp; 135 d->m_vendor = Vendor_Sharp;
142 d->m_systemstr = "Zaurus"; 136 d->m_systemstr = "Zaurus";
143 d->m_system = System_Zaurus; 137 d->m_system = System_Zaurus;
144 m_embedix = true; 138 m_embedix = true;
145 } 139 }
146 else 140 else
147 { 141 {
148 d->m_vendorstr = "OpenZaurus Team"; 142 d->m_vendorstr = "OpenZaurus Team";
149 d->m_systemstr = "OpenZaurus"; 143 d->m_systemstr = "OpenZaurus";
150 d->m_system = System_OpenZaurus; 144 d->m_system = System_OpenZaurus;
151 // sysver already gathered 145 // sysver already gathered
152 146
153 // OpenZaurus sometimes uses the embedix kernel, check if this is one 147 // OpenZaurus sometimes uses the 2.4 (embedix) kernel, check if this is one
154 FILE *uname = popen("uname -r", "r"); 148 FILE *uname = popen("uname -r", "r");
155 QFile f; 149 QFile f;
156 QString line; 150 QString line;
157 if ( f.open(IO_ReadOnly, uname) ) { 151 if ( f.open(IO_ReadOnly, uname) ) {
158 QTextStream ts ( &f ); 152 QTextStream ts ( &f );
159 line = ts. readLine(); 153 line = ts.readLine();
160 int loc = line. find ( "embedix" ); 154 m_embedix = line.startsWith( "2.4." );
161 if ( loc != -1 )
162 m_embedix = true;
163 else
164 m_embedix = false;
165 f.close(); 155 f.close();
166 } 156 }
167 pclose(uname); 157 pclose(uname);
168 } 158 }
169 159
170 // check the Zaurus model 160 // check the Zaurus model
171 QString model; 161 QString model;
172 int loc = cpu_info.find( ":" ); 162 int loc = cpu_info.find( ":" );
173 if ( loc != -1 ) 163 if ( loc != -1 )
174 model = cpu_info.mid( loc+2 ).simplifyWhiteSpace(); 164 model = cpu_info.mid( loc+2 ).simplifyWhiteSpace();
175 else 165 else
176 model = cpu_info; 166 model = cpu_info;
@@ -220,27 +210,27 @@ void Zaurus::init(const QString& cpu_info)
220 d->m_direction = direction(); 210 d->m_direction = direction();
221 break; 211 break;
222 case Model_Zaurus_SLB600: // fallthrough 212 case Model_Zaurus_SLB600: // fallthrough
223 case Model_Zaurus_SL5000: // fallthrough 213 case Model_Zaurus_SL5000: // fallthrough
224 case Model_Zaurus_SL5500: // fallthrough 214 case Model_Zaurus_SL5500: // fallthrough
225 default: 215 default:
226 d->m_rotation = Rot270; 216 d->m_rotation = Rot270;
227 break; 217 break;
228 } 218 }
229 m_leds[0] = Led_Off; 219 m_leds[0] = Led_Off;
230 220
231 if ( m_embedix ) 221 if ( m_embedix )
232 qDebug( "Zaurus::init() - Using the Embedix HAL on a %s", (const char*) d->m_modelstr ); 222 qDebug( "Zaurus::init() - Using the 2.4 Embedix HAL on a %s", (const char*) d->m_modelstr );
233 else 223 else
234 qDebug( "Zaurus::init() - Using the OpenZaurus HAL on a %s", (const char*) d->m_modelstr ); 224 qDebug( "Zaurus::init() - Using the 2.6 OpenZaurus HAL on a %s", (const char*) d->m_modelstr );
235} 225}
236 226
237void Zaurus::initButtons() 227void Zaurus::initButtons()
238{ 228{
239 if ( d->m_buttons ) 229 if ( d->m_buttons )
240 return; 230 return;
241 231
242 232
243 d->m_buttons = new QValueList <ODeviceButton>; 233 d->m_buttons = new QValueList <ODeviceButton>;
244 234
245 struct z_button * pz_buttons; 235 struct z_button * pz_buttons;
246 int buttoncount; 236 int buttoncount;