summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-04-24 19:37:47 (UTC)
committer llornkcor <llornkcor>2002-04-24 19:37:47 (UTC)
commitfeaa245515b0746f6f70f590411c38e0a54c88ee (patch) (unidiff)
tree352ab6e61ea8e773d9f08f77db0ca36984c62c1d
parent17eb865ad8248b1f47c565b074b9b6bbbd44935b (diff)
downloadopie-feaa245515b0746f6f70f590411c38e0a54c88ee.zip
opie-feaa245515b0746f6f70f590411c38e0a54c88ee.tar.gz
opie-feaa245515b0746f6f70f590411c38e0a54c88ee.tar.bz2
enable keyclicks and touchsound on zaurus
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--library/custom-sharp.h33
1 files changed, 18 insertions, 15 deletions
diff --git a/library/custom-sharp.h b/library/custom-sharp.h
index f65d474..08f8a6f 100644
--- a/library/custom-sharp.h
+++ b/library/custom-sharp.h
@@ -36,13 +36,13 @@
36#include <fcntl.h> 36#include <fcntl.h>
37#include <sys/ioctl.h> 37#include <sys/ioctl.h>
38 38
39#define SHARP_DEV_IOCTL_COMMAND_START 0x5680 39#define SHARP_DEV_IOCTL_COMMAND_START 0x5680
40 40
41/* --- for SHARP_BUZZER device --- */ 41/* --- for SHARP_BUZZER device --- */
42 #defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) 42#define SHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START)
43#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) 43#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START)
44#define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1) 44#define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1)
45#define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2) 45#define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2)
46#define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3) 46#define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3)
47#define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4) 47#define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4)
48#define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5) 48#define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5)
@@ -67,12 +67,15 @@
67{ \ 67{ \
68 static int fd = open( "/dev/sharp_buz", O_RDWR|O_NONBLOCK ); \ 68 static int fd = open( "/dev/sharp_buz", O_RDWR|O_NONBLOCK ); \
69 ioctl( fd, SHARP_BUZZER_MAKESOUND, sound ); \ 69 ioctl( fd, SHARP_BUZZER_MAKESOUND, sound ); \
70} 70}
71 71
72#define CUSTOM_SOUND_ALARM CUSTOM_BUZZER( SHARP_BUZ_SCHEDULE_ALARM ) 72#define CUSTOM_SOUND_ALARM CUSTOM_BUZZER( SHARP_BUZ_SCHEDULE_ALARM )
73#define CUSTOM_SOUND_KEYCLICK CUSTOM_BUZZER( SHARP_BUZ_KEYSOUND )
74#define CUSTOM_SOUND_TOUCH CUSTOM_BUZZER( SHARP_BUZ_TOUCHSOUND )
75
73 76
74#include <sys/ioctl.h> 77#include <sys/ioctl.h>
75#include <asm/sharp_char.h> 78#include <asm/sharp_char.h>
76 79
77// a bit awkward, as this value is defined in emailclient.cpp aswell... 80// a bit awkward, as this value is defined in emailclient.cpp aswell...
78#define LED_MAIL 0 81#define LED_MAIL 0
@@ -94,36 +97,36 @@
94 97
95#define QPE_MEMALERTER_IMPL \ 98#define QPE_MEMALERTER_IMPL \
96static void sig_handler(int sig) \ 99static void sig_handler(int sig) \
97{ \ 100{ \
98 switch (sig) { \ 101 switch (sig) { \
99 case SIGHUP: \ 102 case SIGHUP: \
100 memstate = VeryLow; \ 103 memstate = VeryLow; \
101 break; \ 104 break; \
102 case SIGUSR1: \ 105 case SIGUSR1: \
103 memstate = Normal; \ 106 memstate = Normal; \
104 break; \ 107 break; \
105 case SIGUSR2: \ 108 case SIGUSR2: \
106 memstate = Low; \ 109 memstate = Low; \
107 break; \ 110 break; \
108 } \ 111 } \
109} \ 112} \
110static void initMemalerter() \ 113static void initMemalerter() \
111{ \ 114{ \
112 struct sigaction sa; \ 115 struct sigaction sa; \
113 memset(&sa, '\0', sizeof sa); \ 116 memset(&sa, '\0', sizeof sa); \
114 sa.sa_handler = sig_handler; \ 117 sa.sa_handler = sig_handler; \
115 sa.sa_flags = SA_RESTART; \ 118 sa.sa_flags = SA_RESTART; \
116 if (sigaction(SIGHUP, &sa, NULL) < 0) { \ 119 if (sigaction(SIGHUP, &sa, NULL) < 0) { \
117 return; \ 120 return; \
118 } \ 121 } \
119 if (sigaction(SIGUSR1, &sa, NULL) < 0) { \ 122 if (sigaction(SIGUSR1, &sa, NULL) < 0) { \
120 return; \ 123 return; \
121 } \ 124 } \
122 if (sigaction(SIGUSR2, &sa, NULL) < 0) { \ 125 if (sigaction(SIGUSR2, &sa, NULL) < 0) { \
123 return; \ 126 return; \
124 } \ 127 } \
125 FILE *fo = fopen("/proc/sys/vm/freepg_signal_proc", "w"); \ 128 FILE *fo = fopen("/proc/sys/vm/freepg_signal_proc", "w"); \
126 \ 129 \
127 if (!fo) \ 130 if (!fo) \
128 return; \ 131 return; \
129 fprintf(fo, "qpe\n"); \ 132 fprintf(fo, "qpe\n"); \
@@ -133,15 +136,15 @@ static void initMemalerter() \
133#define QPE_INITIAL_NUMLOCK_STATE \ 136#define QPE_INITIAL_NUMLOCK_STATE \
134{ \ 137{ \
135 bool numLock = FALSE; \ 138 bool numLock = FALSE; \
136 sharp_kbdctl_modifstat st; \ 139 sharp_kbdctl_modifstat st; \
137 int dev = ::open("/dev/sharp_kbdctl", O_RDWR); \ 140 int dev = ::open("/dev/sharp_kbdctl", O_RDWR); \
138 if( dev >= 0 ) { \ 141 if( dev >= 0 ) { \
139 memset(&st, 0, sizeof(st)); \ 142 memset(&st, 0, sizeof(st)); \
140 st.which = 3; \ 143 st.which = 3; \
141 int ret = ioctl(dev, SHARP_KBDCTL_GETMODIFSTAT, (char*)&st); \ 144 int ret = ioctl(dev, SHARP_KBDCTL_GETMODIFSTAT, (char*)&st); \
142 if( !ret ) \ 145 if( !ret ) \
143 numLock = (bool)st.stat; \ 146 numLock = (bool)st.stat; \
144 ::close(dev); \ 147 ::close(dev); \
145 } \ 148 } \
146 return numLock; \ 149 return numLock; \
147} 150}