Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!ames!oliveb!sun!gorodish!guy From: guy%gorodish@Sun.COM (Guy Harris) Newsgroups: comp.unix.questions Subject: Re: Let the Sun-3 beep! How??? - (nf) Message-ID: <17041@sun.uucp> Date: Tue, 21-Apr-87 00:34:21 EST Article-I.D.: sun.17041 Posted: Tue Apr 21 00:34:21 1987 Date-Received: Wed, 22-Apr-87 01:37:48 EST References: <8200006@iaoobelix.UUCP> Sender: news@sun.uucp Lines: 55 > Apparently, it is impossible to let the Sun console beep without using > `window_bell'. Does anybody out there know of a possiblity other than this > function (e.g. by accessing the keyboard bell) to generate a beep? As the saying goes, "seek and ye shall find". Seek in the documentation first, and you stand a good chance of finding without having to ask. Quoting from our documentation (KB(4S) in the 3.2 UNIX Interface Reference, although it's in the 3.0 documentation as well): Keyboard Commands The call KIOCCMD sends a command to the keyboard: /* * Commands to the Sun-2 keyboard. */ #define KBD_CMD_RESET 0x01 /* Reset keyboard as if power-up */ #define KBD_CMD_BELL 0x02 /* Turn on the bell */ #define KBD_CMD_NOBELL 0x03 /* Turn off the bell */ /* * Commands to the Sun-3 keyboard. KBD_CMD_BELL & KBD_CMD_NOBELL * work as well. */ #define KBD_CMD_CLICK 0x0A /* Turn on the click annunciator */ #define KBD_CMD_NOCLICK 0x0B /* Turn off the click annunciator */ int x; err = ioctl(fd, KIOCCMD, &x); Inappropriate commands for particular keyboard types are ignored. Since there is no reliable way to get the state of the bell or click (because we can't query the keyboard, and also because a process could do writes to the appropriate serial driver -- thus going around this 'ioctl') we don't provide an equivalent "ioctl" to query its state. The "ioctl"s are defined in and the commands are defined in . This "ioctl" should be issued on "/dev/kbd" or whatever keyboard you're running from. All "win_bell" does to generate an audible bell is to: open the keyboard for the current screen do a KIOCCMD with a pointer to a variable containing KBD_CMD_BELL sleep for the specified interval of time do a KIOCCMD with a pointer to a variable containing KBD_CMD_NOBELL close the keyboard (The KBD_CMD_CLICK/KBD_CMD_NOCLICK stuff is for turning keyclick mode on and off.) No muss, no fuss, and *especially* no need for "/dev/bell" (which is not a supported item, so there's no guarantee that it will work on future keyboards).