1/* 2 * Copyright 1992 by Rich Murphey <Rich@Rice.edu> 3 * Copyright 1993 by David Dawes <dawes@xfree86.org> 4 * 5 * Permission to use, copy, modify, distribute, and sell this software and its 6 * documentation for any purpose is hereby granted without fee, provided that 7 * the above copyright notice appear in all copies and that both that 8 * copyright notice and this permission notice appear in supporting 9 * documentation, and that the names of Rich Murphey and David Dawes 10 * not be used in advertising or publicity pertaining to distribution of 11 * the software without specific, written prior permission. Rich Murphey and 12 * David Dawes make no representations about the suitability of this 13 * software for any purpose. It is provided "as is" without express or 14 * implied warranty. 15 * 16 * RICH MURPHEY AND DAVID DAWES DISCLAIM ALL WARRANTIES WITH REGARD TO 17 * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND 18 * FITNESS, IN NO EVENT SHALL RICH MURPHEY OR DAVID DAWES BE LIABLE FOR 19 * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER 20 * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF 21 * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 22 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 23 * 24 */ 25 26#ifdef HAVE_XORG_CONFIG_H 27#include <xorg-config.h> 28#endif 29 30#if defined (SYSCONS_SUPPORT) 31#include <sys/kbio.h> 32#endif 33 34#include <termios.h> 35 36#include "xf86.h" 37#include "xf86Priv.h" 38#include "xf86_OSlib.h" 39 40#ifdef WSCONS_SUPPORT 41#define KBD_FD(i) ((i).kbdFd != -1 ? (i).kbdFd : (i).consoleFd) 42#endif 43 44void 45xf86OSRingBell(int loudness, int pitch, int duration) 46{ 47#ifdef WSCONS_SUPPORT 48 struct wskbd_bell_data wsb; 49#endif 50 51 if (loudness && pitch) 52 { 53#ifdef PCCONS_SUPPORT 54 int data[2]; 55#endif 56 57 switch (xf86Info.consType) { 58 59#ifdef PCCONS_SUPPORT 60 case PCCONS: 61 data[0] = pitch; 62 data[1] = (duration * loudness) / 50; 63 ioctl(xf86Info.consoleFd, CONSOLE_X_BELL, data); 64 break; 65#endif 66#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) 67 case SYSCONS: 68 case PCVT: 69 ioctl(xf86Info.consoleFd, KDMKTONE, 70 ((1193190 / pitch) & 0xffff) | 71 (((unsigned long)duration*loudness/50)<<16)); 72 break; 73#endif 74#if defined (WSCONS_SUPPORT) 75 case WSCONS: 76 wsb.which = WSKBD_BELL_DOALL; 77 wsb.pitch = pitch; 78 wsb.period = duration; 79 wsb.volume = loudness; 80 ioctl(xf86Info.consoleFd, WSKBDIO_COMPLEXBELL, 81 &wsb); 82 break; 83#endif 84 } 85 } 86} 87