1.\" Copyright (c) 1990, 1991, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" This code is derived from software contributed to Berkeley by 5.\" the Systems Programming Group of the University of Utah Computer 6.\" Science Department. 7.\" 8.\" %sccs.include.redist.man% 9.\" 10.\" @(#)hil.4 8.1 (Berkeley) 06/09/93 11.\" 12.Dd 13.Dt HIL 4 hp300 14.Os 15.Sh NAME 16.Nm hil 17.Nd Human Interface Link device driver 18.Sh DESCRIPTION 19The Human Interface Link 20.Pq Tn HIL 21is the interface used by the Series 22300 computers to connect devices such as keyboards, mice, control knobs, 23and 24.Tn ID 25modules to the machine. 26.Pp 27Special files 28.Pa /dev/hil[1-7] 29refer to physical 30.Tn HIL 31devices 1 through 7. 32.Pa /dev/hil0 33refers to the ``loop'' pseudo-device and is used for the queue 34allocation commands described below. 35In the current implementation, 36there can only be one keyboard and it must be the first device 37.Pq Li hil1 . 38.Pp 39The device file that corresponds to a particular 40.Tn HIL 41device is determined 42by the order of the devices on the loop. For instance, if the 43.Tn ID 44module 45is the second physical device on the loop, then 46.Pa /dev/hil2 47is the special 48file that should be used for communication with the module. 49.Pp 50Communication with an 51.Tn HIL 52device is begun with an 53.Em open 54system call. 55A process may open a device already opened by another process unless 56the process is operating in 57.Tn HP-UX 58compatibility mode 59in which case it requires exclusive use of the device, or 60another process has the device open and is using 61.Tn HP-UX 62style 63device access (see 64.Dv HILIOCHPUX 65below). 66.Pp 67Input data from a device are obtained in one of two ways. 68Processes may use an 69.Tn HP-UX 70style interface in which the 71.Xr read 2 72system call is used to get fixed-size input packets, 73or they can use a 74.Em shared-queue 75interface. 76The shared-queue interface avoids the system call overhead associated with 77the 78.Tn HP-UX 79read interface by sharing a region of memory between the system 80and a user process. 81This region consists of a circular list of 255 event packets, 82and a header containing the size of the queue, and its head and tail indices. 83The system deposits event data at the tail of the queue, 84a process extracts it from the head. 85Extracting an event is done by copying it from the queue and then updating 86the head appropriately (i.e. head = (head + 1) % qsize). 87It is up to the process to ensure that packets are removed from the 88queue quickly enough to prevent the queue from filling. 89The system, when it determines that the queue is full, 90will ignore future packets from the device. 91Devices are 92.Em mapped 93to queues via an 94.Xr ioctl 2. 95More than one device can be mapped to a single queue and one device can 96be mapped to several queues. 97Queues are implicitly unmapped by a 98.Xr fork 2 99and thus, 100cannot be shared between processes. 101.Pp 102Choosing the type of interface is done on a per device basis using 103an 104.Xr ioctl , 105but each device can only have one interface at any given time. 106.Pp 107.Em Select 108may be used with either interface to detect when input data are present. 109With the read interface, selecting indicates when there is input for a 110given device. 111With the shared-queue interface, selecting on the loop pseudo-device 112.Pq Li hil0 113indicates when data are present from any device on any queue 114while selecting on an individual device indicates when data are present 115for that device on any queue. 116.Pp 117.Em Close 118shuts down the file descriptor associated with the 119.Tn HIL 120device. 121The last close (system-wide) of any device removes that device 122from all queues it was mapped to while the last close of the loop 123pseudo-device unmaps all devices and deallocates all queues. 124.Pp 125.Xr Ioctl 2 126is used to control the 127.Tn HIL 128device. 129The ioctl commands (see 130.Aq Pa hpdev/hilioctl.h ) 131listed below are separated into two groups. 132The first are those which provide functions identical to 133.Tn HP-UX . 134Refer to 135.Xr hil 7 136in the 137.Tn HP-UX 138documentation for more 139complete descriptions of these ioctls. 140The second set of ioctls are specific to this implementation and are 141primarily related to the shared-queue interface. 142.Bl -tag -width HILIOCARO 143.It Dv HILIOCID 144Identify and Describe 145.Pp 146The device will return up to 11 bytes of information describing the 147type and characteristics of the device. 148At the very least, 2 bytes of information, 149the device 150.Tn ID , 151and the Describe Record Header will be returned. 152Identical to the 153.Tn HP-UX 154.Dv HILID 155ioctl. 156.It Dv HILIOCSC 157Report Security Code 158.Pp 159Request the security code record from a device. The security code can 160vary from 1 byte to 15, and is only supported by some 161.Tn HIL 162devices. 163Identical to the 164.Tn HP-UX 165.Dv HILSC 166ioctl. 167.It Dv HILIOCRN 168Report Name 169.Pp 170An ascii string of up to 15 bytes in length that describes the device 171is returned. 172Identical to the 173.Tn HP-UX 174.Dv HILRN 175ioctl. 176.It Dv HILIOCRS 177Report Status 178.Pp 179An ascii string of up to 15 bytes in length that describes the current 180status of the device is returned. 181Identical to the 182.Tn HP-UX 183.Dv HILRS 184ioctl. 185.It Dv HILIOCED 186Extended Describe 187.Pp 188Additional information of up to 15 bytes is returned describing the device. 189This ioctl is similar to 190.Tn HILIOCID , 191which must be used first 192to determine if the device supports extended describe. 193Identical to the 194.Tn HP-UX 195.Dv HILED 196ioctl. 197.It Dv HILIOCAROFF 198Disable Auto Repeat 199.Pp 200Turn off auto repeat on the keyboard while it is cooked mode. 201Identical to the 202.Tn HP-UX 203.Dv HILDKR 204ioctl. 205.It Dv HILIOCAR1 206Enable Auto Repeat 207.Pp 208Turn on auto repeat on the keyboard while it is in raw mode. 209The repeat rate is set to 1/30th of a second. 210Identical to the 211.Tn HP-UX 212.Dv HILER1 213ioctl. 214.It Dv HILIOCAR2 215Enable Auto Repeat 216.Pp 217Turn on auto repeat on the keyboard while it is in raw mode. 218The repeat rate is set to 1/60th of a second. 219Identical to the 220.Tn HP-UX 221.Dv HILER2 222ioctl. 223.Pp 224The following ioctls are specific to this implementation: 225.It Dv HILIOCBEEP 226Beep 227.Pp 228Generate a keyboard beep as defined by 229.Ar arg . 230.Ar Arg 231is a pointer to two bytes of information, 232the first is the duration of the beep (microseconds), 233the second is the frequency of the beep. 234.It Dv HILIOCALLOCQ 235Allocate Queue 236.Pp 237Allocate and map into user space, 238an 239.Tn HILQ 240structure as defined in 241.Aq Pa hpdev/hilioctl.h . 242.Ar Arg 243is a pointer to a 244.Ar hilqinfo 245structure (also described in 246.Aq Pa hpdev/hilioctl.h ) 247consisting of a 248.Pa qid 249and an 250.Pa addr . 251If 252.Pa addr 253is non-zero it specifies where in the address space to map the queue. 254If zero, the system will select a convenient location and fill in 255.Pa addr . 256.Pa Qid 257is filled in by the system and 258is a small integer used to uniquely identify this queue. 259This ioctl can only be issued to the loop pseudo-device. 260.It Dv HILIOCFREEQ 261Free Queue 262.Pp 263Release a previously allocated 264.Tn HIL 265event queue, 266unmapping it from the user's address space. 267.Ar Arg 268should point to a 269.Ar hilqinfo 270structure which contains the 271.Ar qid 272of the queue to be released. 273All devices that are currently mapped to the queue are unmapped. 274This ioctl can only be issued to the loop pseudo-device. 275.It Dv HILIOCMAPQ 276Map Device to Queue 277.Pp 278Maps this device to a previously allocated 279.Tn HIL 280event queue. 281.Ar Arg 282is a pointer to an integer containing the 283.Ar qid 284of the queue. 285Once a device is mapped to a queue, 286all event information generated by the device will be placed 287into the event queue at the tail. 288.It Dv HILIOCUNMAPQ 289Unmap Device from Queue 290.Pp 291Unmap this device from a previously allocated 292.Tn HIL 293event queue. 294.Ar Arg 295is a pointer to an integer containing the 296.Ar qid 297for the queue. 298Future events from the device are no longer placed on the event queue. 299.It Dv HILIOCHPUX 300Use HP-UX Read Interface 301.Pp 302Use 303.Tn HP-UX 304semantics for gathering data from this device. 305Instead of placing input events for the device on a queue, 306they are placed, in 307.Tn HP-UX 308format, into a buffer from which they 309can be obtained via 310.Xr read 2 . 311This interface is provided for backwards compatibility. 312Refer to the 313.Tn HP-UX 314documentation for a description of the event packet. 315.El 316.Sh FILES 317.Bl -tag -width /dev/hil[2-7] -compact 318.It Pa /dev/hil0 319.Tn HIL 320loop pseudo device. 321.It Pa /dev/hil1 322.Tn HIL 323keyboard device. 324.It Pa /dev/hil[2-7] 325Individual 326.Tn HIL 327loop devices. 328.El 329.Sh ERRORS 330.Bl -tag -width [EINVAL] 331.It Bq Er ENODEV 332no such HIL loop device. 333.It Bq Er ENXIO 334HIL loop is inoperative. 335.It Bq Er EBUSY 336Another HP-UX process has the device open, or another 337.Bx 338process has the 339device open, and is using it in 340.Tn HP-UX 341mode. 342.It Bq Er EINVAL 343Invalid 344.Xr ioctl 345specification. 346.It Bq Er EMFILE 347No more shared queues available. 348.El 349