author | llornkcor <llornkcor> | 2002-04-06 12:59:24 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-04-06 12:59:24 (UTC) |
commit | c1555c5c6975c60af83dc9c66d19b89a4244d782 (patch) (unidiff) | |
tree | a7305ba9eae037ec5cb302002b6d16e8d0cf760e | |
parent | e2215dca190a9a18aed9be71b1872a3704605611 (diff) | |
download | opie-c1555c5c6975c60af83dc9c66d19b89a4244d782.zip opie-c1555c5c6975c60af83dc9c66d19b89a4244d782.tar.gz opie-c1555c5c6975c60af83dc9c66d19b89a4244d782.tar.bz2 |
added TT's copyright back into custom-sharp.h, (not sure why it was removed). and added symlink to it named custom.h for building a Zaurus
specific Opie. This is needed as Zaurus has (of course) specific hardware defines.
-rw-r--r-- | library/custom-sharp.h | 20 | ||||
-rw-r--r-- | library/custom.h | 147 |
2 files changed, 167 insertions, 0 deletions
diff --git a/library/custom-sharp.h b/library/custom-sharp.h index a149bbd..f65d474 100644 --- a/library/custom-sharp.h +++ b/library/custom-sharp.h | |||
@@ -1,96 +1,116 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of the Qtopia Environment. | ||
5 | ** | ||
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 | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
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. | ||
13 | ** | ||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
15 | ** | ||
16 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
17 | ** not clear to you. | ||
18 | ** | ||
19 | **********************************************************************/ | ||
20 | |||
1 | #define QPE_OWNAPM | 21 | #define QPE_OWNAPM |
2 | #define QPE_HAVE_TOGGLELIGHT | 22 | #define QPE_HAVE_TOGGLELIGHT |
3 | #define QPE_NOCIBAUD | 23 | #define QPE_NOCIBAUD |
4 | #define QPE_STARTMENU | 24 | #define QPE_STARTMENU |
5 | #include <asm/sharp_apm.h> | 25 | #include <asm/sharp_apm.h> |
6 | #ifndef APM_IOC_BATTERY_BACK_CHK | 26 | #ifndef APM_IOC_BATTERY_BACK_CHK |
7 | #define APM_IOC_BATTERY_BACK_CHK _IO(APM_IOC_MAGIC, 32) | 27 | #define APM_IOC_BATTERY_BACK_CHK _IO(APM_IOC_MAGIC, 32) |
8 | #endif | 28 | #endif |
9 | #ifndef APM_IOC_BATTERY_MAIN_CHK | 29 | #ifndef APM_IOC_BATTERY_MAIN_CHK |
10 | #define APM_IOC_BATTERY_MAIN_CHK _IO(APM_IOC_MAGIC, 33) | 30 | #define APM_IOC_BATTERY_MAIN_CHK _IO(APM_IOC_MAGIC, 33) |
11 | #endif | 31 | #endif |
12 | 32 | ||
13 | #include <unistd.h> | 33 | #include <unistd.h> |
14 | #include <stdio.h> | 34 | #include <stdio.h> |
15 | #include <signal.h> | 35 | #include <signal.h> |
16 | #include <fcntl.h> | 36 | #include <fcntl.h> |
17 | #include <sys/ioctl.h> | 37 | #include <sys/ioctl.h> |
18 | 38 | ||
19 | #define SHARP_DEV_IOCTL_COMMAND_START 0x5680 | 39 | #define SHARP_DEV_IOCTL_COMMAND_START 0x5680 |
20 | 40 | ||
21 | /* --- for SHARP_BUZZER device --- */ | 41 | /* --- for SHARP_BUZZER device --- */ |
22 | #defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) | 42 | #defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) |
23 | #define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) | 43 | #define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) |
24 | #define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1) | 44 | #define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1) |
25 | #define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2) | 45 | #define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2) |
26 | #define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3) | 46 | #define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3) |
27 | #define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4) | 47 | #define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4) |
28 | #define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5) | 48 | #define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5) |
29 | 49 | ||
30 | #define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ | 50 | #define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ |
31 | #define SHARP_BUZ_KEYSOUND 2 /* key sound */ | 51 | #define SHARP_BUZ_KEYSOUND 2 /* key sound */ |
32 | #define SHARP_PDA_ILLCLICKSOUND 3 /* illegal click */ | 52 | #define SHARP_PDA_ILLCLICKSOUND 3 /* illegal click */ |
33 | #define SHARP_PDA_WARNSOUND 4 /* warning occurred */ | 53 | #define SHARP_PDA_WARNSOUND 4 /* warning occurred */ |
34 | #define SHARP_PDA_ERRORSOUND 5 /* error occurred */ | 54 | #define SHARP_PDA_ERRORSOUND 5 /* error occurred */ |
35 | #define SHARP_PDA_CRITICALSOUND 6 /* critical error occurred */ | 55 | #define SHARP_PDA_CRITICALSOUND 6 /* critical error occurred */ |
36 | #define SHARP_PDA_SYSSTARTSOUND 7 /* system start */ | 56 | #define SHARP_PDA_SYSSTARTSOUND 7 /* system start */ |
37 | #define SHARP_PDA_SYSTEMENDSOUND 8 /* system shutdown */ | 57 | #define SHARP_PDA_SYSTEMENDSOUND 8 /* system shutdown */ |
38 | #define SHARP_PDA_APPSTART 9 /* application start */ | 58 | #define SHARP_PDA_APPSTART 9 /* application start */ |
39 | #define SHARP_PDA_APPQUIT 10 /* application ends */ | 59 | #define SHARP_PDA_APPQUIT 10 /* application ends */ |
40 | #define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ | 60 | #define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ |
41 | #define SHARP_BUZ_DAILY_ALARM 12 /* daily alarm */ | 61 | #define SHARP_BUZ_DAILY_ALARM 12 /* daily alarm */ |
42 | #define SHARP_BUZ_GOT_PHONE_CALL 13 /* phone call sound */ | 62 | #define SHARP_BUZ_GOT_PHONE_CALL 13 /* phone call sound */ |
43 | #define SHARP_BUZ_GOT_MAIL 14 /* mail sound */ | 63 | #define SHARP_BUZ_GOT_MAIL 14 /* mail sound */ |
44 | 64 | ||
45 | 65 | ||
46 | #define CUSTOM_BUZZER( sound ) \ | 66 | #define CUSTOM_BUZZER( sound ) \ |
47 | { \ | 67 | { \ |
48 | static int fd = open( "/dev/sharp_buz", O_RDWR|O_NONBLOCK ); \ | 68 | static int fd = open( "/dev/sharp_buz", O_RDWR|O_NONBLOCK ); \ |
49 | ioctl( fd, SHARP_BUZZER_MAKESOUND, sound ); \ | 69 | ioctl( fd, SHARP_BUZZER_MAKESOUND, sound ); \ |
50 | } | 70 | } |
51 | 71 | ||
52 | #define CUSTOM_SOUND_ALARM CUSTOM_BUZZER( SHARP_BUZ_SCHEDULE_ALARM ) | 72 | #define CUSTOM_SOUND_ALARM CUSTOM_BUZZER( SHARP_BUZ_SCHEDULE_ALARM ) |
53 | 73 | ||
54 | #include <sys/ioctl.h> | 74 | #include <sys/ioctl.h> |
55 | #include <asm/sharp_char.h> | 75 | #include <asm/sharp_char.h> |
56 | 76 | ||
57 | // a bit awkward, as this value is defined in emailclient.cpp aswell... | 77 | // a bit awkward, as this value is defined in emailclient.cpp aswell... |
58 | #define LED_MAIL 0 | 78 | #define LED_MAIL 0 |
59 | #define SHARP_LED_MAIL 9 | 79 | #define SHARP_LED_MAIL 9 |
60 | 80 | ||
61 | #define CUSTOM_LEDS( led, status ) \ | 81 | #define CUSTOM_LEDS( led, status ) \ |
62 | { \ | 82 | { \ |
63 | if ( led == LED_MAIL ) \ | 83 | if ( led == LED_MAIL ) \ |
64 | led = SHARP_LED_MAIL; \ | 84 | led = SHARP_LED_MAIL; \ |
65 | static int fd = open( "/dev/sharp_led", O_RDWR|O_NONBLOCK ); \ | 85 | static int fd = open( "/dev/sharp_led", O_RDWR|O_NONBLOCK ); \ |
66 | sharp_led_status leds; \ | 86 | sharp_led_status leds; \ |
67 | memset(&leds, 0, sizeof(leds)); \ | 87 | memset(&leds, 0, sizeof(leds)); \ |
68 | leds.which = led; \ | 88 | leds.which = led; \ |
69 | leds.status = status; \ | 89 | leds.status = status; \ |
70 | ioctl( fd, SHARP_LED_SETSTATUS, (char*)&leds ); \ | 90 | ioctl( fd, SHARP_LED_SETSTATUS, (char*)&leds ); \ |
71 | } | 91 | } |
72 | 92 | ||
73 | #define QPE_HAVE_MEMALERTER | 93 | #define QPE_HAVE_MEMALERTER |
74 | 94 | ||
75 | #define QPE_MEMALERTER_IMPL \ | 95 | #define QPE_MEMALERTER_IMPL \ |
76 | static void sig_handler(int sig) \ | 96 | static void sig_handler(int sig) \ |
77 | { \ | 97 | { \ |
78 | switch (sig) { \ | 98 | switch (sig) { \ |
79 | case SIGHUP: \ | 99 | case SIGHUP: \ |
80 | memstate = VeryLow; \ | 100 | memstate = VeryLow; \ |
81 | break; \ | 101 | break; \ |
82 | case SIGUSR1: \ | 102 | case SIGUSR1: \ |
83 | memstate = Normal; \ | 103 | memstate = Normal; \ |
84 | break; \ | 104 | break; \ |
85 | case SIGUSR2: \ | 105 | case SIGUSR2: \ |
86 | memstate = Low; \ | 106 | memstate = Low; \ |
87 | break; \ | 107 | break; \ |
88 | } \ | 108 | } \ |
89 | } \ | 109 | } \ |
90 | static void initMemalerter() \ | 110 | static void initMemalerter() \ |
91 | { \ | 111 | { \ |
92 | struct sigaction sa; \ | 112 | struct sigaction sa; \ |
93 | memset(&sa, '\0', sizeof sa); \ | 113 | memset(&sa, '\0', sizeof sa); \ |
94 | sa.sa_handler = sig_handler; \ | 114 | sa.sa_handler = sig_handler; \ |
95 | sa.sa_flags = SA_RESTART; \ | 115 | sa.sa_flags = SA_RESTART; \ |
96 | if (sigaction(SIGHUP, &sa, NULL) < 0) { \ | 116 | if (sigaction(SIGHUP, &sa, NULL) < 0) { \ |
diff --git a/library/custom.h b/library/custom.h new file mode 100644 index 0000000..f65d474 --- a/dev/null +++ b/library/custom.h | |||
@@ -0,0 +1,147 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of the Qtopia Environment. | ||
5 | ** | ||
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 | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
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. | ||
13 | ** | ||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
15 | ** | ||
16 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
17 | ** not clear to you. | ||
18 | ** | ||
19 | **********************************************************************/ | ||
20 | |||
21 | #define QPE_OWNAPM | ||
22 | #define QPE_HAVE_TOGGLELIGHT | ||
23 | #define QPE_NOCIBAUD | ||
24 | #define QPE_STARTMENU | ||
25 | #include <asm/sharp_apm.h> | ||
26 | #ifndef APM_IOC_BATTERY_BACK_CHK | ||
27 | #define APM_IOC_BATTERY_BACK_CHK _IO(APM_IOC_MAGIC, 32) | ||
28 | #endif | ||
29 | #ifndef APM_IOC_BATTERY_MAIN_CHK | ||
30 | #define APM_IOC_BATTERY_MAIN_CHK _IO(APM_IOC_MAGIC, 33) | ||
31 | #endif | ||
32 | |||
33 | #include <unistd.h> | ||
34 | #include <stdio.h> | ||
35 | #include <signal.h> | ||
36 | #include <fcntl.h> | ||
37 | #include <sys/ioctl.h> | ||
38 | |||
39 | #define SHARP_DEV_IOCTL_COMMAND_START 0x5680 | ||
40 | |||
41 | /* --- for SHARP_BUZZER device --- */ | ||
42 | #defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) | ||
43 | #define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) | ||
44 | #define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1) | ||
45 | #define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2) | ||
46 | #define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3) | ||
47 | #define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4) | ||
48 | #define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5) | ||
49 | |||
50 | #define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ | ||
51 | #define SHARP_BUZ_KEYSOUND 2 /* key sound */ | ||
52 | #define SHARP_PDA_ILLCLICKSOUND 3 /* illegal click */ | ||
53 | #define SHARP_PDA_WARNSOUND 4 /* warning occurred */ | ||
54 | #define SHARP_PDA_ERRORSOUND 5 /* error occurred */ | ||
55 | #define SHARP_PDA_CRITICALSOUND 6 /* critical error occurred */ | ||
56 | #define SHARP_PDA_SYSSTARTSOUND 7 /* system start */ | ||
57 | #define SHARP_PDA_SYSTEMENDSOUND 8 /* system shutdown */ | ||
58 | #define SHARP_PDA_APPSTART 9 /* application start */ | ||
59 | #define SHARP_PDA_APPQUIT 10 /* application ends */ | ||
60 | #define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ | ||
61 | #define SHARP_BUZ_DAILY_ALARM 12 /* daily alarm */ | ||
62 | #define SHARP_BUZ_GOT_PHONE_CALL 13 /* phone call sound */ | ||
63 | #define SHARP_BUZ_GOT_MAIL 14 /* mail sound */ | ||
64 | |||
65 | |||
66 | #define CUSTOM_BUZZER( sound ) \ | ||
67 | { \ | ||
68 | static int fd = open( "/dev/sharp_buz", O_RDWR|O_NONBLOCK ); \ | ||
69 | ioctl( fd, SHARP_BUZZER_MAKESOUND, sound ); \ | ||
70 | } | ||
71 | |||
72 | #define CUSTOM_SOUND_ALARM CUSTOM_BUZZER( SHARP_BUZ_SCHEDULE_ALARM ) | ||
73 | |||
74 | #include <sys/ioctl.h> | ||
75 | #include <asm/sharp_char.h> | ||
76 | |||
77 | // a bit awkward, as this value is defined in emailclient.cpp aswell... | ||
78 | #define LED_MAIL 0 | ||
79 | #define SHARP_LED_MAIL 9 | ||
80 | |||
81 | #define CUSTOM_LEDS( led, status ) \ | ||
82 | { \ | ||
83 | if ( led == LED_MAIL ) \ | ||
84 | led = SHARP_LED_MAIL; \ | ||
85 | static int fd = open( "/dev/sharp_led", O_RDWR|O_NONBLOCK ); \ | ||
86 | sharp_led_status leds; \ | ||
87 | memset(&leds, 0, sizeof(leds)); \ | ||
88 | leds.which = led; \ | ||
89 | leds.status = status; \ | ||
90 | ioctl( fd, SHARP_LED_SETSTATUS, (char*)&leds ); \ | ||
91 | } | ||
92 | |||
93 | #define QPE_HAVE_MEMALERTER | ||
94 | |||
95 | #define QPE_MEMALERTER_IMPL \ | ||
96 | static void sig_handler(int sig) \ | ||
97 | { \ | ||
98 | switch (sig) { \ | ||
99 | case SIGHUP: \ | ||
100 | memstate = VeryLow; \ | ||
101 | break; \ | ||
102 | case SIGUSR1: \ | ||
103 | memstate = Normal; \ | ||
104 | break; \ | ||
105 | case SIGUSR2: \ | ||
106 | memstate = Low; \ | ||
107 | break; \ | ||
108 | } \ | ||
109 | } \ | ||
110 | static void initMemalerter() \ | ||
111 | { \ | ||
112 | struct sigaction sa; \ | ||
113 | memset(&sa, '\0', sizeof sa); \ | ||
114 | sa.sa_handler = sig_handler; \ | ||
115 | sa.sa_flags = SA_RESTART; \ | ||
116 | if (sigaction(SIGHUP, &sa, NULL) < 0) { \ | ||
117 | return; \ | ||
118 | } \ | ||
119 | if (sigaction(SIGUSR1, &sa, NULL) < 0) { \ | ||
120 | return; \ | ||
121 | } \ | ||
122 | if (sigaction(SIGUSR2, &sa, NULL) < 0) { \ | ||
123 | return; \ | ||
124 | } \ | ||
125 | FILE *fo = fopen("/proc/sys/vm/freepg_signal_proc", "w"); \ | ||
126 | \ | ||
127 | if (!fo) \ | ||
128 | return; \ | ||
129 | fprintf(fo, "qpe\n"); \ | ||
130 | fclose(fo); \ | ||
131 | } | ||
132 | |||
133 | #define QPE_INITIAL_NUMLOCK_STATE \ | ||
134 | { \ | ||
135 | bool numLock = FALSE; \ | ||
136 | sharp_kbdctl_modifstat st; \ | ||
137 | int dev = ::open("/dev/sharp_kbdctl", O_RDWR); \ | ||
138 | if( dev >= 0 ) { \ | ||
139 | memset(&st, 0, sizeof(st)); \ | ||
140 | st.which = 3; \ | ||
141 | int ret = ioctl(dev, SHARP_KBDCTL_GETMODIFSTAT, (char*)&st); \ | ||
142 | if( !ret ) \ | ||
143 | numLock = (bool)st.stat; \ | ||
144 | ::close(dev); \ | ||
145 | } \ | ||
146 | return numLock; \ | ||
147 | } | ||