/branches/network/uspace/srv/kbd/ctl/pc.c |
---|
32,12 → 32,12 |
*/ |
/** |
* @file |
* @brief PC keyboard controller driver. |
* @brief PC keyboard controller driver. |
*/ |
#include <kbd.h> |
#include <kbd/kbd.h> |
#include <kbd/keycode.h> |
#include <io/console.h> |
#include <io/keycode.h> |
#include <kbd_ctl.h> |
#include <gsp.h> |
188,7 → 188,7 |
void kbd_ctl_parse_scancode(int scancode) |
{ |
kbd_ev_type_t type; |
console_ev_type_t type; |
unsigned int key; |
int *map; |
size_t map_length; |
213,9 → 213,9 |
if (scancode & 0x80) { |
scancode &= ~0x80; |
type = KE_RELEASE; |
type = KEY_RELEASE; |
} else { |
type = KE_PRESS; |
type = KEY_PRESS; |
} |
if (scancode < 0 || scancode >= map_length) |
/branches/network/uspace/srv/kbd/ctl/stty.c |
---|
36,8 → 36,7 |
*/ |
#include <kbd.h> |
#include <kbd/kbd.h> |
#include <kbd/keycode.h> |
#include <io/keycode.h> |
#include <kbd_ctl.h> |
#include <gsp.h> |
#include <stroke.h> |
/branches/network/uspace/srv/kbd/ctl/sun.c |
---|
36,8 → 36,8 |
*/ |
#include <kbd.h> |
#include <kbd/kbd.h> |
#include <kbd/keycode.h> |
#include <io/console.h> |
#include <io/keycode.h> |
#include <kbd_ctl.h> |
#define KBD_KEY_RELEASE 0x80 |
52,7 → 52,7 |
void kbd_ctl_parse_scancode(int scancode) |
{ |
kbd_ev_type_t type; |
console_ev_type_t type; |
unsigned int key; |
if (scancode < 0 || scancode >= 0x100) |
63,9 → 63,9 |
if (scancode & KBD_KEY_RELEASE) { |
scancode &= ~KBD_KEY_RELEASE; |
type = KE_RELEASE; |
type = KEY_RELEASE; |
} else { |
type = KE_PRESS; |
type = KEY_PRESS; |
} |
key = scanmap_simple[scancode]; |
/branches/network/uspace/srv/kbd/ctl/gxe_fb.c |
---|
36,8 → 36,8 |
*/ |
#include <kbd.h> |
#include <kbd/kbd.h> |
#include <kbd/keycode.h> |
#include <io/console.h> |
#include <io/keycode.h> |
#include <kbd_ctl.h> |
#include <gsp.h> |
#include <stroke.h> |
/branches/network/uspace/srv/kbd/include/key_buffer.h |
---|
File deleted |
/branches/network/uspace/srv/kbd/include/gsp.h |
---|
37,7 → 37,7 |
#ifndef KBD_GSP_H_ |
#define KBD_GSP_H_ |
#include <libadt/hash_table.h> |
#include <adt/hash_table.h> |
enum { |
GSP_END = -1, /**< Terminates a sequence. */ |
/branches/network/uspace/srv/kbd/include/layout.h |
---|
27,10 → 27,10 |
*/ |
/** @addtogroup kbdgen generic |
* @brief HelenOS generic uspace keyboard handler. |
* @ingroup kbd |
* @brief HelenOS generic uspace keyboard handler. |
* @ingroup kbd |
* @{ |
*/ |
*/ |
/** @file |
*/ |
37,12 → 37,12 |
#ifndef KBD_LAYOUT_H_ |
#define KBD_LAYOUT_H_ |
#include <kbd/kbd.h> |
#include <sys/types.h> |
#include <io/console.h> |
typedef struct { |
void (*reset)(void); |
wchar_t (*parse_ev)(kbd_event_t *); |
wchar_t (*parse_ev)(console_event_t *); |
} layout_op_t; |
extern layout_op_t us_qwerty_op; |
53,5 → 53,4 |
/** |
* @} |
*/ |
*/ |
/branches/network/uspace/srv/kbd/include/kbd.h |
---|
27,10 → 27,10 |
*/ |
/** @addtogroup kbdgen generic |
* @brief HelenOS generic uspace keyboard handler. |
* @ingroup kbd |
* @brief HelenOS generic uspace keyboard handler. |
* @ingroup kbd |
* @{ |
*/ |
*/ |
/** @file |
*/ |
37,14 → 37,20 |
#ifndef KBD_KBD_H_ |
#define KBD_KBD_H_ |
#include <key_buffer.h> |
#include <keybuffer.h> |
#include <ipc/ipc.h> |
#define KBD_EVENT 1024 |
#define KBD_MS_LEFT 1025 |
#define KBD_MS_RIGHT 1026 |
#define KBD_MS_MIDDLE 1027 |
#define KBD_MS_MOVE 1028 |
#define KBD_EVENT 1024 |
#define KBD_MS_LEFT 1025 |
#define KBD_MS_RIGHT 1026 |
#define KBD_MS_MIDDLE 1027 |
#define KBD_MS_MOVE 1028 |
typedef enum { |
KBD_YIELD = IPC_FIRST_USER_METHOD, |
KBD_RECLAIM |
} kbd_request_t; |
extern int cir_service; |
extern int cir_phone; |
55,5 → 61,4 |
/** |
* @} |
*/ |
*/ |
/branches/network/uspace/srv/kbd/include/keybuffer.h |
---|
0,0 → 1,65 |
/* |
* Copyright (c) 2006 Josef Cejka |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
/** @addtogroup kbdgen |
* @brief HelenOS generic uspace keyboard handler. |
* @ingroup kbd |
* @{ |
*/ |
/** @file |
*/ |
#ifndef __KEYBUFFER_H__ |
#define __KEYBUFFER_H__ |
#include <sys/types.h> |
#include <io/console.h> |
#include <bool.h> |
/** Size of buffer for pressed keys */ |
#define KEYBUFFER_SIZE 128 |
typedef struct { |
console_event_t fifo[KEYBUFFER_SIZE]; |
unsigned long head; |
unsigned long tail; |
unsigned long items; |
} keybuffer_t; |
extern void keybuffer_free(keybuffer_t *); |
extern void keybuffer_init(keybuffer_t *); |
extern size_t keybuffer_available(keybuffer_t *); |
extern bool keybuffer_empty(keybuffer_t *); |
extern void keybuffer_push(keybuffer_t *, const console_event_t *); |
extern bool keybuffer_pop(keybuffer_t *, console_event_t *); |
#endif |
/** |
* @} |
*/ |
/branches/network/uspace/srv/kbd/include/kbd_port.h |
---|
38,6 → 38,8 |
#define KBD_PORT_H_ |
extern int kbd_port_init(void); |
extern void kbd_port_yield(void); |
extern void kbd_port_reclaim(void); |
#endif |
/branches/network/uspace/srv/kbd/port/gxemul.c |
---|
69,6 → 69,14 |
return 0; |
} |
void kbd_port_yield(void) |
{ |
} |
void kbd_port_reclaim(void) |
{ |
} |
/** Process data sent when a key is pressed. |
* |
* @param keybuffer Buffer of pressed keys. |
/branches/network/uspace/srv/kbd/port/ns16550.c |
---|
106,6 → 106,14 |
return pio_enable((void *) ns16550_physical, 8, &vaddr); |
} |
void ns16550_port_yield(void) |
{ |
} |
void ns16550_port_reclaim(void) |
{ |
} |
static void ns16550_irq_handler(ipc_callid_t iid, ipc_call_t *call) |
{ |
int scan_code = IPC_GET_ARG2(*call); |
/branches/network/uspace/srv/kbd/port/msim.c |
---|
69,22 → 69,17 |
return 0; |
} |
void kbd_port_yield(void) |
{ |
} |
void kbd_port_reclaim(void) |
{ |
} |
static void msim_irq_handler(ipc_callid_t iid, ipc_call_t *call) |
{ |
int scan_code = IPC_GET_ARG2(*call); |
// static int esc_count=0; |
// if (scan_code == 0x1b) { |
// esc_count++; |
// if (esc_count == 3) |
// __SYSCALL0(SYS_DEBUG_ENABLE_CONSOLE); |
// } else { |
// esc_count=0; |
// } |
// if (fb_fb) |
// return kbd_arch_process_fb(keybuffer, scan_code); |
kbd_push_scancode(scan_code); |
} |
/branches/network/uspace/srv/kbd/port/sun.c |
---|
62,5 → 62,13 |
return -1; |
} |
void kbd_port_yield(void) |
{ |
} |
void kbd_port_reclaim(void) |
{ |
} |
/** @} |
*/ |
/branches/network/uspace/srv/kbd/port/i8042.c |
---|
151,6 → 151,14 |
return 0; |
} |
void kbd_port_yield(void) |
{ |
} |
void kbd_port_reclaim(void) |
{ |
} |
static void i8042_irq_handler(ipc_callid_t iid, ipc_call_t *call) |
{ |
int status = IPC_GET_ARG1(*call); |
/branches/network/uspace/srv/kbd/port/ski.c |
---|
42,6 → 42,7 |
#include <kbd_port.h> |
#include <sys/types.h> |
#include <thread.h> |
#include <bool.h> |
#define SKI_GETCHAR 21 |
50,6 → 51,8 |
static void *ski_thread_impl(void *arg); |
static int32_t ski_getchar(void); |
static volatile bool polling_disabled = false; |
/** Initialize Ski port driver. */ |
int kbd_port_init(void) |
{ |
64,6 → 67,16 |
return 0; |
} |
void kbd_port_yield(void) |
{ |
polling_disabled = true; |
} |
void kbd_port_reclaim(void) |
{ |
polling_disabled = false; |
} |
/** Thread to poll Ski for keypresses. */ |
static void *ski_thread_impl(void *arg) |
{ |
71,7 → 84,7 |
(void) arg; |
while (1) { |
while (1) { |
while (polling_disabled == false) { |
c = ski_getchar(); |
if (c == 0) |
break; |
/branches/network/uspace/srv/kbd/port/z8530.c |
---|
95,6 → 95,14 |
return 0; |
} |
void z8530_port_yield(void) |
{ |
} |
void z8530_port_reclaim(void) |
{ |
} |
static void z8530_irq_handler(ipc_callid_t iid, ipc_call_t *call) |
{ |
int scan_code = IPC_GET_ARG2(*call); |
/branches/network/uspace/srv/kbd/port/sgcn.c |
---|
42,6 → 42,7 |
#include <sysinfo.h> |
#include <stdio.h> |
#include <thread.h> |
#include <bool.h> |
#define POLL_INTERVAL 10000 |
92,6 → 93,7 |
/* polling thread */ |
static void *sgcn_thread_impl(void *arg); |
static volatile bool polling_disabled = false; |
/** |
* Initializes the SGCN driver. |
120,6 → 122,16 |
return 0; |
} |
void kbd_port_yield(void) |
{ |
polling_disabled = true; |
} |
void kbd_port_reclaim(void) |
{ |
polling_disabled = false; |
} |
/** |
* Handler of the "key pressed" event. Reads codes of all the pressed keys from |
* the buffer. |
154,11 → 166,11 |
(void) arg; |
while (1) { |
sgcn_key_pressed(); |
if (polling_disabled == false) |
sgcn_key_pressed(); |
usleep(POLL_INTERVAL); |
} |
} |
/** @} |
*/ |
/branches/network/uspace/srv/kbd/port/dummy.c |
---|
42,5 → 42,13 |
return 0; |
} |
void kbd_port_yield(void) |
{ |
} |
void kbd_port_reclaim(void) |
{ |
} |
/** @} |
*/ |
/branches/network/uspace/srv/kbd/genarch/stroke.c |
---|
31,17 → 31,18 |
*/ |
/** |
* @file |
* @brief Stroke simulator. |
* @brief Stroke simulator. |
* |
* When simulating a keyboard using a serial TTY we need to convert the |
* recognized strokes (such as Shift-A) to sequences of key presses and |
* releases (such as 'press Shift, press A, release A, release Shift'). |
* |
*/ |
#include <stroke.h> |
#include <kbd.h> |
#include <kbd/kbd.h> |
#include <kbd/keycode.h> |
#include <io/console.h> |
#include <io/keycode.h> |
/** Correspondence between modifers and the modifier keycodes. */ |
static unsigned int mods_keys[][2] = { |
58,7 → 59,7 |
i = 0; |
while (mods_keys[i][0] != 0) { |
if (mod & mods_keys[i][0]) { |
kbd_push_ev(KE_PRESS, mods_keys[i][1]); |
kbd_push_ev(KEY_PRESS, mods_keys[i][1]); |
} |
++i; |
} |
65,8 → 66,8 |
/* Simulate key press and release. */ |
if (key != 0) { |
kbd_push_ev(KE_PRESS, key); |
kbd_push_ev(KE_RELEASE, key); |
kbd_push_ev(KEY_PRESS, key); |
kbd_push_ev(KEY_RELEASE, key); |
} |
/* Simulate modifier releases. */ |
73,7 → 74,7 |
i = 0; |
while (mods_keys[i][0] != 0) { |
if (mod & mods_keys[i][0]) { |
kbd_push_ev(KE_RELEASE, mods_keys[i][1]); |
kbd_push_ev(KEY_RELEASE, mods_keys[i][1]); |
} |
++i; |
} |
81,4 → 82,4 |
/** |
* @} |
*/ |
*/ |
/branches/network/uspace/srv/kbd/genarch/gsp.c |
---|
49,7 → 49,7 |
*/ |
#include <gsp.h> |
#include <libadt/hash_table.h> |
#include <adt/hash_table.h> |
#include <stdlib.h> |
#include <stdio.h> |
/branches/network/uspace/srv/kbd/generic/key_buffer.c |
---|
File deleted |
/branches/network/uspace/srv/kbd/generic/kbd.c |
---|
28,10 → 28,10 |
/** |
* @addtogroup kbdgen generic |
* @brief HelenOS generic uspace keyboard handler. |
* @ingroup kbd |
* @brief HelenOS generic uspace keyboard handler. |
* @ingroup kbd |
* @{ |
*/ |
*/ |
/** @file |
*/ |
45,12 → 45,12 |
#include <ipc/ns.h> |
#include <async.h> |
#include <errno.h> |
#include <libadt/fifo.h> |
#include <kbd/kbd.h> |
#include <kbd/keycode.h> |
#include <adt/fifo.h> |
#include <io/console.h> |
#include <io/keycode.h> |
#include <kbd.h> |
#include <key_buffer.h> |
#include <keybuffer.h> |
#include <kbd_port.h> |
#include <kbd_ctl.h> |
#include <layout.h> |
88,7 → 88,7 |
void kbd_push_ev(int type, unsigned int key) |
{ |
kbd_event_t ev; |
console_event_t ev; |
unsigned mod_mask; |
switch (key) { |
102,7 → 102,7 |
} |
if (mod_mask != 0) { |
if (type == KE_PRESS) |
if (type == KEY_PRESS) |
mods = mods | mod_mask; |
else |
mods = mods & ~mod_mask; |
116,7 → 116,7 |
} |
if (mod_mask != 0) { |
if (type == KE_PRESS) { |
if (type == KEY_PRESS) { |
/* |
* Only change lock state on transition from released |
* to pressed. This prevents autorepeat from messing |
133,7 → 133,7 |
printf("mods: 0x%x\n", mods); |
printf("keycode: %u\n", key); |
*/ |
if (type == KE_PRESS && (mods & KM_LCTRL) && |
if (type == KEY_PRESS && (mods & KM_LCTRL) && |
key == KC_F1) { |
active_layout = 0; |
layout[active_layout]->reset(); |
140,7 → 140,7 |
return; |
} |
if (type == KE_PRESS && (mods & KM_LCTRL) && |
if (type == KEY_PRESS && (mods & KM_LCTRL) && |
key == KC_F2) { |
active_layout = 1; |
layout[active_layout]->reset(); |
147,7 → 147,7 |
return; |
} |
if (type == KE_PRESS && (mods & KM_LCTRL) && |
if (type == KEY_PRESS && (mods & KM_LCTRL) && |
key == KC_F3) { |
active_layout = 2; |
layout[active_layout]->reset(); |
193,6 → 193,14 |
phone2cons = IPC_GET_ARG5(call); |
retval = 0; |
break; |
case KBD_YIELD: |
kbd_port_yield(); |
retval = 0; |
break; |
case KBD_RECLAIM: |
kbd_port_reclaim(); |
retval = 0; |
break; |
default: |
retval = EINVAL; |
} |
/branches/network/uspace/srv/kbd/generic/keybuffer.c |
---|
0,0 → 1,132 |
/* |
* Copyright (c) 2006 Josef Cejka |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
/** @addtogroup kbdgen |
* @brief HelenOS generic uspace keyboard handler. |
* @ingroup kbd |
* @{ |
*/ |
/** @file |
*/ |
#include <keybuffer.h> |
#include <futex.h> |
atomic_t keybuffer_futex = FUTEX_INITIALIZER; |
/** Clear key buffer. |
*/ |
void keybuffer_free(keybuffer_t *keybuffer) |
{ |
futex_down(&keybuffer_futex); |
keybuffer->head = 0; |
keybuffer->tail = 0; |
keybuffer->items = 0; |
futex_up(&keybuffer_futex); |
} |
/** Key buffer initialization. |
* |
*/ |
void keybuffer_init(keybuffer_t *keybuffer) |
{ |
keybuffer_free(keybuffer); |
} |
/** Get free space in buffer. |
* |
* This function is useful for processing some scancodes that are translated |
* to more than one character. |
* |
* @return empty buffer space |
* |
*/ |
size_t keybuffer_available(keybuffer_t *keybuffer) |
{ |
return KEYBUFFER_SIZE - keybuffer->items; |
} |
/** |
* |
* @return nonzero, if buffer is not empty. |
* |
*/ |
bool keybuffer_empty(keybuffer_t *keybuffer) |
{ |
return (keybuffer->items == 0); |
} |
/** Push key event to key buffer. |
* |
* If the buffer is full, the event is ignored. |
* |
* @param keybuffer The keybuffer. |
* @param ev The event to push. |
* |
*/ |
void keybuffer_push(keybuffer_t *keybuffer, const console_event_t *ev) |
{ |
futex_down(&keybuffer_futex); |
if (keybuffer->items < KEYBUFFER_SIZE) { |
keybuffer->fifo[keybuffer->tail] = *ev; |
keybuffer->tail = (keybuffer->tail + 1) % KEYBUFFER_SIZE; |
keybuffer->items++; |
} |
futex_up(&keybuffer_futex); |
} |
/** Pop event from buffer. |
* |
* @param edst Pointer to where the event should be saved. |
* |
* @return True if an event was popped. |
* |
*/ |
bool keybuffer_pop(keybuffer_t *keybuffer, console_event_t *edst) |
{ |
futex_down(&keybuffer_futex); |
if (keybuffer->items > 0) { |
keybuffer->items--; |
*edst = (keybuffer->fifo[keybuffer->head]); |
keybuffer->head = (keybuffer->head + 1) % KEYBUFFER_SIZE; |
futex_up(&keybuffer_futex); |
return true; |
} |
futex_up(&keybuffer_futex); |
return false; |
} |
/** |
* @} |
*/ |
/branches/network/uspace/srv/kbd/Makefile |
---|
34,7 → 34,7 |
include $(LIBC_PREFIX)/Makefile.toolchain |
CFLAGS += -Iinclude -I../libadt/include |
CFLAGS += -Iinclude |
LIBS = $(LIBC_PREFIX)/libc.a |
46,7 → 46,7 |
generic/kbd.c \ |
genarch/gsp.c \ |
genarch/stroke.c \ |
generic/key_buffer.c |
generic/keybuffer.c |
ARCH_SOURCES = |
GENARCH_SOURCES = \ |
112,8 → 112,15 |
ifeq ($(MACHINE), bgxemul) |
GENARCH_SOURCES += \ |
port/gxemul.c \ |
ctl/stty.c |
port/gxemul.c |
ifeq ($(CONFIG_FB), y) |
GENARCH_SOURCES += \ |
ctl/gxe_fb.c |
else |
GENARCH_SOURCES += \ |
ctl/stty.c |
endif |
endif |
ifeq ($(UARCH), ppc32) |
160,7 → 167,7 |
disasm: $(OUTPUT).disasm |
$(OUTPUT).disasm: $(OUTPUT) |
$(OBJDUMP) -d $< >$@ |
$(OBJDUMP) -d $< > $@ |
%.o: %.S |
$(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@ |
/branches/network/uspace/srv/kbd/layout/us_qwerty.c |
---|
32,12 → 32,12 |
*/ |
#include <kbd.h> |
#include <kbd/kbd.h> |
#include <kbd/keycode.h> |
#include <io/console.h> |
#include <io/keycode.h> |
#include <layout.h> |
static void layout_reset(void); |
static wchar_t layout_parse_ev(kbd_event_t *ev); |
static wchar_t layout_parse_ev(console_event_t *ev); |
layout_op_t us_qwerty_op = { |
layout_reset, |
203,7 → 203,7 |
{ |
} |
static wchar_t layout_parse_ev(kbd_event_t *ev) |
static wchar_t layout_parse_ev(console_event_t *ev) |
{ |
wchar_t c; |
/branches/network/uspace/srv/kbd/layout/cz.c |
---|
27,23 → 27,23 |
*/ |
/** @addtogroup kbd |
* @brief US QWERTY leyout. |
* @brief US QWERTY leyout. |
* @{ |
*/ |
*/ |
#include <kbd.h> |
#include <kbd/kbd.h> |
#include <kbd/keycode.h> |
#include <io/console.h> |
#include <io/keycode.h> |
#include <bool.h> |
#include <layout.h> |
static void layout_reset(void); |
static wchar_t layout_parse_ev(kbd_event_t *ev); |
static wchar_t layout_parse_ev(console_event_t *ev); |
enum m_state { |
ms_start, |
ms_hacek, |
ms_carka |
ms_carka |
}; |
static enum m_state mstate; |
272,7 → 272,7 |
return map[key]; |
} |
static wchar_t parse_ms_hacek(kbd_event_t *ev) |
static wchar_t parse_ms_hacek(console_event_t *ev) |
{ |
wchar_t c; |
290,7 → 290,7 |
return c; |
} |
static wchar_t parse_ms_carka(kbd_event_t *ev) |
static wchar_t parse_ms_carka(console_event_t *ev) |
{ |
wchar_t c; |
308,7 → 308,7 |
return c; |
} |
static wchar_t parse_ms_start(kbd_event_t *ev) |
static wchar_t parse_ms_start(console_event_t *ev) |
{ |
wchar_t c; |
383,21 → 383,24 |
mstate = ms_start; |
} |
static wchar_t layout_parse_ev(kbd_event_t *ev) |
static wchar_t layout_parse_ev(console_event_t *ev) |
{ |
if (ev->type != KE_PRESS) |
return '\0'; |
if (ev->type != KEY_PRESS) |
return 0; |
if (key_is_mod(ev->key)) |
return '\0'; |
return 0; |
switch (mstate) { |
case ms_start: return parse_ms_start(ev); |
case ms_hacek: return parse_ms_hacek(ev); |
case ms_carka: return parse_ms_carka(ev); |
case ms_start: |
return parse_ms_start(ev); |
case ms_hacek: |
return parse_ms_hacek(ev); |
case ms_carka: |
return parse_ms_carka(ev); |
} |
} |
/** |
* @} |
*/ |
*/ |
/branches/network/uspace/srv/kbd/layout/us_dvorak.c |
---|
32,12 → 32,12 |
*/ |
#include <kbd.h> |
#include <kbd/kbd.h> |
#include <kbd/keycode.h> |
#include <io/console.h> |
#include <io/keycode.h> |
#include <layout.h> |
static void layout_reset(void); |
static wchar_t layout_parse_ev(kbd_event_t *ev); |
static wchar_t layout_parse_ev(console_event_t *ev); |
layout_op_t us_dvorak_op = { |
layout_reset, |
209,7 → 209,7 |
{ |
} |
static wchar_t layout_parse_ev(kbd_event_t *ev) |
static wchar_t layout_parse_ev(console_event_t *ev) |
{ |
wchar_t c; |