summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/device.pro6
-rw-r--r--libopie2/opiecore/device/odevice.cpp3
-rw-r--r--libopie2/opiecore/device/odevice_beagle.cpp156
-rw-r--r--libopie2/opiecore/device/odevice_beagle.h62
4 files changed, 225 insertions, 2 deletions
diff --git a/libopie2/opiecore/device/device.pro b/libopie2/opiecore/device/device.pro
index 946bff1..87a3fd8 100644
--- a/libopie2/opiecore/device/device.pro
+++ b/libopie2/opiecore/device/device.pro
@@ -1,19 +1,23 @@
1HEADERS += device/odevice.h \ 1HEADERS += device/odevice.h \
2 device/odevicebutton.h \ 2 device/odevicebutton.h \
3 device/odevice_beagle.h \
3 device/odevice_ipaq.h \ 4 device/odevice_ipaq.h \
4 device/odevice_jornada.h \ 5 device/odevice_jornada.h \
5 device/odevice_ramses.h \ 6 device/odevice_ramses.h \
6 device/odevice_simpad.h \ 7 device/odevice_simpad.h \
7 device/odevice_zaurus.h \ 8 device/odevice_zaurus.h \
8 device/odevice_yopy.h \ 9 device/odevice_yopy.h \
10 device/odevice_beagle.h
9 11
10SOURCES += device/odevice.cpp \ 12SOURCES += device/odevice.cpp \
11 device/odevicebutton.cpp \ 13 device/odevicebutton.cpp \
14 device/odevice_beagle.cpp \
12 device/odevice_ipaq.cpp \ 15 device/odevice_ipaq.cpp \
13 device/odevice_jornada.cpp\ 16 device/odevice_jornada.cpp\
14 device/odevice_ramses.cpp \ 17 device/odevice_ramses.cpp \
15 device/odevice_simpad.cpp \ 18 device/odevice_simpad.cpp \
16 device/odevice_zaurus.cpp \ 19 device/odevice_zaurus.cpp \
17 device/odevice_yopy.cpp \ 20 device/odevice_yopy.cpp
21
18 22
19 23
diff --git a/libopie2/opiecore/device/odevice.cpp b/libopie2/opiecore/device/odevice.cpp
index 2355621..2b10034 100644
--- a/libopie2/opiecore/device/odevice.cpp
+++ b/libopie2/opiecore/device/odevice.cpp
@@ -27,6 +27,7 @@
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29 29
30#include "odevice_beagle.h"
30#include "odevice_ipaq.h" 31#include "odevice_ipaq.h"
31#include "odevice_jornada.h" 32#include "odevice_jornada.h"
32#include "odevice_ramses.h" 33#include "odevice_ramses.h"
@@ -139,6 +140,7 @@ ODevice *ODevice::inst()
139 else if ( line.contains( "simpad", false ) ) dev = new Internal::SIMpad(); 140 else if ( line.contains( "simpad", false ) ) dev = new Internal::SIMpad();
140 else if ( line.contains( "jornada", false ) ) dev = new Internal::Jornada(); 141 else if ( line.contains( "jornada", false ) ) dev = new Internal::Jornada();
141 else if ( line.contains( "ramses", false ) ) dev = new Internal::Ramses(); 142 else if ( line.contains( "ramses", false ) ) dev = new Internal::Ramses();
143 else if ( line.contains( "Tradesquare.NL", false ) ) dev = new Internal::Beagle();
142 else qWarning( "ODevice() - unknown hardware - using default." ); 144 else qWarning( "ODevice() - unknown hardware - using default." );
143 break; 145 break;
144 } 146 }
@@ -266,7 +268,6 @@ bool ODevice::setSoftSuspend ( bool /*soft*/ )
266*/ 268*/
267bool ODevice::suspend() 269bool ODevice::suspend()
268{ 270{
269 qDebug("ODevice::suspend");
270 if ( !isQWS( ) ) // only qwsserver is allowed to suspend 271 if ( !isQWS( ) ) // only qwsserver is allowed to suspend
271 return false; 272 return false;
272 273
diff --git a/libopie2/opiecore/device/odevice_beagle.cpp b/libopie2/opiecore/device/odevice_beagle.cpp
new file mode 100644
index 0000000..9cf640a
--- a/dev/null
+++ b/libopie2/opiecore/device/odevice_beagle.cpp
@@ -0,0 +1,156 @@
1/*
2                 This file is part of the Opie Project
3              Copyright (C) 2004 The Opie Team <opie-devel@handhelds.org>
4 =.
5 .=l.
6           .>+-=
7 _;:,     .>    :=|. This program is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This program is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details.
21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
29
30#include "odevicebutton.h"
31#include "odevice_beagle.h"
32
33#include <qpe/resource.h>
34
35#include <sys/types.h>
36#include <sys/ioctl.h>
37#include <fcntl.h>
38#include <unistd.h>
39
40
41
42 #define _SA1100_FL_IOCTL_ON 1
43 #define _SA1100_FL_IOCTL_OFF 2
44 #define _SA1100_FL_IOCTL_INTENSITY3
45#define _SA1100_FL_IOCTL_BACKLIGHT 4
46 #define _SA1100_FL_IOCTL_CONTRAST5
47#define _SA1100_FL_IOCTL_GET_BACKLIGHT 6
48#define _SA1100_FL_IOCTL_GET_CONTRAST 7
49// added by Sean Hsieh
50 #define _SA1100_FL_IOCTL_PWR_TOGGLE 8
51 #define _SA1100_FL_IOCTL_AUTOLIGHT 10
52
53#define FL_MAJOR 60
54#define FL_NAME "sa1100-fl"
55#define FL_FILE "/dev/sa1100-fl"
56
57namespace Opie {
58namespace Core {
59namespace Internal {
60
61struct b_button {
62 uint model;
63 Qt::Key code;
64 char *utext;
65 char *pix;
66 char *fpressedservice;
67 char *fpressedaction;
68 char *fheldservice;
69 char *fheldaction;
70};
71
72struct b_button beagle_buttons [] = {
73 { Model_Beagle_PA100,
74 Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"),
75 "devicebuttons/beagle_calendar",
76 "datebook", "nextView()",
77 "today", "raise()" },
78 { Model_Beagle_PA100,
79 Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"),
80 "devicebuttons/beagle_contact",
81 "addressbook", "raise()",
82 "addressbook", "beamBusinessCard()" },
83 { Model_Beagle_PA100,
84 Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Todo Button"),
85 "devicebuttons/beagle_todo",
86 "todolist", "raise()",
87 "QPE/TaskBar", "toggleMenu()" },
88 { Model_Beagle_PA100,
89 Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
90 "devicebuttons/beagle_home",
91 "QPE/Launcher", "home()",
92 "buttonsettings", "raise()" },
93};
94
95
96Beagle::Beagle()
97{
98 qWarning( "Created Beagle" );
99}
100Beagle::~Beagle() {}
101
102void Beagle::init( const QString&) {
103 /*
104 * No other assabat model yet
105 */
106 d->m_vendorstr = "Tradesquare.NL";
107 d->m_vendor = Vendor_MasterIA;
108 d->m_modelstr = "Tuxpda 1";
109 d->m_rotation = Rot0;
110}
111
112void Beagle::initButtons() {
113 if ( d->m_buttons )
114 return;
115
116 d->m_buttons = new QValueList<ODeviceButton>;
117 uint length = sizeof( beagle_buttons )/ sizeof( b_button );
118 for ( uint i = 0; i < length; ++i ) {
119 b_button *bb = &beagle_buttons[i];
120 ODeviceButton b;
121 b.setKeycode( bb->code );
122 b.setUserText( QObject::tr( "Button", bb->utext ) );
123 b.setPixmap( Resource::loadPixmap( bb->pix ) );
124 b.setFactoryPresetPressedAction( OQCopMessage( makeChannel( bb->fpressedservice ), bb->fpressedaction ) );
125 b.setFactoryPresetHeldAction( OQCopMessage( makeChannel( bb->fheldservice ), bb->fheldaction ) );
126 d->m_buttons->append( b );
127 }
128
129 reloadButtonMapping();
130}
131
132bool Beagle::setDisplayStatus( bool on ) {
133 int fd = ::open(FL_FILE, O_WRONLY);
134
135 if ( fd < 0 )
136 return false;
137
138 return ( ::ioctl(fd, on ? _SA1100_FL_IOCTL_ON : _SA1100_FL_IOCTL_OFF, 0 ) == -1 );
139}
140
141int Beagle::displayBrightnessResolution()const {
142 return 100;
143}
144
145bool Beagle::setDisplayBrightness( int brightness ) {
146 int fd = ::open(FL_FILE, O_WRONLY);
147
148 if ( fd < 0 )
149 return false;
150
151 return ( ::ioctl(fd, _SA1100_FL_IOCTL_INTENSITY, brightness%101 ) == 0 );
152}
153
154}
155}
156}
diff --git a/libopie2/opiecore/device/odevice_beagle.h b/libopie2/opiecore/device/odevice_beagle.h
new file mode 100644
index 0000000..1626330
--- a/dev/null
+++ b/libopie2/opiecore/device/odevice_beagle.h
@@ -0,0 +1,62 @@
1/*
2                 This file is part of the Opie Project
3              Copyright (C) 2004 The Opie Team <opie-devel@handhelds.org>
4 =.
5 .=l.
6           .>+-=
7 _;:,     .>    :=|. This program is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This program is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details.
21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
29
30#ifndef OPIE_CORE_DEVICE_BEAGLE_H
31#define OPIE_CORE_DEVICE_BEAGLE_H
32
33#include "odevice.h"
34
35namespace Opie {
36namespace Core {
37namespace Internal {
38class Beagle : public ODevice {
39 Q_OBJECT
40public:
41 Beagle();
42 ~Beagle();
43
44//@{
45 void init( const QString& init );
46 void initButtons();
47//@}
48
49
50//@{
51 bool setDisplayStatus( bool on );
52 int displayBrightnessResolution()const;
53 bool setDisplayBrightness( int brightness );
54//@}
55
56};
57}
58}
59}
60
61
62#endif