Technical data
bd(7M) STREAMS Modules SunOS 5.5
NAME bd − SunButtons and SunDials STREAMS module
SYNOPSIS open("/dev/bd", O_RDWR)
DESCRIPTION The bd STREAMS module processes the byte streams generated by the SunButtons but-
tonbox and SunDials dialbox. The buttonbox generates a stream of bytes that encode the
identity and state transition of the buttons. The dialbox generates a stream of bytes that
encode the identityof the dials and the amount by which they are turned. Both of these
streams are merged together when a host has both a buttonbox and a dialbox in use at the
same time.
SunButtons reports the button number and up/down status encoded into a one byte mes-
sage. Byte values from 0xc0 to 0xdf indicate a transition to button down. To obtain the
button number, subtract 0xc0 from the byte value. Byte values from 0xe0 to 0xff indicate
a transition to button up. To obtain the button number, subtract 0xe0 from the byte value.
Each dial sample in the byte stream consists of three bytes. The first byte identifies which
dial was turned and the nexttwo bytes return the delta in signed binary format. When
bound to an application usingthe window system, Virtual User Input Device events are
generated. An event from a dial is constrained to lie between 0x80 and 0x87.
A stream with the bd pushed streams module configured in it can emit firm_events as
specified by the protocol of a VUID. bd understands the VUIDSFORMAT and
VUIDGFORMAT ioctls (see reference below), as defined in /usr/include/sys/bdio.h and
$OPENWINHOME/include/xview/win_event.h. All other ioctl() requests are passed
downstream.
The bd streams module sets the parameters of the serial port when it is first opened. No
termio(7I) ioctl () requests should be performed on a bd STREAMS module, as bd
expects the device parameters to remain as it set them.
IOCTLS VUIDSFORMAT
VUIDGFORMAT
These are standard Virtual User Input Deviceioctls.
BDIOBUTLITE The bd streams module implements this ioctl to enable processes
to manipulate the lights on the buttonbox. The BDIOBUTLITE
ioctl must be carried by an I_STR ioctl to the bd module. For an
explanation of I_STR see streamio(7I). The data for the
BDIOBUTLITE ioctl is an unsigned integer in which each bit
represents the lamp on one button. The macro LED_MAP in
<sys/bdio.h> maps button numbers to appropriate bits. Source
code for the demo program x_buttontest is provided with the but-
tons and dials package, and may be found in the directory
/usr/demo/BUTTONBOX. Look at x_buttontest.c for an example
of how to manipulate the lights on the buttonbox.
7M-38










