summaryrefslogtreecommitdiff
path: root/libopie2/opiecore/device/odevice_jornada.cpp
authormickeyl <mickeyl>2004-06-12 16:54:50 (UTC)
committer mickeyl <mickeyl>2004-06-12 16:54:50 (UTC)
commitb1235df3628d178891eeefed630a22da46b25952 (patch) (unidiff)
treec88a3cb04adcc9fe214ff08e3c0b96b21e3c4f0a /libopie2/opiecore/device/odevice_jornada.cpp
parent7a62e8e3601ee98f5f06261c361fe8132334cd56 (diff)
downloadopie-b1235df3628d178891eeefed630a22da46b25952.zip
opie-b1235df3628d178891eeefed630a22da46b25952.tar.gz
opie-b1235df3628d178891eeefed630a22da46b25952.tar.bz2
- refactor the distribution detection code
- add detection of OpenEmbedded and generic linux distributions - simplify the zaurus model detection code
Diffstat (limited to 'libopie2/opiecore/device/odevice_jornada.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice_jornada.cpp19
1 files changed, 4 insertions, 15 deletions
diff --git a/libopie2/opiecore/device/odevice_jornada.cpp b/libopie2/opiecore/device/odevice_jornada.cpp
index 1f69326..5d32901 100644
--- a/libopie2/opiecore/device/odevice_jornada.cpp
+++ b/libopie2/opiecore/device/odevice_jornada.cpp
@@ -105,37 +105,26 @@ struct j_button jornada56x_buttons [] = {
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&)
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 d->m_modelstr = "Jornada 56x";
116 d->m_model = Model_Jornada_56x; 116 d->m_model = Model_Jornada_56x;
117 d->m_systemstr = "Familiar";
118 d->m_system = System_Familiar;
119 d->m_rotation = Rot0; 117 d->m_rotation = Rot0;
120 118 //Distribution detecting code is now in base class
121 QFile f ( "/etc/familiar-version" );
122 f.setName ( "/etc/familiar-version" );
123 if ( f.open ( IO_ReadOnly )) {
124
125 QTextStream ts ( &f );
126 d->m_sysverstr = ts.readLine().mid( 10 );
127
128 f. close();
129 }
130} 119}
131 120
132void Jornada::initButtons() 121void Jornada::initButtons()
133{ 122{
134 if ( d->m_buttons ) 123 if ( d->m_buttons )
135 return; 124 return;
136 125
137 d->m_buttons = new QValueList <ODeviceButton>; 126 d->m_buttons = new QValueList <ODeviceButton>;
138 127
139 for ( uint i = 0; i < ( sizeof( jornada56x_buttons ) / sizeof( j_button )); i++ ) { 128 for ( uint i = 0; i < ( sizeof( jornada56x_buttons ) / sizeof( j_button )); i++ ) {
140 j_button *ib = jornada56x_buttons + i; 129 j_button *ib = jornada56x_buttons + i;
141 ODeviceButton b; 130 ODeviceButton b;
@@ -169,27 +158,27 @@ bool Jornada::setDisplayBrightness( int bright )
169 if ( bright > 255 ) 158 if ( bright > 255 )
170 bright = 255; 159 bright = 255;
171 if ( bright < 0 ) 160 if ( bright < 0 )
172 bright = 0; 161 bright = 0;
173 162
174 QString cmdline; 163 QString cmdline;
175 164
176 int value = 255 - bright; 165 int value = 255 - bright;
177 if ( !bright ) 166 if ( !bright )
178 cmdline = QString().sprintf( "echo 4 > /sys/class/backlight/sa1100fb/power"); 167 cmdline = QString().sprintf( "echo 4 > /sys/class/backlight/sa1100fb/power");
179 else 168 else
180 cmdline = QString().sprintf( "echo 0 > /sys/class/backlight/sa1100fb/power; echo %d > /sys/class/backlight/sa1100fb/brightness", value ); 169 cmdline = QString().sprintf( "echo 0 > /sys/class/backlight/sa1100fb/power; echo %d > /sys/class/backlight/sa1100fb/brightness", value );
181 170
182 res = ( ::system( (const char*) cmdline ) == 0 ); 171 res = ( ::system( (const char*) cmdline ) == 0 );
183 172
184 return res; 173 return res;
185} 174}
186 175
187 176
188bool Jornada::suspend( ) 177bool Jornada::suspend( )
189{ 178{
190 qDebug("ODevice::suspend"); 179 qDebug("ODevice::suspend");
191 if ( !isQWS( ) ) // only qwsserver is allowed to suspend 180 if ( !isQWS( ) ) // only qwsserver is allowed to suspend
192 return false; 181 return false;
193 182
194 if ( d->m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices 183 if ( d->m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices
195 return false; 184 return false;
@@ -200,20 +189,20 @@ bool Jornada::suspend( )
200 struct timeval tvs; 189 struct timeval tvs;
201 ::gettimeofday ( &tvs, 0 ); 190 ::gettimeofday ( &tvs, 0 );
202 191
203 ::sync(); // flush fs caches 192 ::sync(); // flush fs caches
204 res = ( ::system ( "apm --suspend" ) == 0 ); 193 res = ( ::system ( "apm --suspend" ) == 0 );
205 194
206 return res; 195 return res;
207} 196}
208 197
209bool Jornada::setDisplayStatus ( bool on ) 198bool Jornada::setDisplayStatus ( bool on )
210{ 199{
211 bool res = false; 200 bool res = false;
212 201
213 QString cmdline = QString().sprintf( "echo %d > /sys/class/lcd/sa1100fb/power; echo %d > /sys/class/backlight/sa1100fb/power", on ? "0" : "4", on? "0" : "4" ); 202 QString cmdline = QString().sprintf( "echo %d > /sys/class/lcd/sa1100fb/power; echo %d > /sys/class/backlight/sa1100fb/power", on ? "0" : "4", on? "0" : "4" );
214 203
215 res = ( ::system( (const char*) cmdline ) == 0 ); 204 res = ( ::system( (const char*) cmdline ) == 0 );
216 205
217 return res; 206 return res;
218} 207}
219 208