- Main Page
- Data Structures
- Files

- File List
- Globals

Defines | Functions | Variables
usb-keyboard.c File Reference
`#include "atKeynames.h"`
`#include "usb-private.h"`
`#include "usb-keyboard.h"`
`#include <xkbsrv.h>`

## Defines
#define | USB_KEYBOARD_DEBUG 0
#define | GETPRIV
#define | LOG0(f) dmxLog(dmxDebug,f)
#define | LOG1(f, a) dmxLog(dmxDebug,f,a)
#define | LOG2(f, a, b) dmxLog(dmxDebug,f,a,b)
#define | LOG3(f, a, b, c) dmxLog(dmxDebug,f,a,b,c)
#define | FATAL0(f) dmxLog(dmxFatal,f)
#define | FATAL1(f, a) dmxLog(dmxFatal,f,a)
#define | FATAL2(f, a, b) dmxLog(dmxFatal,f,a,b)
#define | MOTIONPROC dmxMotionProcPtr
#define | ENQUEUEPROC dmxEnqueueProcPtr
#define | CHECKPROC dmxCheckSpecialProcPtr
#define | BLOCK DMXBlockType
#define | GLYPHS_PER_KEY 4
#define | NUM_KEYCODES 248
#define | MIN_KEYCODE 8
#define | MAX_KEYCODE (NUM_KEYCODES + MIN_KEYCODE - 1)
## Functions
static int | kbdUSBKeyDown (myPrivate *priv, int keyCode)
static void | kbdUSBKeyState (myPrivate *priv, int type, int keyCode)
void | kbdUSBCtrl (DevicePtr pDev, KeybdCtrl *ctrl)
void | kbdUSBInit (DevicePtr pDev)
static void | kbdUSBConvert (DevicePtr pDev, unsigned int scanCode, int value, ENQUEUEPROC enqueue, CHECKPROC checkspecial, BLOCK block)
void | kbdUSBRead (DevicePtr pDev, MOTIONPROC motion, ENQUEUEPROC enqueue, CHECKPROC checkspecial, BLOCK block)
int | kbdUSBOn (DevicePtr pDev)
static void | kbdUSBGetMap (DevicePtr pDev, KeySymsPtr pKeySyms, CARD8 *pModMap)
void | kbdUSBGetInfo (DevicePtr pDev, DMXLocalInitInfoPtr info)
## Variables
static KeySym | map [NUM_KEYCODES *GLYPHS_PER_KEY]

## Detailed Description

This code implements a low-level device driver for a USB keyboard under Linux. The keymap description is derived from code by Thomas Roell, Orest Zborowski.

## Define Documentation

#define BLOCK DMXBlockType

#define CHECKPROC dmxCheckSpecialProcPtr

#define ENQUEUEPROC dmxEnqueueProcPtr

#define FATAL0 | ( |  | f | ) | dmxLog(dmxFatal,f)

#define FATAL1 | ( |  | f,
|  |  | a
| ) |  | dmxLog(dmxFatal,f,a)

#define FATAL2 | ( |  | f,
|  |  | a,
|  |  | b
| ) |  | dmxLog(dmxFatal,f,a,b)

#define GETPRIV

Value:

    myPrivate *priv                            \
                          = ((DMXLocalInputInfoPtr)(pDev->devicePrivate))->private

Referenced by kbdUSBConvert(), kbdUSBCtrl(), kbdUSBOn(), and kbdUSBRead().

#define GLYPHS_PER_KEY 4

Referenced by kbdLinuxGetMap(), kbdLinuxReadKernelMapping(), and kbdUSBGetMap().

#define LOG0 | ( |  | f | ) | dmxLog(dmxDebug,f)

#define LOG1 | ( |  | f,
|  |  | a
| ) |  | dmxLog(dmxDebug,f,a)

#define LOG2 | ( |  | f,
|  |  | a,
|  |  | b
| ) |  | dmxLog(dmxDebug,f,a,b)

#define LOG3 | ( |  | f,
|  |  | a,
|  |  | b,
|  |  | c
| ) |  | dmxLog(dmxDebug,f,a,b,c)

Referenced by kbdUSBRead().

#define MAX_KEYCODE (NUM_KEYCODES + MIN_KEYCODE - 1)

Referenced by kbdLinuxGetMap(), and kbdUSBGetMap().

#define MIN_KEYCODE 8

Referenced by kbdLinuxConvert(), kbdLinuxGetMap(), kbdUSBConvert(), and kbdUSBGetMap().

#define MOTIONPROC dmxMotionProcPtr

#define NUM_KEYCODES 248

Referenced by kbdLinuxGetMap(), and kbdUSBGetMap().

#define USB_KEYBOARD_DEBUG 0

## Function Documentation

static void kbdUSBConvert | ( | DevicePtr | pDev,
|  | unsigned int | scanCode,
|  | int | value,
|  | ENQUEUEPROC | enqueue,
|  | CHECKPROC | checkspecial,
|  | BLOCK | block
| ) |  | `[static]`

References GETPRIV, kbdLinuxKeyDown(), kbdUSBKeyDown(), kbdUSBKeyState(), and MIN_KEYCODE.

Referenced by kbdUSBRead().

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

Set the LEDs.

References GETPRIV.

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

Fill the info structure with information needed to initialize pDev.

References _DMXLocalInitInfo::focusClass, _DMXLocalInitInfo::force, _DMXLocalInitInfo::kbdFeedbackClass, kbdUSBGetMap(), _DMXLocalInitInfo::keyboard, _DMXLocalInitInfo::keyClass, _DMXLocalInitInfo::keySyms, _DMXLocalInitInfo::modMap, and _DMXLocalInitInfo::names.

static void kbdUSBGetMap | ( | DevicePtr | pDev,
|  | KeySymsPtr | pKeySyms,
|  | CARD8 * | pModMap
| ) |  | `[static]`

References GLYPHS_PER_KEY, map, MAX_KEYCODE, MIN_KEYCODE, and NUM_KEYCODES.

Referenced by kbdUSBGetInfo().

void kbdUSBInit | ( | DevicePtr | pDev | ) |

Initialize pDev using usbInit.

References usbInit(), and usbKeyboard.

Referenced by kbdUSBOn().

static int kbdUSBKeyDown | ( | myPrivate * | priv,
|  | int | keyCode
| ) |  | `[static]`

References _myPrivate::kbdState, and NUM_STATE_ENTRIES.

Referenced by kbdUSBConvert().

static void kbdUSBKeyState | ( | myPrivate * | priv,
|  | int | type,
|  | int | keyCode
| ) |  | `[static]`

References _myPrivate::kbdState, and NUM_STATE_ENTRIES.

Referenced by kbdUSBConvert().

int kbdUSBOn | ( | DevicePtr | pDev | ) |

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

References GETPRIV, and kbdUSBInit().

void kbdUSBRead | ( | 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.

References GETPRIV, kbdUSBConvert(), and LOG3.

## Variable Documentation

KeySym map[NUM_KEYCODES *GLYPHS_PER_KEY]`[static]`

Referenced by kbdLinuxGetMap(), kbdLinuxReadKernelMapping(), and kbdUSBGetMap().