-rw-r--r-- | library/custom-sharp.h | 33 |
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 | |||
@@ -38,9 +38,9 @@ | |||
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) |
@@ -69,8 +69,11 @@ | |||
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 | ||
@@ -96,16 +99,16 @@ | |||
96 | static void sig_handler(int sig) \ | 99 | static 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 | } \ |
110 | static void initMemalerter() \ | 113 | static void initMemalerter() \ |
111 | { \ | 114 | { \ |
@@ -113,15 +116,15 @@ static void initMemalerter() \ | |||
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) \ |
@@ -135,13 +138,13 @@ static void initMemalerter() \ | |||
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 | } |