summaryrefslogtreecommitdiff
path: root/library/custom-sharp.h
Unidiff
Diffstat (limited to 'library/custom-sharp.h') (more/less context) (ignore whitespace changes)
-rw-r--r--library/custom-sharp.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/library/custom-sharp.h b/library/custom-sharp.h
index 3936875..b0e67b8 100644
--- a/library/custom-sharp.h
+++ b/library/custom-sharp.h
@@ -1,98 +1,102 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#define QPE_NEED_CALIBRATION 21#define QPE_NEED_CALIBRATION
22#define QPE_OWNAPM 22#define QPE_OWNAPM
23#define QPE_HAVE_TOGGLELIGHT 23#define QPE_HAVE_TOGGLELIGHT
24#define QPE_NOCIBAUD 24#define QPE_NOCIBAUD
25#define QPE_STARTMENU 25#define QPE_STARTMENU
26#define OPIE_NEW_MALLOC
27#define USE_REALTIME_AUDIO_THREAD
28#define OPIE_NO_SOUND_PCM_READ_BITS
29
26#include <asm/sharp_apm.h> 30#include <asm/sharp_apm.h>
27#ifndef APM_IOC_BATTERY_BACK_CHK 31#ifndef APM_IOC_BATTERY_BACK_CHK
28#define APM_IOC_BATTERY_BACK_CHK _IO(APM_IOC_MAGIC, 32) 32#define APM_IOC_BATTERY_BACK_CHK _IO(APM_IOC_MAGIC, 32)
29#endif 33#endif
30#ifndef APM_IOC_BATTERY_MAIN_CHK 34#ifndef APM_IOC_BATTERY_MAIN_CHK
31#define APM_IOC_BATTERY_MAIN_CHK _IO(APM_IOC_MAGIC, 33) 35#define APM_IOC_BATTERY_MAIN_CHK _IO(APM_IOC_MAGIC, 33)
32#endif 36#endif
33 37
34#include <unistd.h> 38#include <unistd.h>
35#include <stdio.h> 39#include <stdio.h>
36#include <signal.h> 40#include <signal.h>
37#include <fcntl.h> 41#include <fcntl.h>
38#include <sys/ioctl.h> 42#include <sys/ioctl.h>
39 43
40 44
41#include <sys/ioctl.h> 45#include <sys/ioctl.h>
42#include <asm/sharp_char.h> 46#include <asm/sharp_char.h>
43 47
44#define QPE_HAVE_MEMALERTER 48#define QPE_HAVE_MEMALERTER
45 49
46#define QPE_MEMALERTER_IMPL \ 50#define QPE_MEMALERTER_IMPL \
47static void sig_handler(int sig) \ 51static void sig_handler(int sig) \
48{ \ 52{ \
49 switch (sig) { \ 53 switch (sig) { \
50 case SIGHUP: \ 54 case SIGHUP: \
51 memstate = VeryLow; \ 55 memstate = VeryLow; \
52 break; \ 56 break; \
53 case SIGUSR1: \ 57 case SIGUSR1: \
54 memstate = Normal; \ 58 memstate = Normal; \
55 break; \ 59 break; \
56 case SIGUSR2: \ 60 case SIGUSR2: \
57 memstate = Low; \ 61 memstate = Low; \
58 break; \ 62 break; \
59 } \ 63 } \
60} \ 64} \
61static void initMemalerter() \ 65static void initMemalerter() \
62{ \ 66{ \
63 struct sigaction sa; \ 67 struct sigaction sa; \
64 memset(&sa, '\0', sizeof sa); \ 68 memset(&sa, '\0', sizeof sa); \
65 sa.sa_handler = sig_handler; \ 69 sa.sa_handler = sig_handler; \
66 sa.sa_flags = SA_RESTART; \ 70 sa.sa_flags = SA_RESTART; \
67 if (sigaction(SIGHUP, &sa, NULL) < 0) { \ 71 if (sigaction(SIGHUP, &sa, NULL) < 0) { \
68 return; \ 72 return; \
69 } \ 73 } \
70 if (sigaction(SIGUSR1, &sa, NULL) < 0) { \ 74 if (sigaction(SIGUSR1, &sa, NULL) < 0) { \
71 return; \ 75 return; \
72 } \ 76 } \
73 if (sigaction(SIGUSR2, &sa, NULL) < 0) { \ 77 if (sigaction(SIGUSR2, &sa, NULL) < 0) { \
74 return; \ 78 return; \
75 } \ 79 } \
76 FILE *fo = fopen("/proc/sys/vm/freepg_signal_proc", "w"); \ 80 FILE *fo = fopen("/proc/sys/vm/freepg_signal_proc", "w"); \
77 \ 81 \
78 if (!fo) \ 82 if (!fo) \
79 return; \ 83 return; \
80 fprintf(fo, "qpe\n"); \ 84 fprintf(fo, "qpe\n"); \
81 fclose(fo); \ 85 fclose(fo); \
82} 86}
83 87
84#define QPE_INITIAL_NUMLOCK_STATE \ 88#define QPE_INITIAL_NUMLOCK_STATE \
85{ \ 89{ \
86 bool numLock = FALSE; \ 90 bool numLock = FALSE; \
87 sharp_kbdctl_modifstat st; \ 91 sharp_kbdctl_modifstat st; \
88 int dev = ::open("/dev/sharp_kbdctl", O_RDWR); \ 92 int dev = ::open("/dev/sharp_kbdctl", O_RDWR); \
89 if( dev >= 0 ) { \ 93 if( dev >= 0 ) { \
90 memset(&st, 0, sizeof(st)); \ 94 memset(&st, 0, sizeof(st)); \
91 st.which = 3; \ 95 st.which = 3; \
92 int ret = ioctl(dev, SHARP_KBDCTL_GETMODIFSTAT, (char*)&st); \ 96 int ret = ioctl(dev, SHARP_KBDCTL_GETMODIFSTAT, (char*)&st); \
93 if( !ret ) \ 97 if( !ret ) \
94 numLock = (bool)st.stat; \ 98 numLock = (bool)st.stat; \
95 ::close(dev); \ 99 ::close(dev); \
96 } \ 100 } \
97 return numLock; \ 101 return numLock; \
98} 102}