Changeset f89979b in mainline
- Timestamp:
- 2009-02-17T23:05:15Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 24ff4df
- Parents:
- 96e0748d
- Files:
-
- 13 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
HelenOS.config
r96e0748d rf89979b 393 393 % External ramdisk 394 394 ! [PLATFORM=sparc64] CONFIG_RD_EXTERNAL (y/n) 395 396 % Keyboard layout 397 @ "us_qwerty" US QWERTY 398 @ "us_dvorak" US Dvorak 399 ! KBD_LAYOUT (choice) -
uspace/lib/libc/generic/io/stream.c
r96e0748d rf89979b 68 68 rc = kbd_get_event(&ev); 69 69 if (rc < 0) return -1; 70 } while (ev.c == 0 );70 } while (ev.c == 0 || ev.type == KE_RELEASE); 71 71 72 72 ((char *) buf)[i++] = ev.c; -
uspace/lib/libc/generic/kbd.c
r96e0748d rf89979b 51 51 52 52 ev->type = r0; 53 ev-> c= r1;54 ev-> key= r2;55 ev-> mods= r3;53 ev->key = r1; 54 ev->mods = r2; 55 ev->c = r3; 56 56 57 57 return 0; -
uspace/lib/libc/include/kbd/keycode.h
r96e0748d rf89979b 55 55 /* Main block row 1 */ 56 56 57 KC_BACKTICK ,57 KC_BACKTICK = 1, 58 58 59 59 KC_1, -
uspace/srv/console/console.c
r96e0748d rf89979b 37 37 #include <ipc/ipc.h> 38 38 #include <keys.h> 39 #include <kbd/keycode.h> 39 40 #include <ipc/fb.h> 40 41 #include <ipc/services.h> … … 332 333 conn = &connections[active_console]; 333 334 334 if ((ev.key >= 0x101) && (ev.key < 0x101 +335 if ((ev.key >= KC_F1) && (ev.key < KC_F1 + 335 336 CONSOLE_COUNT)) { 336 if (ev.key == 0x112)337 if (ev.key == KC_F12) 337 338 change_console(KERNEL_CONSOLE); 338 339 else 339 change_console(ev.key - 0x101);340 change_console(ev.key - KC_F1); 340 341 break; 341 342 } -
uspace/srv/kbd/Makefile
r96e0748d rf89979b 47 47 generic/key_buffer.c 48 48 49 ARCH_SOURCES = \ 50 arch/$(UARCH)/src/kbd.c 51 49 ARCH_SOURCES = 50 GENARCH_SOURCES = 51 52 ifeq ($(KBD_LAYOUT), us_qwerty) 53 GENARCH_SOURCES += layout/us_qwerty.c 54 endif 55 ifeq ($(KBD_LAYOUT), us_dvorak) 56 GENARCH_SOURCES += layout/us_dvorak.c 57 endif 58 59 ifeq ($(UARCH), amd64) 60 GENARCH_SOURCES += \ 61 port/i8042.c \ 62 ctl/pc.c 63 endif 64 ifeq ($(UARCH), arm32) 65 GENARCH_SOURCES += \ 66 port/gxemul.c 67 ifeq ($(CONFIG_FB), y) 68 GENARCH_SOURCES += \ 69 ctl/gxe_fb.c 70 else 71 GENARCH_SOURCES += \ 72 ctl/stty.c 73 endif 74 endif 52 75 ifeq ($(UARCH), ia32) 53 ARCH_SOURCES += \ 54 arch/$(UARCH)/src/mouse.c \ 55 arch/$(UARCH)/src/scanc.c 56 GENARCH_SOURCES = \ 57 genarch/src/kbd.c 58 CFLAGS += -DMOUSE_ENABLED 76 GENARCH_SOURCES += \ 77 port/i8042.c \ 78 ctl/pc.c 59 79 endif 60 80 ifeq ($(UARCH), ia64) 61 ARCH_SOURCES += \ 62 arch/$(UARCH)/src/mouse.c \ 63 arch/$(UARCH)/src/scanc.c \ 64 arch/$(UARCH)/src/lkbd.c 65 GENARCH_SOURCES = \ 66 genarch/src/kbd.c 67 CFLAGS += -DMOUSE_ENABLED 68 endif 69 ifeq ($(UARCH), amd64) 70 ARCH_SOURCES += \ 71 arch/$(UARCH)/src/mouse.c \ 72 arch/$(UARCH)/src/scanc.c 73 GENARCH_SOURCES = \ 74 genarch/src/kbd.c 75 CFLAGS += -DMOUSE_ENABLED 81 GENARCH_SOURCES += \ 82 port/dummy.c \ 83 ctl/stty.c 84 endif 85 ifeq ($(MACHINE), msim) 86 GENARCH_SOURCES += \ 87 port/msim.c \ 88 ctl/stty.c 89 endif 90 ifeq ($(MACHINE), lgxemul) 91 GENARCH_SOURCES += \ 92 port/gxemul.c 93 ifeq ($(CONFIG_FB), y) 94 GENARCH_SOURCES += \ 95 ctl/gxe_fb.c 96 else 97 GENARCH_SOURCES += \ 98 ctl/stty.c 99 endif 100 endif 101 ifeq ($(MACHINE), bgxemul) 102 GENARCH_SOURCES += \ 103 port/gxemul.c \ 104 ctl/stty.c 105 endif 106 ifeq ($(UARCH), ppc32) 107 GENARCH_SOURCES += \ 108 port/dummy.c \ 109 ctl/stty.c 76 110 endif 77 111 ifeq ($(UARCH), sparc64) 78 ARCH_SOURCES += \ 79 arch/$(UARCH)/src/scanc.c \ 80 arch/$(UARCH)/src/sgcn.c 81 GENARCH_SOURCES = \ 82 genarch/src/kbd.c \ 83 genarch/src/nofb.c 84 endif 85 ifeq ($(UARCH), arm32) 86 ARCH_SOURCES += \ 87 arch/$(UARCH)/src/kbd_gxemul.c 88 endif 89 ifeq ($(UARCH), mips32) 90 GENARCH_SOURCES += \ 91 genarch/src/nofb.c 92 endif 93 ifeq ($(UARCH), mips32eb) 94 GENARCH_SOURCES += \ 95 genarch/src/nofb.c 96 endif 112 GENARCH_SOURCES += \ 113 port/dummy.c \ 114 ctl/stty.c 115 endif 116 117 # ifeq ($(UARCH), ia32) 118 # ARCH_SOURCES += \ 119 # arch/$(UARCH)/src/mouse.c \ 120 # arch/$(UARCH)/src/scanc.c 121 # GENARCH_SOURCES = \ 122 # genarch/src/kbd.c 123 # CFLAGS += -DMOUSE_ENABLED 124 # endif 125 # ifeq ($(UARCH), ia64) 126 # ARCH_SOURCES += \ 127 # arch/$(UARCH)/src/mouse.c \ 128 # arch/$(UARCH)/src/scanc.c \ 129 # arch/$(UARCH)/src/lkbd.c 130 # GENARCH_SOURCES = \ 131 # genarch/src/kbd.c 132 # CFLAGS += -DMOUSE_ENABLED 133 # endif 134 # ifeq ($(UARCH), amd64) 135 # ARCH_SOURCES += \ 136 # arch/$(UARCH)/src/mouse.c \ 137 # arch/$(UARCH)/src/scanc.c 138 # GENARCH_SOURCES = \ 139 # genarch/src/kbd.c 140 # CFLAGS += -DMOUSE_ENABLED 141 # endif 142 # ifeq ($(UARCH), sparc64) 143 # ARCH_SOURCES += \ 144 # arch/$(UARCH)/src/scanc.c \ 145 # arch/$(UARCH)/src/sgcn.c 146 # GENARCH_SOURCES = \ 147 # genarch/src/kbd.c \ 148 # genarch/src/nofb.c 149 # endif 150 # ifeq ($(UARCH), arm32) 151 # ARCH_SOURCES += \ 152 # arch/$(UARCH)/src/kbd_gxemul.c 153 # endif 154 # ifeq ($(UARCH), mips32) 155 # GENARCH_SOURCES += \ 156 # genarch/src/nofb.c 157 # endif 158 # ifeq ($(UARCH), mips32eb) 159 # GENARCH_SOURCES += \ 160 # genarch/src/nofb.c 161 # endif 97 162 98 163 GENERIC_OBJECTS := $(addsuffix .o,$(basename $(GENERIC_SOURCES))) -
uspace/srv/kbd/generic/kbd.c
r96e0748d rf89979b 48 48 #include <kbd/kbd.h> 49 49 50 #include <arch/kbd.h>51 50 #include <kbd.h> 52 51 #include <key_buffer.h> 53 #include <keys.h> 52 #include <kbd_port.h> 53 #include <kbd_ctl.h> 54 #include <layout.h> 54 55 55 56 #define NAME "kbd" … … 59 60 keybuffer_t keybuffer; 60 61 61 static void irq_handler(ipc_callid_t iid, ipc_call_t *call) 62 void kbd_push_scancode(int scancode) 63 { 64 printf("scancode: 0x%x\n", scancode); 65 kbd_ctl_parse_scancode(scancode); 66 } 67 68 #include <kbd/keycode.h> 69 void kbd_push_ev(int type, unsigned int key, unsigned int mods) 62 70 { 63 71 kbd_event_t ev; 64 72 65 #ifdef MOUSE_ENABLED 66 if (mouse_arch_process(phone2cons, call)) 67 return; 68 #endif 69 70 kbd_arch_process(&keybuffer, call); 73 printf("type: %d\n", type); 74 printf("mods: 0x%x\n", mods); 75 printf("keycode: %u\n", key); 71 76 72 if (cons_connected && phone2cons != -1) { 73 /* 74 * One interrupt can produce more than one event so the result 75 * is stored in a FIFO. 76 */ 77 while (!keybuffer_empty(&keybuffer)) { 78 if (!keybuffer_pop(&keybuffer, &ev)) 79 break; 77 ev.type = type; 78 ev.key = key; 79 ev.mods = mods; 80 80 81 async_msg_4(phone2cons, KBD_EVENT, ev.type, ev.key, 82 ev.mods, ev.c); 83 } 84 } 81 ev.c = layout_parse_ev(&ev); 82 83 async_msg_4(phone2cons, KBD_EVENT, ev.type, ev.key, ev.mods, ev.c); 85 84 } 85 86 //static void irq_handler(ipc_callid_t iid, ipc_call_t *call) 87 //{ 88 // kbd_event_t ev; 89 // 90 // kbd_arch_process(&keybuffer, call); 91 // 92 // if (cons_connected && phone2cons != -1) { 93 // /* 94 // * One interrupt can produce more than one event so the result 95 // * is stored in a FIFO. 96 // */ 97 // while (!keybuffer_empty(&keybuffer)) { 98 // if (!keybuffer_pop(&keybuffer, &ev)) 99 // break; 100 // 101 // async_msg_4(phone2cons, KBD_EVENT, ev.type, ev.key, 102 // ev.mods, ev.c); 103 // } 104 // } 105 //} 86 106 87 107 static void console_connection(ipc_callid_t iid, ipc_call_t *icall) … … 123 143 124 144 145 125 146 int main(int argc, char **argv) 126 147 { … … 129 150 ipcarg_t phonead; 130 151 131 /* Initialize arch dependent parts*/132 if (kbd_ arch_init())152 /* Initialize port driver. */ 153 if (kbd_port_init()) 133 154 return -1; 134 155 … … 137 158 138 159 async_set_client_connection(console_connection); 139 async_set_interrupt_received(irq_handler); 140 /* Register service at nameserver */160 161 /* Register service at nameserver. */ 141 162 if (ipc_connect_to_me(PHONE_NS, SERVICE_KEYBOARD, 0, 0, &phonead) != 0) 142 163 return -1; … … 145 166 async_manager(); 146 167 147 /* N ever reached*/168 /* Not reached. */ 148 169 return 0; 149 170 } -
uspace/srv/kbd/include/kbd.h
r96e0748d rf89979b 40 40 #include <key_buffer.h> 41 41 42 extern int kbd_arch_init(void); 43 extern int kbd_arch_process(keybuffer_t *keybuffer, ipc_call_t *call); 44 extern int mouse_arch_process(int phoneid, ipc_call_t *call); 42 #define KBD_EVENT 1024 43 #define KBD_MS_LEFT 1025 44 #define KBD_MS_RIGHT 1026 45 #define KBD_MS_MIDDLE 1027 46 #define KBD_MS_MOVE 1028 47 48 extern void kbd_push_scancode(int); 49 extern void kbd_push_ev(int, unsigned int, unsigned int); 45 50 46 51 #endif
Note:
See TracChangeset
for help on using the changeset viewer.