Qtopia library API Documentation

custom-sharp.h

00001 /**********************************************************************
00002 ** Copyright (C) 2000-2002 Trolltech AS.  All rights reserved.
00003 **
00004 ** This file is part of the Qtopia Environment.
00005 **
00006 ** This file may be distributed and/or modified under the terms of the
00007 ** GNU General Public License version 2 as published by the Free Software
00008 ** Foundation and appearing in the file LICENSE.GPL included in the
00009 ** packaging of this file.
00010 **
00011 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00012 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00013 **
00014 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
00015 **
00016 ** Contact info@trolltech.com if any conditions of this licensing are
00017 ** not clear to you.
00018 **
00019 **********************************************************************/
00020 
00021 #define QPE_NEED_CALIBRATION
00022 #define QPE_OWNAPM
00023 #define QPE_HAVE_TOGGLELIGHT
00024 #define QPE_NOCIBAUD
00025 #define QPE_STARTMENU
00026 #define OPIE_NEW_MALLOC
00027 #define USE_REALTIME_AUDIO_THREAD
00028 #define OPIE_NO_SOUND_PCM_READ_BITS
00029 
00030 #include <asm/sharp_apm.h>
00031 #ifndef APM_IOC_BATTERY_BACK_CHK
00032 #define APM_IOC_BATTERY_BACK_CHK       _IO(APM_IOC_MAGIC, 32)
00033 #endif
00034 #ifndef APM_IOC_BATTERY_MAIN_CHK
00035 #define APM_IOC_BATTERY_MAIN_CHK       _IO(APM_IOC_MAGIC, 33)
00036 #endif
00037 
00038 #include <unistd.h>
00039 #include <stdio.h>
00040 #include <signal.h>
00041 #include <fcntl.h>
00042 #include <sys/ioctl.h>
00043 
00044 
00045 #include <sys/ioctl.h>
00046 #include <asm/sharp_char.h>
00047 
00048 #define QPE_HAVE_MEMALERTER
00049 
00050 #define QPE_MEMALERTER_IMPL \
00051 static void sig_handler(int sig) \
00052 { \
00053     switch (sig) { \
00054     case SIGHUP: \
00055   memstate = VeryLow; \
00056   break; \
00057     case SIGUSR1: \
00058   memstate = Normal; \
00059   break; \
00060     case SIGUSR2: \
00061   memstate = Low; \
00062   break; \
00063     } \
00064 } \
00065 static void initMemalerter() \
00066 { \
00067     struct sigaction sa; \
00068     memset(&sa, '\0', sizeof sa); \
00069     sa.sa_handler = sig_handler; \
00070     sa.sa_flags = SA_RESTART; \
00071     if (sigaction(SIGHUP, &sa, NULL) < 0) { \
00072   return; \
00073     } \
00074     if (sigaction(SIGUSR1, &sa, NULL) < 0) { \
00075   return; \
00076     } \
00077     if (sigaction(SIGUSR2, &sa, NULL) < 0) { \
00078   return; \
00079     } \
00080     FILE *fo = fopen("/proc/sys/vm/freepg_signal_proc", "w"); \
00081      \
00082     if (!fo) \
00083         return; \
00084     fprintf(fo, "qpe\n"); \
00085     fclose(fo); \
00086 }
00087 
00088 #define QPE_INITIAL_NUMLOCK_STATE \
00089 { \
00090     bool numLock = FALSE; \
00091     sharp_kbdctl_modifstat  st; \
00092     int dev = ::open("/dev/sharp_kbdctl", O_RDWR); \
00093     if( dev >= 0 ) { \
00094   memset(&st, 0, sizeof(st)); \
00095   st.which = 3; \
00096                 int ret = ioctl(dev, SHARP_KBDCTL_GETMODIFSTAT, (char*)&st); \
00097   if( !ret ) \
00098       numLock = (bool)st.stat; \
00099   ::close(dev); \
00100     } \
00101     return numLock; \
00102 }
KDE Logo
This file is part of the documentation for OPIE Version 1.5.5.
Documentation copyright © 1997-2003 the KDE developers. 2003 OPIE developers
Generated on Tue Feb 10 20:24:04 2004 by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2001