Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Functions | Variables
keyboard.c File Reference
#include <linux/consolemap.h>
#include <linux/module.h>
#include <linux/sched.h>
#include <linux/tty.h>
#include <linux/tty_flip.h>
#include <linux/mm.h>
#include <linux/string.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/kbd_kern.h>
#include <linux/kbd_diacr.h>
#include <linux/vt_kern.h>
#include <linux/input.h>
#include <linux/reboot.h>
#include <linux/notifier.h>
#include <linux/jiffies.h>
#include <linux/uaccess.h>
#include <asm/irq_regs.h>

Go to the source code of this file.

Data Structures

struct  ledptr
 
struct  getset_keycode_data
 

Macros

#define pr_fmt(fmt)   KBUILD_MODNAME ": " fmt
 
#define KBD_DEFMODE   ((1 << VC_REPEAT) | (1 << VC_META))
 
#define KBD_DEFLOCK   0
 
#define K_HANDLERS
 
#define FN_HANDLERS
 
#define HW_RAW(dev)   0
 
#define i   (tmp.kb_index)
 
#define s   (tmp.kb_table)
 
#define v   (tmp.kb_value)
 

Typedefs

typedef voidk_handler_fn )(struct vc_data *vc, unsigned char value, char up_flag)
 
typedef voidfn_handler_fn )(struct vc_data *vc)
 

Functions

void ctrl_alt_del (void)
 
int register_keyboard_notifier (struct notifier_block *nb)
 
 EXPORT_SYMBOL_GPL (register_keyboard_notifier)
 
int unregister_keyboard_notifier (struct notifier_block *nb)
 
 EXPORT_SYMBOL_GPL (unregister_keyboard_notifier)
 
void kd_mksound (unsigned int hz, unsigned int ticks)
 
 EXPORT_SYMBOL (kd_mksound)
 
int kbd_rate (struct kbd_repeat *rep)
 
void compute_shiftstate (void)
 
 MODULE_PARM_DESC (brl_timeout,"Braille keys release delay in ms (0 for commit on first key release)")
 
 module_param (brl_timeout, uint, 0644)
 
 MODULE_PARM_DESC (brl_nbchords,"Number of chords that produce a braille pattern (0 for dead chords)")
 
 module_param (brl_nbchords, uint, 0644)
 
void setledstate (struct kbd_struct *kbd, unsigned int led)
 
int vt_get_leds (int console, int flag)
 
 EXPORT_SYMBOL_GPL (vt_get_leds)
 
void vt_set_led_state (int console, int leds)
 
void vt_kbd_con_start (int console)
 
void vt_kbd_con_stop (int console)
 
 DECLARE_TASKLET_DISABLED (keyboard_tasklet, kbd_bh, 0)
 
 MODULE_DEVICE_TABLE (input, kbd_ids)
 
int __init kbd_init (void)
 
int vt_do_diacrit (unsigned int cmd, void __user *up, int perm)
 
int vt_do_kdskbmode (int console, unsigned int arg)
 
int vt_do_kdskbmeta (int console, unsigned int arg)
 
int vt_do_kbkeycode_ioctl (int cmd, struct kbkeycode __user *user_kbkc, int perm)
 
int vt_do_kdsk_ioctl (int cmd, struct kbentry __user *user_kbe, int perm, int console)
 
int vt_do_kdgkb_ioctl (int cmd, struct kbsentry __user *user_kdgkb, int perm)
 
int vt_do_kdskled (int console, int cmd, unsigned long arg, int perm)
 
int vt_do_kdgkbmode (int console)
 
int vt_do_kdgkbmeta (int console)
 
void vt_reset_unicode (int console)
 
int vt_get_shift_state (void)
 
void vt_reset_keyboard (int console)
 
int vt_get_kbd_mode_bit (int console, int bit)
 
void vt_set_kbd_mode_bit (int console, int bit)
 
void vt_clr_kbd_mode_bit (int console, int bit)
 

Variables

struct vt_spawn_console vt_spawn_con
 

Macro Definition Documentation

#define FN_HANDLERS
Value:
fn_null, fn_enter, fn_show_ptregs, fn_show_mem,\
fn_show_state, fn_send_intr, fn_lastcons, fn_caps_toggle,\
fn_num, fn_hold, fn_scroll_forw, fn_scroll_back,\
fn_boot_it, fn_caps_on, fn_compose, fn_SAK,\
fn_dec_console, fn_inc_console, fn_spawn_con, fn_bare_num

Definition at line 82 of file keyboard.c.

#define HW_RAW (   dev)    0

Definition at line 1236 of file keyboard.c.

#define i   (tmp.kb_index)

Definition at line 1796 of file keyboard.c.

#define K_HANDLERS
Value:
k_self, k_fn, k_spec, k_pad,\
k_dead, k_cons, k_cur, k_shift,\
k_meta, k_ascii, k_lock, k_lowercase,\
k_slock, k_dead2, k_brl, k_ignore

Definition at line 71 of file keyboard.c.

#define KBD_DEFLOCK   0

Definition at line 65 of file keyboard.c.

#define KBD_DEFMODE   ((1 << VC_REPEAT) | (1 << VC_META))

Definition at line 54 of file keyboard.c.

#define pr_fmt (   fmt)    KBUILD_MODNAME ": " fmt

Definition at line 25 of file keyboard.c.

const PCI_IO_ADDR addr const PCI_IO_ADDR addr u8 PCI_IO_ADDR addr u32 PCI_IO_ADDR addr u32 PCI_IO_ADDR addr unsigned long port u8 unsigned long port u32 unsigned long port const PCI_IO_ADDR void unsigned long a PCI_IO_ADDR const void unsigned long a PCI_IO_ADDR const void unsigned long a unsigned long void unsigned long p unsigned long const void unsigned long p unsigned long const void unsigned long p void const PCI_IO_ADDR unsigned long s   (tmp.kb_table)

Definition at line 1797 of file keyboard.c.

#define v   (tmp.kb_value)

Definition at line 1798 of file keyboard.c.

Typedef Documentation

typedef void( fn_handler_fn)(struct vc_data *vc)

Definition at line 89 of file keyboard.c.

typedef void( k_handler_fn)(struct vc_data *vc, unsigned char value, char up_flag)

Definition at line 77 of file keyboard.c.

Function Documentation

void compute_shiftstate ( void  )

Definition at line 415 of file keyboard.c.

void ctrl_alt_del ( void  )

Definition at line 530 of file sys.c.

DECLARE_TASKLET_DISABLED ( keyboard_tasklet  ,
kbd_bh  ,
 
)
EXPORT_SYMBOL ( kd_mksound  )
EXPORT_SYMBOL_GPL ( register_keyboard_notifier  )
EXPORT_SYMBOL_GPL ( unregister_keyboard_notifier  )
EXPORT_SYMBOL_GPL ( vt_get_leds  )
int __init kbd_init ( void  )

Definition at line 1517 of file keyboard.c.

int kbd_rate ( struct kbd_repeat rep)

Definition at line 295 of file keyboard.c.

void kd_mksound ( unsigned int  hz,
unsigned int  ticks 
)

Definition at line 259 of file keyboard.c.

MODULE_DEVICE_TABLE ( input  ,
kbd_ids   
)
module_param ( brl_timeout  ,
uint  ,
0644   
)
module_param ( brl_nbchords  ,
uint  ,
0644   
)
MODULE_PARM_DESC ( brl_timeout  ,
"Braille keys release delay in ms (0 for commit on first key release)"   
)
MODULE_PARM_DESC ( brl_nbchords  ,
"Number of chords that produce a braille pattern (0 for dead chords)"   
)
int register_keyboard_notifier ( struct notifier_block nb)

Definition at line 146 of file keyboard.c.

void setledstate ( struct kbd_struct kbd,
unsigned int  led 
)

Definition at line 993 of file keyboard.c.

int unregister_keyboard_notifier ( struct notifier_block nb)

Definition at line 152 of file keyboard.c.

void vt_clr_kbd_mode_bit ( int  console,
int  bit 
)

vt_clr_kbd_mode_bit - read keyboard status bits : console to read from : mode bit to read

Report back a vt mode bit. We do this without locking so the caller must be sure that there are no synchronization needs

Definition at line 2189 of file keyboard.c.

int vt_do_diacrit ( unsigned int  cmd,
void __user up,
int  perm 
)

vt_do_diacrit - diacritical table updates : ioctl request : pointer to user data for ioctl : permissions check computed by caller

Update the diacritical tables atomically and safely. Lock them against simultaneous keypresses

Definition at line 1553 of file keyboard.c.

int vt_do_kbkeycode_ioctl ( int  cmd,
struct kbkeycode __user user_kbkc,
int  perm 
)

Definition at line 1773 of file keyboard.c.

int vt_do_kdgkb_ioctl ( int  cmd,
struct kbsentry __user user_kdgkb,
int  perm 
)

Definition at line 1906 of file keyboard.c.

int vt_do_kdgkbmeta ( int  console)

vt_do_kdgkbmeta - report meta status : console to report

Report the meta flag status of this console

Definition at line 2084 of file keyboard.c.

int vt_do_kdgkbmode ( int  console)

Definition at line 2060 of file keyboard.c.

int vt_do_kdsk_ioctl ( int  cmd,
struct kbentry __user user_kbe,
int  perm,
int  console 
)

Definition at line 1800 of file keyboard.c.

int vt_do_kdskbmeta ( int  console,
unsigned int  arg 
)

vt_do_kdskbmeta - set keyboard meta state : the console to use

  • : the requested meta state

Update the keyboard meta bits while holding the correct locks. Return 0 for success or an error code.

Definition at line 1752 of file keyboard.c.

int vt_do_kdskbmode ( int  console,
unsigned int  arg 
)

vt_do_kdskbmode - set keyboard mode ioctl : the console to use

  • : the requested mode

Update the keyboard mode bits while holding the correct locks. Return 0 for success or an error code.

Definition at line 1712 of file keyboard.c.

int vt_do_kdskled ( int  console,
int  cmd,
unsigned long  arg,
int  perm 
)

Definition at line 2018 of file keyboard.c.

int vt_get_kbd_mode_bit ( int  console,
int  bit 
)

vt_get_kbd_mode_bit - read keyboard status bits : console to read from : mode bit to read

Report back a vt mode bit. We do this without locking so the caller must be sure that there are no synchronization needs

Definition at line 2155 of file keyboard.c.

int vt_get_leds ( int  console,
int  flag 
)

vt_get_leds - helper for braille console : console to read : flag we want to check

Check the status of a keyboard led flag and report it back

Definition at line 1051 of file keyboard.c.

int vt_get_shift_state ( void  )

vt_get_shiftstate - shift bit state

Report the shift bits from the keyboard state. We have to export this to support some oddities in the vt layer.

Definition at line 2112 of file keyboard.c.

void vt_kbd_con_start ( int  console)

vt_kbd_con_start - Keyboard side of console start : console

Handle console start. This is a wrapper for the VT layer so that we can keep kbd knowledge internal

FIXME: We eventually need to hold the kbd lock here to protect the LED updating. We can't do it yet because fn_hold calls stop_tty and start_tty under the kbd_event_lock, while normal tty paths don't hold the lock. We probably need to split out an LED lock but not during an -rc release!

Definition at line 1092 of file keyboard.c.

void vt_kbd_con_stop ( int  console)

vt_kbd_con_stop - Keyboard side of console stop : console

Handle console stop. This is a wrapper for the VT layer so that we can keep kbd knowledge internal

Definition at line 1109 of file keyboard.c.

void vt_reset_keyboard ( int  console)

vt_reset_keyboard - reset keyboard state : console to reset

Reset the keyboard bits for a console as part of a general console reset event

Definition at line 2125 of file keyboard.c.

void vt_reset_unicode ( int  console)

vt_reset_unicode - reset the unicode status : console being reset

Restore the unicode console state to its default

Definition at line 2097 of file keyboard.c.

void vt_set_kbd_mode_bit ( int  console,
int  bit 
)

vt_set_kbd_mode_bit - read keyboard status bits : console to read from : mode bit to read

Set a vt mode bit. We do this without locking so the caller must be sure that there are no synchronization needs

Definition at line 2170 of file keyboard.c.

void vt_set_led_state ( int  console,
int  leds 
)

vt_set_led_state - set LED state of a console : console to set : LED bits

Set the LEDs on a console. This is a wrapper for the VT layer so that we can keep kbd knowledge internal

Definition at line 1073 of file keyboard.c.

Variable Documentation

struct vt_spawn_console vt_spawn_con
Initial value:
= {
.pid = NULL,
.sig = 0,
}

Definition at line 97 of file keyboard.c.