-int console_type = BEEP_TYPE_CONSOLE;
-char *console_device = NULL;
-
-
-void do_beep(int freq) {
- if (console_type == BEEP_TYPE_CONSOLE) {
- if(ioctl(console_fd, KIOCSOUND, freq != 0
- ? (int)(CLOCK_TICK_RATE/freq)
- : freq) < 0) {
- printf("\a"); /* Output the only beep we can, in an effort to fall back on usefulness */
- perror("ioctl");
- }
- } else {
- /* BEEP_TYPE_EVDEV */
- struct input_event e;
-
- e.type = EV_SND;
- e.code = SND_TONE;
- e.value = freq;
-
- write(console_fd, &e, sizeof(struct input_event));
- }
-}
-