summaryrefslogtreecommitdiff
path: root/libopie2
authormickeyl <mickeyl>2005-08-23 12:25:35 (UTC)
committer mickeyl <mickeyl>2005-08-23 12:25:35 (UTC)
commit95210ac41729a4c264e830963cdae3a4cdd218fb (patch) (side-by-side diff)
treec73284a5aebdeb2f56d11cec6ecda80e9b41cec8 /libopie2
parentd6e8e6bf49bb176ec54efed5eb0d012098f056d7 (diff)
downloadopie-95210ac41729a4c264e830963cdae3a4cdd218fb.zip
opie-95210ac41729a4c264e830963cdae3a4cdd218fb.tar.gz
opie-95210ac41729a4c264e830963cdae3a4cdd218fb.tar.bz2
add support for the Sharp SL-C3100 "Borzoi"
Diffstat (limited to 'libopie2') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice.h1
-rw-r--r--libopie2/opiecore/device/odevice_zaurus.cpp16
-rw-r--r--libopie2/opiecore/device/odevice_zaurus.h2
3 files changed, 15 insertions, 4 deletions
diff --git a/libopie2/opiecore/device/odevice.h b/libopie2/opiecore/device/odevice.h
index 76cf97d..0eed1c9 100644
--- a/libopie2/opiecore/device/odevice.h
+++ b/libopie2/opiecore/device/odevice.h
@@ -63,48 +63,49 @@ enum OModel {
Model_iPAQ_All = ( Model_iPAQ | 0xffff ),
Model_iPAQ_H31xx = ( Model_iPAQ | 0x0001 ),
Model_iPAQ_H36xx = ( Model_iPAQ | 0x0002 ),
Model_iPAQ_H37xx = ( Model_iPAQ | 0x0003 ),
Model_iPAQ_H38xx = ( Model_iPAQ | 0x0004 ),
Model_iPAQ_H39xx = ( Model_iPAQ | 0x0005 ),
Model_iPAQ_H5xxx = ( Model_iPAQ | 0x0006 ),
Model_iPAQ_H22xx = ( Model_iPAQ | 0x0007 ),
Model_iPAQ_H191x = ( Model_iPAQ | 0x0008 ),
Model_Jornada = ( 6 << 16 ),
Model_Jornada_56x = ( Model_Jornada | 0x0001 ),
Model_Jornada_720 = ( Model_Jornada | 0x0002 ),
Model_Zaurus = ( 2 << 16 ),
Model_Zaurus_SL5000 = ( Model_Zaurus | 0x0001 ),
Model_Zaurus_SL5500 = ( Model_Zaurus | 0x0002 ),
Model_Zaurus_SLA300 = ( Model_Zaurus | 0x0003 ),
Model_Zaurus_SLB600 = ( Model_Zaurus | 0x0004 ),
Model_Zaurus_SLC7x0 = ( Model_Zaurus | 0x0005 ),
Model_Zaurus_SL6000 = ( Model_Zaurus | 0x0006 ),
Model_Zaurus_SLC3000 = ( Model_Zaurus | 0x0007 ),
Model_Zaurus_SLC1000 = ( Model_Zaurus | 0x0008 ),
+ Model_Zaurus_SLC3100 = ( Model_Zaurus | 0x0009 ),
Model_SIMpad = ( 3 << 16 ),
Model_SIMpad_All = ( Model_SIMpad | 0xffff ),
Model_SIMpad_CL4 = ( Model_SIMpad | 0x0001 ),
Model_SIMpad_SL4 = ( Model_SIMpad | 0x0002 ),
Model_SIMpad_SLC = ( Model_SIMpad | 0x0003 ),
Model_SIMpad_TSinus = ( Model_SIMpad | 0x0004 ),
Model_Ramses = ( 4 << 16 ),
Model_Ramses_All = ( Model_Ramses | 0xffff ),
Model_Ramses_MNCI = ( Model_Ramses | 0x0001 ),
Model_Ramses_MNCIRX = ( Model_Ramses | 0x0002 ),
Model_Yopy = ( 5 << 16 ),
Model_Yopy_All = ( Model_Yopy | 0xffff ),
Model_Yopy_3000 = ( Model_Yopy | 0x0001 ),
Model_Yopy_3500 = ( Model_Yopy | 0x0002 ),
Model_Yopy_3700 = ( Model_Yopy | 0x0003 ),
Model_Beagle = ( 6 << 16 ),
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp
index b7f3104..4a80a7e 100644
--- a/libopie2/opiecore/device/odevice_zaurus.cpp
+++ b/libopie2/opiecore/device/odevice_zaurus.cpp
@@ -1,28 +1,28 @@
/*
                This file is part of the Opie Project
              Copyright (C) 2002-2005 The Opie Team <opie-devel@handhelds.org>
- =.
+ =. Copyright (C) 2002-2005 Michael 'Mickey' Lauer <mickey@Vanille.de>
.=l.
           .>+-=
 _;:,     .>    :=|. This program is free software; you can
.> <`_,   >  .   <= redistribute it and/or modify it under
:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
.="- .-=="i,     .._ License as published by the Free Software
 - .   .-<_>     .<> Foundation; version 2 of the License.
     ._= =}       :
    .%`+i>       _;_.
    .i_,=:_.      -<s. This program is distributed in the hope that
     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
    : ..    .:,     . . . without even the implied warranty of
    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
..}^=.=       =       ; Library General Public License for more
++=   -.     .`     .: details.
 :     =  ...= . :.=-
 -.   .:....=;==+<; You should have received a copy of the GNU
  -_. . .   )=.  = Library General Public License along with
    --        :-=` this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
@@ -203,120 +203,125 @@ void Zaurus::init(const QString& cpu_info)
} else if ( model == "SHARP Shepherd" ) {
d->m_model = Model_Zaurus_SLC7x0;
d->m_modelstr = "Zaurus SL-C750";
} else if ( model == "SHARP Husky" ) {
d->m_model = Model_Zaurus_SLC7x0;
d->m_modelstr = "Zaurus SL-C760 or SL-C860";
} else if ( model == "SHARP Boxer" ) {
d->m_model = Model_Zaurus_SLC7x0;
d->m_modelstr = "Zaurus SL-C760 or SL-C860";
} else if ( model == "SHARP Poodle" ) {
d->m_model = Model_Zaurus_SLB600;
d->m_modelstr = "Zaurus SL-B500 or SL-5600";
} else if ( model == "Sharp-Collie" || model == "Collie" ) {
d->m_model = Model_Zaurus_SL5500;
d->m_modelstr = "Zaurus SL-5500 or SL-5000d";
} else if ( model == "SHARP Tosa" ) {
d->m_model = Model_Zaurus_SL6000;
d->m_modelstr = "Zaurus SL-6000";
} else if ( model == "SHARP Spitz" ) {
d->m_model = Model_Zaurus_SLC3000;
d->m_modelstr = "Zaurus SL-C3000";
} else if ( model == "SHARP Akita" ) {
d->m_model = Model_Zaurus_SLC1000;
d->m_modelstr = "Zaurus SL-C1000";
+ } else if ( model == "SHARP Borzoi" ) {
+ d->m_model = Model_Zaurus_SLC3100;
+ d->m_modelstr = "Zaurus SL-C3100";
} else {
d->m_model = Model_Zaurus_SL5500;
d->m_modelstr = "Unknown Zaurus";
}
// set path to backlight device in kernel 2.6
switch ( d->m_model )
{
case Model_Zaurus_SLB600: // fallthrough
case Model_Zaurus_SL5500:
m_backlightdev = "/sys/class/backlight/locomo-backlight/";
break;
case Model_Zaurus_SL6000:
m_backlightdev = "/sys/class/backlight/tosa-bl/";
break;
default:
m_backlightdev = "/sys/class/backlight/corgi-bl/";
}
// set initial rotation
switch( d->m_model )
{
case Model_Zaurus_SL6000: // fallthrough
case Model_Zaurus_SLA300:
d->m_rotation = Rot0;
break;
+ case Model_Zaurus_SLC3100: // fallthrough
case Model_Zaurus_SLC3000: // fallthrough
case Model_Zaurus_SLC1000: // fallthrough
case Model_Zaurus_SLC7x0:
d->m_rotation = rotation();
d->m_direction = direction();
break;
case Model_Zaurus_SLB600: // fallthrough
case Model_Zaurus_SL5000: // fallthrough
case Model_Zaurus_SL5500: // fallthrough
default:
d->m_rotation = Rot270;
}
// set default qte driver
switch( d->m_model )
{
case Model_Zaurus_SLC7x0:
d->m_qteDriver = "W100";
break;
default:
d->m_qteDriver = "Transformed";
}
m_leds[0] = Led_Off;
if ( m_embedix )
qDebug( "Zaurus::init() - Using the 2.4 Embedix HAL on a %s", (const char*) d->m_modelstr );
else
qDebug( "Zaurus::init() - Using the 2.6 OpenZaurus HAL on a %s", (const char*) d->m_modelstr );
}
void Zaurus::initButtons()
{
if ( d->m_buttons )
return;
d->m_buttons = new QValueList <ODeviceButton>;
struct z_button * pz_buttons;
int buttoncount;
switch ( d->m_model )
{
case Model_Zaurus_SL6000:
pz_buttons = z_buttons_6000;
buttoncount = ARRAY_SIZE(z_buttons_6000);
break;
+ case Model_Zaurus_SLC3100: // fallthrough
case Model_Zaurus_SLC3000: // fallthrough
case Model_Zaurus_SLC1000: // fallthrough
case Model_Zaurus_SLC7x0:
if ( isQWS( ) ) {
addPreHandler(this); // hinge-sensor-handler
}
pz_buttons = z_buttons_c700;
buttoncount = ARRAY_SIZE(z_buttons_c700);
break;
default:
pz_buttons = z_buttons;
buttoncount = ARRAY_SIZE(z_buttons);
break;
}
for ( int i = 0; i < buttoncount; i++ ) {
struct z_button *zb = pz_buttons + i;
ODeviceButton b;
b.setKeycode( zb->code );
b.setUserText( QObject::tr( "Button", zb->utext ));
b.setPixmap( OResource::loadPixmap( zb->pix ));
b.setFactoryPresetPressedAction( OQCopMessage( makeChannel ( zb->fpressedservice ), zb->fpressedaction ));
b.setFactoryPresetHeldAction( OQCopMessage( makeChannel ( zb->fheldservice ), zb->fheldaction ));
@@ -528,48 +533,49 @@ bool Zaurus::setDisplayStatus( bool on )
::close ( fd );
}
}
else
{
int fd = ::open( m_backlightdev + "power", O_WRONLY|O_NONBLOCK );
if ( fd )
{
char buf[10];
buf[0] = on ? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN;
buf[1] = '\0';
res = ( ::write( fd, &buf[0], 2 ) == 0 );
::close( fd );
}
}
return res;
}
Transformation Zaurus::rotation() const
{
qDebug( "Zaurus::rotation()" );
Transformation rot;
switch ( d->m_model ) {
+ case Model_Zaurus_SLC3100: // fallthrough
case Model_Zaurus_SLC3000: // fallthrough
case Model_Zaurus_SLC1000:
{
OHingeStatus hs = readHingeSensor();
qDebug( "Zaurus::rotation() - hinge sensor = %d", (int) hs );
if ( hs == CASE_PORTRAIT ) rot = Rot0;
else if ( hs == CASE_UNKNOWN ) rot = Rot270;
else rot = Rot270;
}
break;
// SLC7x0 needs a special case here, because we were able to set the W100
// hardware default rotation on kernel 2.6 to Rot0
case Model_Zaurus_SLC7x0:
{
OHingeStatus hs = readHingeSensor();
qDebug( "Zaurus::rotation() - hinge sensor = %d", (int) hs );
if ( m_embedix )
{
if ( hs == CASE_PORTRAIT ) rot = Rot0;
else if ( hs == CASE_UNKNOWN ) rot = Rot270;
else rot = Rot270;
}
@@ -577,72 +583,76 @@ Transformation Zaurus::rotation() const
{
if ( hs == CASE_PORTRAIT ) rot = Rot90;
else if ( hs == CASE_UNKNOWN ) rot = Rot0;
else rot = Rot0;
}
}
break;
case Model_Zaurus_SL6000:
case Model_Zaurus_SLB600:
case Model_Zaurus_SLA300:
case Model_Zaurus_SL5500:
case Model_Zaurus_SL5000:
default:
rot = d->m_rotation;
break;
}
return rot;
}
ODirection Zaurus::direction() const
{
ODirection dir;
switch ( d->m_model ) {
+ case Model_Zaurus_SLC3100: // fallthrough
case Model_Zaurus_SLC3000: // fallthrough
case Model_Zaurus_SLC1000: // fallthrough
case Model_Zaurus_SLC7x0: {
OHingeStatus hs = readHingeSensor();
if ( hs == CASE_PORTRAIT ) dir = CCW;
else if ( hs == CASE_UNKNOWN ) dir = CCW;
else dir = CW;
}
break;
case Model_Zaurus_SL6000:
case Model_Zaurus_SLA300:
case Model_Zaurus_SLB600:
case Model_Zaurus_SL5500:
case Model_Zaurus_SL5000:
default: dir = d->m_direction;
break;
}
return dir;
}
bool Zaurus::hasHingeSensor() const
{
- return d->m_model == Model_Zaurus_SLC7x0 || d->m_model == Model_Zaurus_SLC3000 || d->m_model == Model_Zaurus_SLC1000;
+ return d->m_model == Model_Zaurus_SLC7x0 ||
+ d->m_model == Model_Zaurus_SLC3100 ||
+ d->m_model == Model_Zaurus_SLC3000 ||
+ d->m_model == Model_Zaurus_SLC1000;
}
OHingeStatus Zaurus::readHingeSensor() const
{
if (m_embedix)
{
int handle = ::open("/dev/apm_bios", O_RDWR|O_NONBLOCK);
if (handle == -1)
{
qWarning("Zaurus::readHingeSensor() - failed (%s)", "unknown reason" ); //FIXME: use strerror
return CASE_UNKNOWN;
}
else
{
int retval = ::ioctl(handle, SHARP_IOCTL_GET_ROTATION);
::close (handle);
if ( retval == CASE_CLOSED || retval == CASE_PORTRAIT || retval == CASE_LANDSCAPE )
{
qDebug( "Zaurus::readHingeSensor() - result = %d", retval );
return static_cast<OHingeStatus>( retval );
}
else
{
qWarning("Zaurus::readHingeSensor() - couldn't compute hinge status!" );
@@ -650,49 +660,49 @@ OHingeStatus Zaurus::readHingeSensor() const
}
}
}
else
{
// corgi keyboard is event source 0 in OZ kernel 2.6
OInputDevice* keyboard = OInputSystem::instance()->device( "event0" );
if ( keyboard && keyboard->isHeld( OInputDevice::Key_KP0 ) ) return CASE_LANDSCAPE;
else if ( keyboard && keyboard->isHeld( OInputDevice::Key_KP1 ) ) return CASE_PORTRAIT;
else if ( keyboard && keyboard->isHeld( OInputDevice::Key_KP2 ) ) return CASE_CLOSED;
qWarning("Zaurus::readHingeSensor() - couldn't compute hinge status!" );
return CASE_UNKNOWN;
}
}
/*
* Take code from iPAQ device.
* That way we switch the cursor directions depending on status of hinge sensor, eg. hardware direction.
* I hope that is ok - Alwin
*/
bool Zaurus::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat )
{
int newkeycode = keycode;
- if (d->m_model != Model_Zaurus_SLC7x0 && d->m_model != Model_Zaurus_SLC3000 && d->m_model != Model_Zaurus_SLC1000) return false;
+ if ( !hasHingeSensor() ) return false;
/* map cursor keys depending on the hinge status */
switch ( keycode ) {
// Rotate cursor keys
case Key_Left :
case Key_Right:
case Key_Up :
case Key_Down :
{
if (rotation()==Rot90) {
newkeycode = Key_Left + ( keycode - Key_Left + 3 ) % 4;
}
}
break;
}
if (newkeycode!=keycode) {
if ( newkeycode != Key_unknown ) {
QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat );
}
return true;
}
return false;
}
diff --git a/libopie2/opiecore/device/odevice_zaurus.h b/libopie2/opiecore/device/odevice_zaurus.h
index 4314aff..677e29f 100644
--- a/libopie2/opiecore/device/odevice_zaurus.h
+++ b/libopie2/opiecore/device/odevice_zaurus.h
@@ -1,28 +1,28 @@
/*
                This file is part of the Opie Project
              Copyright (C) 2002-2005 The Opie Team <opie-devel@handhelds.org>
- =.
+ =. Copyright (C) 2002-2005 Michael 'Mickey' Lauer <mickey@Vanille.de>
.=l.
           .>+-=
 _;:,     .>    :=|. This program is free software; you can
.> <`_,   >  .   <= redistribute it and/or modify it under
:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
.="- .-=="i,     .._ License as published by the Free Software
 - .   .-<_>     .<> Foundation; version 2 of the License.
     ._= =}       :
    .%`+i>       _;_.
    .i_,=:_.      -<s. This program is distributed in the hope that
     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
    : ..    .:,     . . . without even the implied warranty of
    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
..}^=.=       =       ; Library General Public License for more
++=   -.     .`     .: details.
 :     =  ...= . :.=-
 -.   .:....=;==+<; You should have received a copy of the GNU
  -_. . .   )=.  = Library General Public License along with
    --        :-=` this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/