162982Sbostic.\" Copyright (c) 1990, 1991, 1993 262982Sbostic.\" The Regents of the University of California. 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*64995Smckusick.\" @(#)hil.4 8.2 (Berkeley) 11/30/93 1144678Sbostic.\" 1247672Scael.Dd 1347672Scael.Dt HIL 4 hp300 1447672Scael.Os 1547672Scael.Sh NAME 1647672Scael.Nm hil 1747672Scael.Nd Human Interface Link device driver 1847672Scael.Sh DESCRIPTION 1947672ScaelThe Human Interface Link 2047672Scael.Pq Tn HIL 2147672Scaelis the interface used by the Series 2244678Sbostic300 computers to connect devices such as keyboards, mice, control knobs, 2347672Scaeland 2447672Scael.Tn ID 2547672Scaelmodules to the machine. 2647672Scael.Pp 2747672ScaelSpecial files 2847672Scael.Pa /dev/hil[1-7] 2947672Scaelrefer to physical 3047672Scael.Tn HIL 3147672Scaeldevices 1 through 7. 3247672Scael.Pa /dev/hil0 3347672Scaelrefers to the ``loop'' pseudo-device and is used for the queue 3444678Sbosticallocation commands described below. 3544678SbosticIn the current implementation, 3647672Scaelthere can only be one keyboard and it must be the first device 3747672Scael.Pq Li hil1 . 3847672Scael.Pp 3947672ScaelThe device file that corresponds to a particular 4047672Scael.Tn HIL 4147672Scaeldevice is determined 4247672Scaelby the order of the devices on the loop. For instance, if the 4347672Scael.Tn ID 4447672Scaelmodule 4547672Scaelis the second physical device on the loop, then 4647672Scael.Pa /dev/hil2 4747672Scaelis the special 4844678Sbosticfile that should be used for communication with the module. 4947672Scael.Pp 5047672ScaelCommunication with an 5147672Scael.Tn HIL 5247672Scaeldevice is begun with an 5347672Scael.Em open 5444678Sbosticsystem call. 5544678SbosticA process may open a device already opened by another process unless 5647672Scaelthe process is operating in 5747672Scael.Tn HP-UX 5847672Scaelcompatibility mode 5944678Sbosticin which case it requires exclusive use of the device, or 6047672Scaelanother process has the device open and is using 6147672Scael.Tn HP-UX 6247672Scaelstyle 6344678Sbosticdevice access (see 6447672Scael.Dv HILIOCHPUX 6544678Sbosticbelow). 6647672Scael.Pp 6744678SbosticInput data from a device are obtained in one of two ways. 6847672ScaelProcesses may use an 6947672Scael.Tn HP-UX 7047672Scaelstyle interface in which the 7147672Scael.Xr read 2 7244678Sbosticsystem call is used to get fixed-size input packets, 7344678Sbosticor they can use a 7447672Scael.Em shared-queue 7544678Sbosticinterface. 7644678SbosticThe shared-queue interface avoids the system call overhead associated with 7747672Scaelthe 7847672Scael.Tn HP-UX 7947672Scaelread 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. 9147672ScaelDevices are 9247672Scael.Em mapped 9347672Scaelto queues via an 9447672Scael.Xr ioctl 2. 9544678SbosticMore than one device can be mapped to a single queue and one device can 9644678Sbosticbe mapped to several queues. 9747672ScaelQueues are implicitly unmapped by a 9847672Scael.Xr fork 2 9947672Scaeland thus, 10044678Sbosticcannot be shared between processes. 10147672Scael.Pp 10244678SbosticChoosing the type of interface is done on a per device basis using 10347672Scaelan 10447672Scael.Xr ioctl , 10547672Scaelbut each device can only have one interface at any given time. 10647672Scael.Pp 10747672Scael.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. 11147672ScaelWith the shared-queue interface, selecting on the loop pseudo-device 11247672Scael.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. 11647672Scael.Pp 11747672Scael.Em Close 11847672Scaelshuts down the file descriptor associated with the 11947672Scael.Tn HIL 12047672Scaeldevice. 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. 12447672Scael.Pp 12547672Scael.Xr Ioctl 2 12647672Scaelis used to control the 12747672Scael.Tn HIL 12847672Scaeldevice. 12947672ScaelThe ioctl commands (see 13047672Scael.Aq Pa hpdev/hilioctl.h ) 13144678Sbosticlisted below are separated into two groups. 13247672ScaelThe first are those which provide functions identical to 13347672Scael.Tn HP-UX . 13447672ScaelRefer to 13547672Scael.Xr hil 7 13647672Scaelin the 13747672Scael.Tn HP-UX 13847672Scaeldocumentation 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. 14247672Scael.Bl -tag -width HILIOCARO 14347672Scael.It Dv HILIOCID 14444678SbosticIdentify and Describe 14547672Scael.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, 14947672Scaelthe device 15047672Scael.Tn ID , 15147672Scaeland the Describe Record Header will be returned. 15247672ScaelIdentical to the 15347672Scael.Tn HP-UX 15447672Scael.Dv HILID 15544678Sbosticioctl. 15647672Scael.It Dv HILIOCSC 15744678SbosticReport Security Code 15847672Scael.Pp 15944678SbosticRequest the security code record from a device. The security code can 16047672Scaelvary from 1 byte to 15, and is only supported by some 16147672Scael.Tn HIL 16247672Scaeldevices. 16347672ScaelIdentical to the 16447672Scael.Tn HP-UX 16547672Scael.Dv HILSC 16644678Sbosticioctl. 16747672Scael.It Dv HILIOCRN 16844678SbosticReport Name 16947672Scael.Pp 17044678SbosticAn ascii string of up to 15 bytes in length that describes the device 17144678Sbosticis returned. 17247672ScaelIdentical to the 17347672Scael.Tn HP-UX 17447672Scael.Dv HILRN 17544678Sbosticioctl. 17647672Scael.It Dv HILIOCRS 17744678SbosticReport Status 17847672Scael.Pp 17944678SbosticAn ascii string of up to 15 bytes in length that describes the current 18044678Sbosticstatus of the device is returned. 18147672ScaelIdentical to the 18247672Scael.Tn HP-UX 18347672Scael.Dv HILRS 18444678Sbosticioctl. 18547672Scael.It Dv HILIOCED 18644678SbosticExtended Describe 18747672Scael.Pp 18844678SbosticAdditional information of up to 15 bytes is returned describing the device. 18947672ScaelThis ioctl is similar to 19047672Scael.Tn HILIOCID , 19147672Scaelwhich must be used first 19244678Sbosticto determine if the device supports extended describe. 19347672ScaelIdentical to the 19447672Scael.Tn HP-UX 19547672Scael.Dv HILED 19644678Sbosticioctl. 19747672Scael.It Dv HILIOCAROFF 19844678SbosticDisable Auto Repeat 19947672Scael.Pp 200*64995SmckusickTurn off auto repeat on the keyboard while it is in cooked mode. 20147672ScaelIdentical to the 20247672Scael.Tn HP-UX 20347672Scael.Dv HILDKR 20444678Sbosticioctl. 20547672Scael.It Dv HILIOCAR1 20644678SbosticEnable Auto Repeat 20747672Scael.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. 21047672ScaelIdentical to the 21147672Scael.Tn HP-UX 21247672Scael.Dv HILER1 21344678Sbosticioctl. 21447672Scael.It Dv HILIOCAR2 21544678SbosticEnable Auto Repeat 21647672Scael.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. 21947672ScaelIdentical to the 22047672Scael.Tn HP-UX 22147672Scael.Dv HILER2 22244678Sbosticioctl. 22347672Scael.Pp 22444678SbosticThe following ioctls are specific to this implementation: 22547672Scael.It Dv HILIOCBEEP 22644678SbosticBeep 22747672Scael.Pp 22844678SbosticGenerate a keyboard beep as defined by 22947672Scael.Ar arg . 23047672Scael.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. 23447672Scael.It Dv HILIOCALLOCQ 23544678SbosticAllocate Queue 23647672Scael.Pp 23744678SbosticAllocate and map into user space, 23847672Scaelan 23947672Scael.Tn HILQ 24047672Scaelstructure as defined in 24147672Scael.Aq Pa hpdev/hilioctl.h . 24247672Scael.Ar Arg 24344678Sbosticis a pointer to a 24447672Scael.Ar hilqinfo 24547672Scaelstructure (also described in 24647672Scael.Aq Pa hpdev/hilioctl.h ) 24744678Sbosticconsisting of a 24847672Scael.Pa qid 24944678Sbosticand an 25047672Scael.Pa addr . 25144678SbosticIf 25247672Scael.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 25547672Scael.Pa addr . 25647672Scael.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. 26047672Scael.It Dv HILIOCFREEQ 26144678SbosticFree Queue 26247672Scael.Pp 26347672ScaelRelease a previously allocated 26447672Scael.Tn HIL 26547672Scaelevent queue, 26644678Sbosticunmapping it from the user's address space. 26747672Scael.Ar Arg 26844678Sbosticshould point to a 26947672Scael.Ar hilqinfo 27044678Sbosticstructure which contains the 27147672Scael.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. 27547672Scael.It Dv HILIOCMAPQ 27644678SbosticMap Device to Queue 27747672Scael.Pp 27847672ScaelMaps this device to a previously allocated 27947672Scael.Tn HIL 28047672Scaelevent queue. 28147672Scael.Ar Arg 28244678Sbosticis a pointer to an integer containing the 28347672Scael.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. 28847672Scael.It Dv HILIOCUNMAPQ 28944678SbosticUnmap Device from Queue 29047672Scael.Pp 29147672ScaelUnmap this device from a previously allocated 29247672Scael.Tn HIL 29347672Scaelevent queue. 29447672Scael.Ar Arg 29544678Sbosticis a pointer to an integer containing the 29647672Scael.Ar qid 29744678Sbosticfor the queue. 29844678SbosticFuture events from the device are no longer placed on the event queue. 29947672Scael.It Dv HILIOCHPUX 30044678SbosticUse HP-UX Read Interface 30147672Scael.Pp 30247672ScaelUse 30347672Scael.Tn HP-UX 30447672Scaelsemantics for gathering data from this device. 30544678SbosticInstead of placing input events for the device on a queue, 30647672Scaelthey are placed, in 30747672Scael.Tn HP-UX 30847672Scaelformat, into a buffer from which they 30947672Scaelcan be obtained via 31047672Scael.Xr read 2 . 31144678SbosticThis interface is provided for backwards compatibility. 31247672ScaelRefer to the 31347672Scael.Tn HP-UX 31447672Scaeldocumentation for a description of the event packet. 31547672Scael.El 31647672Scael.Sh FILES 31747672Scael.Bl -tag -width /dev/hil[2-7] -compact 31847672Scael.It Pa /dev/hil0 31947672Scael.Tn HIL 32047672Scaelloop pseudo device. 32147672Scael.It Pa /dev/hil1 32247672Scael.Tn HIL 32347672Scaelkeyboard device. 32447672Scael.It Pa /dev/hil[2-7] 32547672ScaelIndividual 32647672Scael.Tn HIL 32747672Scaelloop devices. 32847672Scael.El 32947672Scael.Sh ERRORS 33047672Scael.Bl -tag -width [EINVAL] 33147672Scael.It Bq Er ENODEV 33244678Sbosticno such HIL loop device. 33347672Scael.It Bq Er ENXIO 33444678SbosticHIL loop is inoperative. 33547672Scael.It Bq Er EBUSY 33647672ScaelAnother HP-UX process has the device open, or another 33747672Scael.Bx 33847672Scaelprocess has the 33947672Scaeldevice open, and is using it in 34047672Scael.Tn HP-UX 34147672Scaelmode. 34247672Scael.It Bq Er EINVAL 34347672ScaelInvalid 34447672Scael.Xr ioctl 34547672Scaelspecification. 34647672Scael.It Bq Er EMFILE 34744678SbosticNo more shared queues available. 34847672Scael.El 349