summaryrefslogtreecommitdiff
authorzecke <zecke>2004-09-19 23:47:29 (UTC)
committer zecke <zecke>2004-09-19 23:47:29 (UTC)
commitfa9e4fa0c51c30be12caf8b5c92d722b40509814 (patch) (unidiff)
treef762de653efcf9e1c646ec002b08b5542fd5e38e
parent83272b7645c639669dddd676f17f64ad78ef9c63 (diff)
downloadopie-fa9e4fa0c51c30be12caf8b5c92d722b40509814.zip
opie-fa9e4fa0c51c30be12caf8b5c92d722b40509814.tar.gz
opie-fa9e4fa0c51c30be12caf8b5c92d722b40509814.tar.bz2
-Check m_model to allow suspending. ODevice doesn't suspend on UnknownModel
-Comments -map 0-255 brightness to 0-100 for Assabat Frontlight Control -Change return value for display on and off
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice_beagle.cpp59
1 files changed, 52 insertions, 7 deletions
diff --git a/libopie2/opiecore/device/odevice_beagle.cpp b/libopie2/opiecore/device/odevice_beagle.cpp
index 9cf640a..ac12ca6 100644
--- a/libopie2/opiecore/device/odevice_beagle.cpp
+++ b/libopie2/opiecore/device/odevice_beagle.cpp
@@ -40,3 +40,5 @@
40 40
41 41/*
42 * Intel Assabat FrontLight Control
43 */
42 #define _SA1100_FL_IOCTL_ON 1 44 #define _SA1100_FL_IOCTL_ON 1
@@ -52,2 +54,5 @@
52 54
55/*
56 * The device
57 */
53#define FL_MAJOR 60 58#define FL_MAJOR 60
@@ -71,4 +76,14 @@ struct b_button {
71 76
77
78/*
79 * The MVista Beagle kernel maps the action
80 * buttons to the Qt keymap
81 */
72struct b_button beagle_buttons [] = { 82struct b_button beagle_buttons [] = {
73 { Model_Beagle_PA100, 83 { Model_Beagle_PA100,
84 Qt::Key_F8, QT_TRANSLATE_NOOP("Button", "Record Button"),
85 "devicebuttons/beagle_record",
86 "QPE/VMemo", "toggleRecord()",
87 "sound", "raise()" },
88 { Model_Beagle_PA100,
74 Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), 89 Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"),
@@ -95,8 +110,9 @@ struct b_button beagle_buttons [] = {
95 110
96Beagle::Beagle() 111Beagle::Beagle() {}
97{ 112
98 qWarning( "Created Beagle" );
99}
100Beagle::~Beagle() {} 113Beagle::~Beagle() {}
101 114
115/*
116 * Simply set the Tradesquare.NL data
117 */
102void Beagle::init( const QString&) { 118void Beagle::init( const QString&) {
@@ -109,4 +125,14 @@ void Beagle::init( const QString&) {
109 d->m_rotation = Rot0; 125 d->m_rotation = Rot0;
126 d->m_model = Model_Beagle_PA100;
110} 127}
111 128
129
130/*
131 * Initialize the Buttons. We only do it
132 * if not yet initialized.
133 * We go through our hardware button array
134 * and set the 'Factory' Pressed and Held Action
135 * reloadButtonMapping will then apply the user
136 * configuration to the buttons
137 */
112void Beagle::initButtons() { 138void Beagle::initButtons() {
@@ -131,2 +157,5 @@ void Beagle::initButtons() {
131 157
158/*
159 * Turn the display on. We do it by ioctl on FL_FILE
160 */
132bool Beagle::setDisplayStatus( bool on ) { 161bool Beagle::setDisplayStatus( bool on ) {
@@ -137,5 +166,8 @@ bool Beagle::setDisplayStatus( bool on ) {
137 166
138 return ( ::ioctl(fd, on ? _SA1100_FL_IOCTL_ON : _SA1100_FL_IOCTL_OFF, 0 ) == -1 ); 167 return ( ::ioctl(fd, on ? _SA1100_FL_IOCTL_ON : _SA1100_FL_IOCTL_OFF, 0 ) == 0 );
139} 168}
140 169
170/*
171 * 0-100 are legal steps of the frontlight.
172 */
141int Beagle::displayBrightnessResolution()const { 173int Beagle::displayBrightnessResolution()const {
@@ -144,3 +176,16 @@ int Beagle::displayBrightnessResolution()const {
144 176
177/*
178 * Opie uses the values 0-255 for the frontlight
179 * intensity and we need to map it to the range
180 * of 0-100.
181 * But first we do some sanity of the range of brightness
182 *
183 */
145bool Beagle::setDisplayBrightness( int brightness ) { 184bool Beagle::setDisplayBrightness( int brightness ) {
185 if ( brightness > 255 )
186 brightness = 255;
187 else if ( brightness < 0 )
188 brightness = 0;
189 brightness = (100*brightness)/255;
190
146 int fd = ::open(FL_FILE, O_WRONLY); 191 int fd = ::open(FL_FILE, O_WRONLY);
@@ -150,3 +195,3 @@ bool Beagle::setDisplayBrightness( int brightness ) {
150 195
151 return ( ::ioctl(fd, _SA1100_FL_IOCTL_INTENSITY, brightness%101 ) == 0 ); 196 return ( ::ioctl(fd, _SA1100_FL_IOCTL_INTENSITY, brightness ) == 0 );
152} 197}