-rw-r--r-- | libopie2/opiecore/device/odevice.h | 1 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_jornada.cpp | 28 |
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 | |||
@@ -50,48 +50,49 @@ namespace Opie{ | |||
50 | namespace Core{ | 50 | namespace Core{ |
51 | 51 | ||
52 | class ODeviceData; | 52 | class ODeviceData; |
53 | /** | 53 | /** |
54 | * The available devices | 54 | * The available devices |
55 | */ | 55 | */ |
56 | enum OModel { | 56 | enum 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 ), |
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 | |||
@@ -87,98 +87,112 @@ struct j_button jornada56x_buttons [] = { | |||
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 | ||
111 | void Jornada::init(const QString&) | 111 | void 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 | ||
121 | void Jornada::initButtons() | 135 | void 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 | ||
145 | int Jornada::displayBrightnessResolution() const | 159 | int Jornada::displayBrightnessResolution() const |
146 | { | 160 | { |
147 | return 255; | 161 | return 255; |
148 | } | 162 | } |
149 | 163 | ||
150 | 164 | ||
151 | bool Jornada::setDisplayBrightness( int bright ) | 165 | bool 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 | ||
174 | bool Jornada::setDisplayStatus ( bool on ) | 188 | bool 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 | ||