# lnx-keyboard.c File Reference

`#include "dmxinputinit.h"`
`#include "lnx-keyboard.h"`
`#include "inputstr.h"`
`#include "Xos.h"`
`#include <sys/ioctl.h>`
`#include <errno.h>`
`#include <signal.h>`
`#include <sys/vt.h>`
`#include <sys/kd.h>`
`#include <termios.h>`
`#include "atKeynames.h"`
`#include "xf86Keymap.h"`
`#include <linux/keyboard.h>`

## Data Structures

struct | _myPrivate

## Functions

pointer | kbdLinuxCreatePrivate (DeviceIntPtr pKeyboard)
void | kbdLinuxDestroyPrivate (pointer priv)
void | kbdLinuxBell (DevicePtr pDev, int percent, int volume, int pitch, int duration)
void | kbdLinuxCtrl (DevicePtr pDev, KeybdCtrl *ctrl)
void | kbdLinuxVTPreSwitch (pointer p)
void | kbdLinuxVTPostSwitch (pointer p)
int | kbdLinuxVTSwitch (pointer p, int vt, void(*switch_return)(pointer), pointer switch_return_data)
void | kbdLinuxInit (DevicePtr pDev)
void | kbdLinuxRead (DevicePtr pDev, MOTIONPROC motion, ENQUEUEPROC enqueue, CHECKPROC checkspecial, BLOCK block)
int | kbdLinuxOn (DevicePtr pDev)
void | kbdLinuxOff (DevicePtr pDev)
void | kbdLinuxGetInfo (DevicePtr pDev, DMXLocalInitInfoPtr info)

## Detailed Description

This code implements a low-level device driver for the Linux keyboard. The code is derived from code by Thomas Roell, Orest Zborowski, and David Dawes (see the source code for complete references).

## Function Documentation

void kbdLinuxBell | ( | DevicePtr | pDev,
|  | int | percent,
|  | int | volume,
|  | int | pitch,
|  | int | duration
| ) |

Ring the bell.

Note: we completely ignore the volume, since Linux's ioctl() interface does not provide a way to control it. If it did, the XBell manpage tells how the actual volume is a function of the percent and the (base) volume.

Note that most of the other PC-based bell drivers compute the duration for KDMKTONE as a function of the volume and the duration. For some drivers, the duration is only measured in mS if the volume is 50, and is scaled by the volume for other values. This seems confusing and possibly incorrect (the xset man page says that the bell will be "as closely as it can to the user's specifications" -- if we ignore the volume and set the duration correctly, then we'll get one parameter "wrong" -- but if we use the volume to scale the duration, then we'll get both parameters "wrong").

pointer kbdLinuxCreatePrivate | ( | DeviceIntPtr | pKeyboard | ) |

| Create a private structure for use within this file.

void kbdLinuxCtrl | ( | DevicePtr | pDev,
|  | KeybdCtrl * | ctrl
| ) |

| Set the LEDs.

void kbdLinuxDestroyPrivate | ( | pointer | priv | ) |

| Destroy a private structure.

void kbdLinuxGetInfo | ( | DevicePtr | pDev,
|  | DMXLocalInitInfoPtr | info
| ) |

| Fill the info structure with information needed to initialize pDev.

void kbdLinuxInit | ( | DevicePtr | pDev | ) |

| Initialize the pDev as a Linux keyboard.

void kbdLinuxOff | ( | DevicePtr | pDev | ) |

| Turn pDev off (i.e., stop taking input from pDev).

int kbdLinuxOn | ( | DevicePtr | pDev | ) |

| Turn pDev on (i.e., take input from pDev).

void kbdLinuxRead | ( | DevicePtr | pDev,
|  | MOTIONPROC | motion,
|  | ENQUEUEPROC | enqueue,
|  | CHECKPROC | checkspecial,
|  | BLOCK | block
| ) |

| Read an event from the pDev device. If the event is a motion event, enqueue it with the motion function. Otherwise, check for special keys with the checkspecial function and enqueue the event with the enqueue function. The block type is passed to the functions so that they may block SIGIO handling as appropriate to the caller of this function.

void kbdLinuxVTPostSwitch | ( | pointer | p | ) |

| Currently unused hook called after returning from a VT switch.

void kbdLinuxVTPreSwitch | ( | pointer | p | ) |

| Currently unused hook called prior to an VT switch.

int kbdLinuxVTSwitch | ( | pointer | p,
|  | int | vt,
|  | void(* | switch_return)(pointer),
|  | pointer | switch_return_data
| ) |

| Tell the operating system to switch to vt. The switch_return function is called with the switch_return_data when the VT is switched back to the pre-switch VT (i.e., the user returns to the DMX session).

Generated June 29, 2004 for Distributed Multihead X by doxygen 1.3.4. </addres>