1*47672Scael.\" Copyright (c) 1990, 1991 The Regents of the University of California. 244678Sbostic.\" All rights reserved. 344678Sbostic.\" 444678Sbostic.\" This code is derived from software contributed to Berkeley by 544678Sbostic.\" the Systems Programming Group of the University of Utah Computer 644678Sbostic.\" Science Department. 744678Sbostic.\" 844678Sbostic.\" %sccs.include.redist.man% 944678Sbostic.\" 10*47672Scael.\" @(#)hil.4 5.2 (Berkeley) 03/27/91 1144678Sbostic.\" 12*47672Scael.Dd 13*47672Scael.Dt HIL 4 hp300 14*47672Scael.Os 15*47672Scael.Sh NAME 16*47672Scael.Nm hil 17*47672Scael.Nd Human Interface Link device driver 18*47672Scael.Sh DESCRIPTION 19*47672ScaelThe Human Interface Link 20*47672Scael.Pq Tn HIL 21*47672Scaelis the interface used by the Series 2244678Sbostic300 computers to connect devices such as keyboards, mice, control knobs, 23*47672Scaeland 24*47672Scael.Tn ID 25*47672Scaelmodules to the machine. 26*47672Scael.Pp 27*47672ScaelSpecial files 28*47672Scael.Pa /dev/hil[1-7] 29*47672Scaelrefer to physical 30*47672Scael.Tn HIL 31*47672Scaeldevices 1 through 7. 32*47672Scael.Pa /dev/hil0 33*47672Scaelrefers to the ``loop'' pseudo-device and is used for the queue 3444678Sbosticallocation commands described below. 3544678SbosticIn the current implementation, 36*47672Scaelthere can only be one keyboard and it must be the first device 37*47672Scael.Pq Li hil1 . 38*47672Scael.Pp 39*47672ScaelThe device file that corresponds to a particular 40*47672Scael.Tn HIL 41*47672Scaeldevice is determined 42*47672Scaelby the order of the devices on the loop. For instance, if the 43*47672Scael.Tn ID 44*47672Scaelmodule 45*47672Scaelis the second physical device on the loop, then 46*47672Scael.Pa /dev/hil2 47*47672Scaelis the special 4844678Sbosticfile that should be used for communication with the module. 49*47672Scael.Pp 50*47672ScaelCommunication with an 51*47672Scael.Tn HIL 52*47672Scaeldevice is begun with an 53*47672Scael.Em open 5444678Sbosticsystem call. 5544678SbosticA process may open a device already opened by another process unless 56*47672Scaelthe process is operating in 57*47672Scael.Tn HP-UX 58*47672Scaelcompatibility mode 5944678Sbosticin which case it requires exclusive use of the device, or 60*47672Scaelanother process has the device open and is using 61*47672Scael.Tn HP-UX 62*47672Scaelstyle 6344678Sbosticdevice access (see 64*47672Scael.Dv HILIOCHPUX 6544678Sbosticbelow). 66*47672Scael.Pp 6744678SbosticInput data from a device are obtained in one of two ways. 68*47672ScaelProcesses may use an 69*47672Scael.Tn HP-UX 70*47672Scaelstyle interface in which the 71*47672Scael.Xr read 2 7244678Sbosticsystem call is used to get fixed-size input packets, 7344678Sbosticor they can use a 74*47672Scael.Em shared-queue 7544678Sbosticinterface. 7644678SbosticThe shared-queue interface avoids the system call overhead associated with 77*47672Scaelthe 78*47672Scael.Tn HP-UX 79*47672Scaelread interface by sharing a region of memory between the system 8044678Sbosticand a user process. 8144678SbosticThis region consists of a circular list of 255 event packets, 8244678Sbosticand a header containing the size of the queue, and its head and tail indices. 8344678SbosticThe system deposits event data at the tail of the queue, 8444678Sbostica process extracts it from the head. 8544678SbosticExtracting an event is done by copying it from the queue and then updating 8644678Sbosticthe head appropriately (i.e. head = (head + 1) % qsize). 8744678SbosticIt is up to the process to ensure that packets are removed from the 8844678Sbosticqueue quickly enough to prevent the queue from filling. 8944678SbosticThe system, when it determines that the queue is full, 9044678Sbosticwill ignore future packets from the device. 91*47672ScaelDevices are 92*47672Scael.Em mapped 93*47672Scaelto queues via an 94*47672Scael.Xr ioctl 2. 9544678SbosticMore than one device can be mapped to a single queue and one device can 9644678Sbosticbe mapped to several queues. 97*47672ScaelQueues are implicitly unmapped by a 98*47672Scael.Xr fork 2 99*47672Scaeland thus, 10044678Sbosticcannot be shared between processes. 101*47672Scael.Pp 10244678SbosticChoosing the type of interface is done on a per device basis using 103*47672Scaelan 104*47672Scael.Xr ioctl , 105*47672Scaelbut each device can only have one interface at any given time. 106*47672Scael.Pp 107*47672Scael.Em Select 10844678Sbosticmay be used with either interface to detect when input data are present. 10944678SbosticWith the read interface, selecting indicates when there is input for a 11044678Sbosticgiven device. 111*47672ScaelWith the shared-queue interface, selecting on the loop pseudo-device 112*47672Scael.Pq Li hil0 11344678Sbosticindicates when data are present from any device on any queue 11444678Sbosticwhile selecting on an individual device indicates when data are present 11544678Sbosticfor that device on any queue. 116*47672Scael.Pp 117*47672Scael.Em Close 118*47672Scaelshuts down the file descriptor associated with the 119*47672Scael.Tn HIL 120*47672Scaeldevice. 12144678SbosticThe last close (system-wide) of any device removes that device 12244678Sbosticfrom all queues it was mapped to while the last close of the loop 12344678Sbosticpseudo-device unmaps all devices and deallocates all queues. 124*47672Scael.Pp 125*47672Scael.Xr Ioctl 2 126*47672Scaelis used to control the 127*47672Scael.Tn HIL 128*47672Scaeldevice. 129*47672ScaelThe ioctl commands (see 130*47672Scael.Aq Pa hpdev/hilioctl.h ) 13144678Sbosticlisted below are separated into two groups. 132*47672ScaelThe first are those which provide functions identical to 133*47672Scael.Tn HP-UX . 134*47672ScaelRefer to 135*47672Scael.Xr hil 7 136*47672Scaelin the 137*47672Scael.Tn HP-UX 138*47672Scaeldocumentation for more 13944678Sbosticcomplete descriptions of these ioctls. 14044678SbosticThe second set of ioctls are specific to this implementation and are 14144678Sbosticprimarily related to the shared-queue interface. 142*47672Scael.Bl -tag -width HILIOCARO 143*47672Scael.It Dv HILIOCID 14444678SbosticIdentify and Describe 145*47672Scael.Pp 14644678SbosticThe device will return up to 11 bytes of information describing the 14744678Sbostictype and characteristics of the device. 14844678SbosticAt the very least, 2 bytes of information, 149*47672Scaelthe device 150*47672Scael.Tn ID , 151*47672Scaeland the Describe Record Header will be returned. 152*47672ScaelIdentical to the 153*47672Scael.Tn HP-UX 154*47672Scael.Dv HILID 15544678Sbosticioctl. 156*47672Scael.It Dv HILIOCSC 15744678SbosticReport Security Code 158*47672Scael.Pp 15944678SbosticRequest the security code record from a device. The security code can 160*47672Scaelvary from 1 byte to 15, and is only supported by some 161*47672Scael.Tn HIL 162*47672Scaeldevices. 163*47672ScaelIdentical to the 164*47672Scael.Tn HP-UX 165*47672Scael.Dv HILSC 16644678Sbosticioctl. 167*47672Scael.It Dv HILIOCRN 16844678SbosticReport Name 169*47672Scael.Pp 17044678SbosticAn ascii string of up to 15 bytes in length that describes the device 17144678Sbosticis returned. 172*47672ScaelIdentical to the 173*47672Scael.Tn HP-UX 174*47672Scael.Dv HILRN 17544678Sbosticioctl. 176*47672Scael.It Dv HILIOCRS 17744678SbosticReport Status 178*47672Scael.Pp 17944678SbosticAn ascii string of up to 15 bytes in length that describes the current 18044678Sbosticstatus of the device is returned. 181*47672ScaelIdentical to the 182*47672Scael.Tn HP-UX 183*47672Scael.Dv HILRS 18444678Sbosticioctl. 185*47672Scael.It Dv HILIOCED 18644678SbosticExtended Describe 187*47672Scael.Pp 18844678SbosticAdditional information of up to 15 bytes is returned describing the device. 189*47672ScaelThis ioctl is similar to 190*47672Scael.Tn HILIOCID , 191*47672Scaelwhich must be used first 19244678Sbosticto determine if the device supports extended describe. 193*47672ScaelIdentical to the 194*47672Scael.Tn HP-UX 195*47672Scael.Dv HILED 19644678Sbosticioctl. 197*47672Scael.It Dv HILIOCAROFF 19844678SbosticDisable Auto Repeat 199*47672Scael.Pp 20044678SbosticTurn off auto repeat on the keyboard while it is cooked mode. 201*47672ScaelIdentical to the 202*47672Scael.Tn HP-UX 203*47672Scael.Dv HILDKR 20444678Sbosticioctl. 205*47672Scael.It Dv HILIOCAR1 20644678SbosticEnable Auto Repeat 207*47672Scael.Pp 20844678SbosticTurn on auto repeat on the keyboard while it is in raw mode. 20944678SbosticThe repeat rate is set to 1/30th of a second. 210*47672ScaelIdentical to the 211*47672Scael.Tn HP-UX 212*47672Scael.Dv HILER1 21344678Sbosticioctl. 214*47672Scael.It Dv HILIOCAR2 21544678SbosticEnable Auto Repeat 216*47672Scael.Pp 21744678SbosticTurn on auto repeat on the keyboard while it is in raw mode. 21844678SbosticThe repeat rate is set to 1/60th of a second. 219*47672ScaelIdentical to the 220*47672Scael.Tn HP-UX 221*47672Scael.Dv HILER2 22244678Sbosticioctl. 223*47672Scael.Pp 22444678SbosticThe following ioctls are specific to this implementation: 225*47672Scael.It Dv HILIOCBEEP 22644678SbosticBeep 227*47672Scael.Pp 22844678SbosticGenerate a keyboard beep as defined by 229*47672Scael.Ar arg . 230*47672Scael.Ar Arg 23144678Sbosticis a pointer to two bytes of information, 23244678Sbosticthe first is the duration of the beep (microseconds), 23344678Sbosticthe second is the frequency of the beep. 234*47672Scael.It Dv HILIOCALLOCQ 23544678SbosticAllocate Queue 236*47672Scael.Pp 23744678SbosticAllocate and map into user space, 238*47672Scaelan 239*47672Scael.Tn HILQ 240*47672Scaelstructure as defined in 241*47672Scael.Aq Pa hpdev/hilioctl.h . 242*47672Scael.Ar Arg 24344678Sbosticis a pointer to a 244*47672Scael.Ar hilqinfo 245*47672Scaelstructure (also described in 246*47672Scael.Aq Pa hpdev/hilioctl.h ) 24744678Sbosticconsisting of a 248*47672Scael.Pa qid 24944678Sbosticand an 250*47672Scael.Pa addr . 25144678SbosticIf 252*47672Scael.Pa addr 25344678Sbosticis non-zero it specifies where in the address space to map the queue. 25444678SbosticIf zero, the system will select a convenient location and fill in 255*47672Scael.Pa addr . 256*47672Scael.Pa Qid 25744678Sbosticis filled in by the system and 25844678Sbosticis a small integer used to uniquely identify this queue. 25944678SbosticThis ioctl can only be issued to the loop pseudo-device. 260*47672Scael.It Dv HILIOCFREEQ 26144678SbosticFree Queue 262*47672Scael.Pp 263*47672ScaelRelease a previously allocated 264*47672Scael.Tn HIL 265*47672Scaelevent queue, 26644678Sbosticunmapping it from the user's address space. 267*47672Scael.Ar Arg 26844678Sbosticshould point to a 269*47672Scael.Ar hilqinfo 27044678Sbosticstructure which contains the 271*47672Scael.Ar qid 27244678Sbosticof the queue to be released. 27344678SbosticAll devices that are currently mapped to the queue are unmapped. 27444678SbosticThis ioctl can only be issued to the loop pseudo-device. 275*47672Scael.It Dv HILIOCMAPQ 27644678SbosticMap Device to Queue 277*47672Scael.Pp 278*47672ScaelMaps this device to a previously allocated 279*47672Scael.Tn HIL 280*47672Scaelevent queue. 281*47672Scael.Ar Arg 28244678Sbosticis a pointer to an integer containing the 283*47672Scael.Ar qid 28444678Sbosticof the queue. 28544678SbosticOnce a device is mapped to a queue, 28644678Sbosticall event information generated by the device will be placed 28744678Sbosticinto the event queue at the tail. 288*47672Scael.It Dv HILIOCUNMAPQ 28944678SbosticUnmap Device from Queue 290*47672Scael.Pp 291*47672ScaelUnmap this device from a previously allocated 292*47672Scael.Tn HIL 293*47672Scaelevent queue. 294*47672Scael.Ar Arg 29544678Sbosticis a pointer to an integer containing the 296*47672Scael.Ar qid 29744678Sbosticfor the queue. 29844678SbosticFuture events from the device are no longer placed on the event queue. 299*47672Scael.It Dv HILIOCHPUX 30044678SbosticUse HP-UX Read Interface 301*47672Scael.Pp 302*47672ScaelUse 303*47672Scael.Tn HP-UX 304*47672Scaelsemantics for gathering data from this device. 30544678SbosticInstead of placing input events for the device on a queue, 306*47672Scaelthey are placed, in 307*47672Scael.Tn HP-UX 308*47672Scaelformat, into a buffer from which they 309*47672Scaelcan be obtained via 310*47672Scael.Xr read 2 . 31144678SbosticThis interface is provided for backwards compatibility. 312*47672ScaelRefer to the 313*47672Scael.Tn HP-UX 314*47672Scaeldocumentation for a description of the event packet. 315*47672Scael.El 316*47672Scael.Sh FILES 317*47672Scael.Bl -tag -width /dev/hil[2-7] -compact 318*47672Scael.It Pa /dev/hil0 319*47672Scael.Tn HIL 320*47672Scaelloop pseudo device. 321*47672Scael.It Pa /dev/hil1 322*47672Scael.Tn HIL 323*47672Scaelkeyboard device. 324*47672Scael.It Pa /dev/hil[2-7] 325*47672ScaelIndividual 326*47672Scael.Tn HIL 327*47672Scaelloop devices. 328*47672Scael.El 329*47672Scael.Sh ERRORS 330*47672Scael.Bl -tag -width [EINVAL] 331*47672Scael.It Bq Er ENODEV 33244678Sbosticno such HIL loop device. 333*47672Scael.It Bq Er ENXIO 33444678SbosticHIL loop is inoperative. 335*47672Scael.It Bq Er EBUSY 336*47672ScaelAnother HP-UX process has the device open, or another 337*47672Scael.Bx 338*47672Scaelprocess has the 339*47672Scaeldevice open, and is using it in 340*47672Scael.Tn HP-UX 341*47672Scaelmode. 342*47672Scael.It Bq Er EINVAL 343*47672ScaelInvalid 344*47672Scael.Xr ioctl 345*47672Scaelspecification. 346*47672Scael.It Bq Er EMFILE 34744678SbosticNo more shared queues available. 348*47672Scael.El 349*47672Scael.Sh HISTORY 350*47672ScaelThe 351*47672Scael.Nm 352*47672Scaelinterface 353*47672Scael.Ud 354