author | mickeyl <mickeyl> | 2004-06-12 16:54:50 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-06-12 16:54:50 (UTC) |
commit | b1235df3628d178891eeefed630a22da46b25952 (patch) (unidiff) | |
tree | c88a3cb04adcc9fe214ff08e3c0b96b21e3c4f0a /libopie2/opiecore/device/odevice_jornada.cpp | |
parent | 7a62e8e3601ee98f5f06261c361fe8132334cd56 (diff) | |
download | opie-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.cpp | 19 |
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 | |||
@@ -93,61 +93,50 @@ struct j_button jornada56x_buttons [] = { | |||
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 | ||
111 | void Jornada::init(const QString&) | 111 | void 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 | ||
132 | void Jornada::initButtons() | 121 | void 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; |
142 | 131 | ||
143 | if (( ib->model & d->m_model ) == d->m_model ) { | 132 | if (( ib->model & d->m_model ) == d->m_model ) { |
144 | b. setKeycode ( ib->code ); | 133 | b. setKeycode ( ib->code ); |
145 | b. setUserText ( QObject::tr ( "Button", ib->utext )); | 134 | b. setUserText ( QObject::tr ( "Button", ib->utext )); |
146 | b. setPixmap ( Resource::loadPixmap ( ib->pix )); | 135 | b. setPixmap ( Resource::loadPixmap ( ib->pix )); |
147 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib->fpressedservice ), ib->fpressedaction )); | 136 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib->fpressedservice ), ib->fpressedaction )); |
148 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib->fheldservice ), ib->fheldaction )); | 137 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib->fheldservice ), ib->fheldaction )); |
149 | 138 | ||
150 | d->m_buttons->append ( b ); | 139 | d->m_buttons->append ( b ); |
151 | } | 140 | } |
152 | } | 141 | } |
153 | reloadButtonMapping(); | 142 | reloadButtonMapping(); |
@@ -157,63 +146,63 @@ void Jornada::initButtons() | |||
157 | } | 146 | } |
158 | 147 | ||
159 | int Jornada::displayBrightnessResolution() const | 148 | int Jornada::displayBrightnessResolution() const |
160 | { | 149 | { |
161 | return 255; | 150 | return 255; |
162 | } | 151 | } |
163 | 152 | ||
164 | 153 | ||
165 | bool Jornada::setDisplayBrightness( int bright ) | 154 | bool Jornada::setDisplayBrightness( int bright ) |
166 | { | 155 | { |
167 | bool res = false; | 156 | bool res = false; |
168 | 157 | ||
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 | ||
188 | bool Jornada::suspend( ) | 177 | bool 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; |
196 | 185 | ||
197 | bool res = false; | 186 | bool res = false; |
198 | ODevice::sendSuspendmsg(); | 187 | ODevice::sendSuspendmsg(); |
199 | 188 | ||
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 | ||
209 | bool Jornada::setDisplayStatus ( bool on ) | 198 | bool 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 | ||