Keyboard Service Vector
The keyboard service vector provides a limited set of keyboard-related and sound-related services for kernel extensions.
The following services are available:
- Sound alarm
- Enable and disable secure attention key (SAK)
- Flush input queue
The address of the service vector is obtained with the fp_ioctl subroutine call during a non-critical period. The kernel extension can later invoke the service using an indirect call as follows:
(*ServiceVector[ServiceNumber]) (dev_t DeviceNumber, caddr_t Arg);
where:
- The service vector is a pointer to the service vector obtained by the KSQUERYSV fp_loctl subroutine call.
- The ServiceNumber parameter is defined in the inputdd.h file.
- The DeviceNumber parameter specifies the major and minor numbers of the keyboard.
- The Arg parameter points to a ksalarm structure for alarm requests and a uint variable for SAK enable and disable requests. The Arg parameter is NULL for flush queue requests.
If successful, the function returns a value of 0 is returned. Otherwise, the function returns an error number defined in the errno.h file. Flush-queue and enable/disable-SAK requests are always processed, but alarm requests are ignored if the kernel extension's channel is inactive.
The following example uses the service vector to sound the alarm:
/* pinned data structures */
/* This example assumes that pinning is done elsewhere. */
int (**ksvtbl) ();
struct ksalarm alarm;
dev_t devno;
/* get address of service vector */
/* This should be done in a noncritical section */
if (fp_ioctl(fp, KSQUERYSV, &ksvtbl, 0)) {
/* error recovery */
}
.
.
.
/* critical section */
/* sound alarm for 1 second using service vector */
alarm.duration = 128;
alarm.frequency = 100;
if ((*ksvtbl[KSVALARM]) (devno, &alarm)) {
/* error recovery */
}