summaryrefslogtreecommitdiff
path: root/libopie2/opiecore
Side-by-side diff
Diffstat (limited to 'libopie2/opiecore') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice.cpp2
-rw-r--r--libopie2/opiecore/device/odevice_ipaq.cpp2
-rw-r--r--libopie2/opiecore/device/odevice_simpad.cpp2
-rw-r--r--libopie2/opiecore/device/odevice_yopy.cpp4
-rw-r--r--libopie2/opiecore/device/odevice_zaurus.cpp4
-rw-r--r--libopie2/opiecore/oprocess.cpp12
6 files changed, 13 insertions, 13 deletions
diff --git a/libopie2/opiecore/device/odevice.cpp b/libopie2/opiecore/device/odevice.cpp
index b8d48fe..27b0e53 100644
--- a/libopie2/opiecore/device/odevice.cpp
+++ b/libopie2/opiecore/device/odevice.cpp
@@ -100,97 +100,97 @@ ODevice *ODevice::inst()
}
return dev;
}
ODevice::ODevice()
{
d = new ODeviceData;
d->m_modelstr = "Unknown";
d->m_model = Model_Unknown;
d->m_vendorstr = "Unknown";
d->m_vendor = Vendor_Unknown;
d->m_systemstr = "Unknown";
d->m_system = System_Unknown;
d->m_sysverstr = "0.0";
d->m_rotation = Rot0;
d->m_direction = CW;
d->m_holdtime = 1000; // 1000ms
d->m_buttons = 0;
d->m_cpu_frequencies = new QStrList;
}
void ODevice::systemMessage ( const QCString &msg, const QByteArray & )
{
if ( msg == "deviceButtonMappingChanged()" ) {
reloadButtonMapping();
}
}
void ODevice::init()
{
}
/**
* This method initialises the button mapping
*/
void ODevice::initButtons()
{
if ( d->m_buttons )
return;
qDebug ( "init Buttons" );
d->m_buttons = new QValueList <ODeviceButton>;
reloadButtonMapping();
QCopChannel *sysch = new QCopChannel ( "QPE/System", this );
- connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & )));
+ connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( systemMessage(const QCString&,const QByteArray&)));
}
ODevice::~ODevice()
{
// we leak m_devicebuttons and m_cpu_frequency
// but it's a singleton and it is not so importantant
// -zecke
delete d;
}
bool ODevice::setSoftSuspend ( bool /*soft*/ )
{
return false;
}
//#include <linux/apm_bios.h>
#define APM_IOC_SUSPEND OD_IO( 'A', 2 )
/**
* This method will try to suspend the device
* It only works if the user is the QWS Server and the apm application
* is installed.
* It tries to suspend and then waits some time cause some distributions
* do have asynchronus apm implementations.
* This method will either fail and return false or it'll suspend the
* device and return once the device got woken up
*
* @return if the device got suspended
*/
bool ODevice::suspend()
{
qDebug("ODevice::suspend");
if ( !isQWS( ) ) // only qwsserver is allowed to suspend
return false;
if ( d->m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices
return false;
bool res = false;
ODevice::sendSuspendmsg();
struct timeval tvs, tvn;
::gettimeofday ( &tvs, 0 );
::sync(); // flush fs caches
res = ( ::system ( "apm --suspend" ) == 0 );
diff --git a/libopie2/opiecore/device/odevice_ipaq.cpp b/libopie2/opiecore/device/odevice_ipaq.cpp
index cc4b01a..8ecea1b 100644
--- a/libopie2/opiecore/device/odevice_ipaq.cpp
+++ b/libopie2/opiecore/device/odevice_ipaq.cpp
@@ -167,97 +167,97 @@ void iPAQ::init()
f. close();
} else {
f. setName ( "/etc/oz_version" );
if ( f. open ( IO_ReadOnly )) {
d->m_systemstr = "OpenEmbedded/iPaq";
d->m_system = System_Familiar;
QTextStream ts ( &f );
ts.setDevice ( &f );
d->m_sysverstr = ts. readLine();
f. close();
}
}
m_leds [0] = m_leds [1] = Led_Off;
m_power_timer = 0;
}
void iPAQ::initButtons()
{
if ( d->m_buttons )
return;
if ( isQWS( ) )
QWSServer::setKeyboardFilter ( this );
d->m_buttons = new QValueList <ODeviceButton>;
for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) {
i_button *ib = ipaq_buttons + i;
ODeviceButton b;
if (( ib->model & d->m_model ) == d->m_model ) {
b. setKeycode ( ib->code );
b. setUserText ( QObject::tr ( "Button", ib->utext ));
b. setPixmap ( Resource::loadPixmap ( ib->pix ));
b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib->fpressedservice ), ib->fpressedaction ));
b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib->fheldservice ), ib->fheldaction ));
d->m_buttons->append ( b );
}
}
reloadButtonMapping();
QCopChannel *sysch = new QCopChannel ( "QPE/System", this );
- connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & )));
+ connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( systemMessage(const QCString&,const QByteArray&)));
}
QValueList <OLed> iPAQ::ledList() const
{
QValueList <OLed> vl;
vl << Led_Power;
if ( d->m_model == Model_iPAQ_H38xx )
vl << Led_BlueTooth;
return vl;
}
QValueList <OLedState> iPAQ::ledStateList ( OLed l ) const
{
QValueList <OLedState> vl;
if ( l == Led_Power )
vl << Led_Off << Led_On << Led_BlinkSlow << Led_BlinkFast;
else if ( l == Led_BlueTooth && d->m_model == Model_iPAQ_H38xx )
vl << Led_Off; // << Led_On << ???
return vl;
}
OLedState iPAQ::ledState ( OLed l ) const
{
switch ( l ) {
case Led_Power:
return m_leds [0];
case Led_BlueTooth:
return m_leds [1];
default:
return Led_Off;
}
}
bool iPAQ::setLedState ( OLed l, OLedState st )
{
static int fd = ::open ( "/dev/touchscreen/0", O_RDWR | O_NONBLOCK );
if ( l == Led_Power ) {
if ( fd >= 0 ) {
LED_IN leds;
::memset ( &leds, 0, sizeof( leds ));
leds. TotalTime = 0;
leds. OnTime = 0;
leds. OffTime = 1;
leds. OffOnBlink = 2;
diff --git a/libopie2/opiecore/device/odevice_simpad.cpp b/libopie2/opiecore/device/odevice_simpad.cpp
index 31b9297..90aca2f 100644
--- a/libopie2/opiecore/device/odevice_simpad.cpp
+++ b/libopie2/opiecore/device/odevice_simpad.cpp
@@ -144,97 +144,97 @@ void SIMpad::init()
f. close();
} else {
f. setName ( "/etc/oz_version" );
if ( f. open ( IO_ReadOnly )) {
d->m_systemstr = "OpenEmbedded/SIMpad";
d->m_system = System_OpenZaurus;
QTextStream ts ( &f );
ts.setDevice ( &f );
d->m_sysverstr = ts. readLine();
f. close();
}
}
m_leds [0] = m_leds [1] = Led_Off;
m_power_timer = 0;
}
void SIMpad::initButtons()
{
if ( d->m_buttons )
return;
if ( isQWS( ) )
QWSServer::setKeyboardFilter ( this );
d->m_buttons = new QValueList <ODeviceButton>;
for ( uint i = 0; i < ( sizeof( simpad_buttons ) / sizeof( s_button )); i++ ) {
s_button *sb = simpad_buttons + i;
ODeviceButton b;
if (( sb->model & d->m_model ) == d->m_model ) {
b. setKeycode ( sb->code );
b. setUserText ( QObject::tr ( "Button", sb->utext ));
b. setPixmap ( Resource::loadPixmap ( sb->pix ));
b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( sb->fpressedservice ), sb->fpressedaction ));
b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( sb->fheldservice ), sb->fheldaction ));
d->m_buttons->append ( b );
}
}
reloadButtonMapping();
QCopChannel *sysch = new QCopChannel ( "QPE/System", this );
- connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & )));
+ connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( systemMessage(const QCString&,const QByteArray&)));
}
// SIMpad boardcontrol register CS3
#define SIMPAD_BOARDCONTROL "/proc/cs3"
#define SIMPAD_VCC_5V_EN 0x0001 // For 5V PCMCIA
#define SIMPAD_VCC_3V_EN 0x0002 // FOR 3.3V PCMCIA
#define SIMPAD_EN1 0x0004 // This is only for EPROM's
#define SIMPAD_EN0 0x0008 // Both should be enable for 3.3V or 5V
#define SIMPAD_DISPLAY_ON 0x0010
#define SIMPAD_PCMCIA_BUFF_DIS 0x0020
#define SIMPAD_MQ_RESET 0x0040
#define SIMPAD_PCMCIA_RESET 0x0080
#define SIMPAD_DECT_POWER_ON 0x0100
#define SIMPAD_IRDA_SD 0x0200 // Shutdown for powersave
#define SIMPAD_RS232_ON 0x0400
#define SIMPAD_SD_MEDIAQ 0x0800 // Shutdown for powersave
#define SIMPAD_LED2_ON 0x1000
#define SIMPAD_IRDA_MODE 0x2000 // Fast/Slow IrDA mode
#define SIMPAD_ENABLE_5V 0x4000 // Enable 5V circuit
#define SIMPAD_RESET_SIMCARD 0x8000
//SIMpad touchscreen backlight strength control
#define SIMPAD_BACKLIGHT_CONTROL "/proc/driver/mq200/registers/PWM_CONTROL"
#define SIMPAD_BACKLIGHT_MASK 0x00a10044
QValueList <OLed> SIMpad::ledList() const
{
QValueList <OLed> vl;
vl << Led_Power; //FIXME which LED is LED2 ? The green one or the amber one?
//vl << Led_Mail; //TODO find out if LED1 is accessible anyway
return vl;
}
QValueList <OLedState> SIMpad::ledStateList ( OLed l ) const
{
QValueList <OLedState> vl;
if ( l == Led_Power ) //FIXME which LED is LED2 ? The green one or the amber one?
vl << Led_Off << Led_On;
//else if ( l == Led_Mail ) //TODO find out if LED1 is accessible anyway
//vl << Led_Off;
return vl;
}
OLedState SIMpad::ledState ( OLed l ) const
{
switch ( l ) {
case Led_Power:
diff --git a/libopie2/opiecore/device/odevice_yopy.cpp b/libopie2/opiecore/device/odevice_yopy.cpp
index a76f90b..d241db8 100644
--- a/libopie2/opiecore/device/odevice_yopy.cpp
+++ b/libopie2/opiecore/device/odevice_yopy.cpp
@@ -74,90 +74,90 @@ void Yopy::init()
{
d->m_vendorstr = "G.Mate";
d->m_vendor = Vendor_GMate;
d->m_modelstr = "Yopy3700";
d->m_model = Model_Yopy_3700;
d->m_rotation = Rot0;
d->m_systemstr = "Linupy";
d->m_system = System_Linupy;
QFile f ( "/etc/issue" );
if ( f. open ( IO_ReadOnly ) )
{
QTextStream ts ( &f );
ts.readLine();
d->m_sysverstr = ts. readLine();
f. close();
}
}
void Yopy::initButtons()
{
if ( d->m_buttons )
return ;
d->m_buttons = new QValueList <ODeviceButton>;
for ( uint i = 0; i < ( sizeof( yopy_buttons ) / sizeof( yopy_button ) ); i++ )
{
yopy_button *ib = yopy_buttons + i;
ODeviceButton b;
b. setKeycode ( ib->code );
b. setUserText ( QObject::tr ( "Button", ib->utext ) );
b. setPixmap ( Resource::loadPixmap ( ib->pix ) );
b. setFactoryPresetPressedAction
( OQCopMessage( makeChannel( ib->fpressedservice ), ib->fpressedaction ) );
b. setFactoryPresetHeldAction
( OQCopMessage( makeChannel( ib->fheldservice ), ib->fheldaction ) );
d->m_buttons->append ( b );
}
reloadButtonMapping();
QCopChannel *sysch = new QCopChannel( "QPE/System", this );
- connect( sysch, SIGNAL( received( const QCString &, const QByteArray & ) ),
- this, SLOT( systemMessage( const QCString &, const QByteArray & ) ) );
+ connect( sysch, SIGNAL( received(const QCString&,const QByteArray&) ),
+ this, SLOT( systemMessage(const QCString&,const QByteArray&) ) );
}
bool Yopy::suspend()
{
/* Opie for Yopy does not implement its own power management at the
moment. The public version runs parallel to X, and relies on the
existing power management features. */
return false;
}
bool Yopy::setDisplayBrightness( int bright )
{
/* The code here works, but is disabled as the current version runs
parallel to X, and relies on the existing backlight demon. */
#if 0
if ( QFile::exists( "/proc/sys/pm/light" ) )
{
int fd = ::open( "/proc/sys/pm/light", O_WRONLY );
if ( fd >= 0 )
{
if ( bright )
::write( fd, "1\n", 2 );
else
::write( fd, "0\n", 2 );
::close( fd );
return true;
}
}
#endif
return false;
}
int Yopy::displayBrightnessResolution() const
{
return 2;
}
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp
index 9d23a12..8ab3cbe 100644
--- a/libopie2/opiecore/device/odevice_zaurus.cpp
+++ b/libopie2/opiecore/device/odevice_zaurus.cpp
@@ -207,98 +207,98 @@ void Zaurus::init()
case Model_Zaurus_SLB600:
case Model_Zaurus_SL5500:
case Model_Zaurus_SL5000:
default:
d->m_rotation = Rot270;
break;
}
m_leds [0] = Led_Off;
}
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_SLC7x0:
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 ( Resource::loadPixmap ( zb->pix ));
b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( zb->fpressedservice ),
zb->fpressedaction ));
b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( zb->fheldservice ),
zb->fheldaction ));
d->m_buttons->append ( b );
}
reloadButtonMapping();
QCopChannel *sysch = new QCopChannel ( "QPE/System", this );
- connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )),
- this, SLOT( systemMessage ( const QCString &, const QByteArray & )));
+ connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)),
+ this, SLOT( systemMessage(const QCString&,const QByteArray&)));
}
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
//#include <asm/sharp_char.h> // including kernel headers is evil ...
#define SHARP_DEV_IOCTL_COMMAND_START 0x5680
#define SHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START)
#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START)
#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */
#define SHARP_BUZ_KEYSOUND 2 /* key sound */
#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */
/* --- for SHARP_BUZZER device --- */
//#define SHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START)
//#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START)
#define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1)
#define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2)
#define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3)
#define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4)
#define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5)
//#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */
//#define SHARP_BUZ_KEYSOUND 2 /* key sound */
//#define SHARP_PDA_ILLCLICKSOUND 3 /* illegal click */
//#define SHARP_PDA_WARNSOUND 4 /* warning occurred */
//#define SHARP_PDA_ERRORSOUND 5 /* error occurred */
//#define SHARP_PDA_CRITICALSOUND 6 /* critical error occurred */
//#define SHARP_PDA_SYSSTARTSOUND 7 /* system start */
//#define SHARP_PDA_SYSTEMENDSOUND 8 /* system shutdown */
//#define SHARP_PDA_APPSTART 9 /* application start */
//#define SHARP_PDA_APPQUIT 10 /* application ends */
//#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */
//#define SHARP_BUZ_DAILY_ALARM 12 /* daily alarm */
//#define SHARP_BUZ_GOT_PHONE_CALL 13 /* phone call sound */
//#define SHARP_BUZ_GOT_MAIL 14 /* mail sound */
//
#define SHARP_LED_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START)
#define SHARP_LED_SETSTATUS (SHARP_LED_IOCTL_START+1)
diff --git a/libopie2/opiecore/oprocess.cpp b/libopie2/opiecore/oprocess.cpp
index 0a361a1..6349c83 100644
--- a/libopie2/opiecore/oprocess.cpp
+++ b/libopie2/opiecore/oprocess.cpp
@@ -627,118 +627,118 @@ int OProcess::childError( int fdno )
if ( 0 < len )
emit receivedStderr( this, buffer, len );
return len;
}
int OProcess::setupCommunication( Communication comm )
{
int ok;
communication = comm;
ok = 1;
if ( comm & Stdin )
ok &= socketpair( AF_UNIX, SOCK_STREAM, 0, in ) >= 0;
if ( comm & Stdout )
ok &= socketpair( AF_UNIX, SOCK_STREAM, 0, out ) >= 0;
if ( comm & Stderr )
ok &= socketpair( AF_UNIX, SOCK_STREAM, 0, err ) >= 0;
return ok;
}
int OProcess::commSetupDoneP()
{
int ok = 1;
if ( communication != NoCommunication )
{
if ( communication & Stdin )
close( in[ 0 ] );
if ( communication & Stdout )
close( out[ 1 ] );
if ( communication & Stderr )
close( err[ 1 ] );
// Don't create socket notifiers and set the sockets non-blocking if
// blocking is requested.
if ( run_mode == Block )
return ok;
if ( communication & Stdin )
{
// ok &= (-1 != fcntl(in[1], F_SETFL, O_NONBLOCK));
innot = new QSocketNotifier( in[ 1 ], QSocketNotifier::Write, this );
CHECK_PTR( innot );
innot->setEnabled( false ); // will be enabled when data has to be sent
- QObject::connect( innot, SIGNAL( activated( int ) ),
- this, SLOT( slotSendData( int ) ) );
+ QObject::connect( innot, SIGNAL( activated(int) ),
+ this, SLOT( slotSendData(int) ) );
}
if ( communication & Stdout )
{
// ok &= (-1 != fcntl(out[0], F_SETFL, O_NONBLOCK));
outnot = new QSocketNotifier( out[ 0 ], QSocketNotifier::Read, this );
CHECK_PTR( outnot );
- QObject::connect( outnot, SIGNAL( activated( int ) ),
- this, SLOT( slotChildOutput( int ) ) );
+ QObject::connect( outnot, SIGNAL( activated(int) ),
+ this, SLOT( slotChildOutput(int) ) );
if ( communication & NoRead )
suspend();
}
if ( communication & Stderr )
{
// ok &= (-1 != fcntl(err[0], F_SETFL, O_NONBLOCK));
errnot = new QSocketNotifier( err[ 0 ], QSocketNotifier::Read, this );
CHECK_PTR( errnot );
- QObject::connect( errnot, SIGNAL( activated( int ) ),
- this, SLOT( slotChildError( int ) ) );
+ QObject::connect( errnot, SIGNAL( activated(int) ),
+ this, SLOT( slotChildError(int) ) );
}
}
return ok;
}
int OProcess::commSetupDoneC()
{
int ok = 1;
struct linger so;
memset( &so, 0, sizeof( so ) );
if ( communication & Stdin )
close( in[ 1 ] );
if ( communication & Stdout )
close( out[ 0 ] );
if ( communication & Stderr )
close( err[ 0 ] );
if ( communication & Stdin )
ok &= dup2( in[ 0 ], STDIN_FILENO ) != -1;
else
{
int null_fd = open( "/dev/null", O_RDONLY );
ok &= dup2( null_fd, STDIN_FILENO ) != -1;
close( null_fd );
}
if ( communication & Stdout )
{
ok &= dup2( out[ 1 ], STDOUT_FILENO ) != -1;
ok &= !setsockopt( out[ 1 ], SOL_SOCKET, SO_LINGER, ( char* ) & so, sizeof( so ) );
}
else
{
int null_fd = open( "/dev/null", O_WRONLY );
ok &= dup2( null_fd, STDOUT_FILENO ) != -1;
close( null_fd );
}
if ( communication & Stderr )
{
ok &= dup2( err[ 1 ], STDERR_FILENO ) != -1;
ok &= !setsockopt( err[ 1 ], SOL_SOCKET, SO_LINGER, reinterpret_cast<char *>( &so ), sizeof( so ) );
}
else
{
int null_fd = open( "/dev/null", O_WRONLY );
ok &= dup2( null_fd, STDERR_FILENO ) != -1;
close( null_fd );
}