From 6a6f5ef6f32c340feb8cbb4b88f8a3c5c6c9a405 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Thu, 21 Apr 2005 20:56:04 +0000 Subject: [PATCH] Removed obsolete keyboard driver (one of them :-)). The other driver is still in use by consoled. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12458 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../kernel/drivers/arch/x86/keyboard/Jamfile | 16 - .../drivers/arch/x86/keyboard/atkeyboard.c | 279 ------------------ 2 files changed, 295 deletions(-) delete mode 100644 src/add-ons/kernel/drivers/arch/x86/keyboard/atkeyboard.c diff --git a/src/add-ons/kernel/drivers/arch/x86/keyboard/Jamfile b/src/add-ons/kernel/drivers/arch/x86/keyboard/Jamfile index 8792fde238..f2ac3e3472 100644 --- a/src/add-ons/kernel/drivers/arch/x86/keyboard/Jamfile +++ b/src/add-ons/kernel/drivers/arch/x86/keyboard/Jamfile @@ -24,10 +24,6 @@ KernelLd keyboard : drivers/dev/keyboard ; -R5KernelAddon keyboard : kernel drivers bin : - atkeyboard.c -; - # Link to kernel/drivers/dev/input { local dir = [ FDirName $(OBOS_ADDON_DIR) kernel drivers dev input ] ; @@ -36,15 +32,3 @@ R5KernelAddon keyboard : kernel drivers bin : RelSymLink $(instDriver) : keyboard ; } -#Package haiku-inputkit-cvs -# : -# keyboard -# : -# boot home config add-ons kernel drivers bin ; - -#Package haiku-inputkit-cvs -# : -# keyboard -# : -# boot home config add-ons kernel drivers dev input ; - diff --git a/src/add-ons/kernel/drivers/arch/x86/keyboard/atkeyboard.c b/src/add-ons/kernel/drivers/arch/x86/keyboard/atkeyboard.c deleted file mode 100644 index 1258bd5da9..0000000000 --- a/src/add-ons/kernel/drivers/arch/x86/keyboard/atkeyboard.c +++ /dev/null @@ -1,279 +0,0 @@ -/* -** Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. -** Distributed under the terms of the NewOS License. -*/ - -#include -#include -#include -#include - -#include "cbuf_adapter.h" -#include -//#include - -#include "kb_mouse_driver.h" - -#define DEVICE_NAME "input/keyboard/at/0" - -#if DEBUG -# define TRACE(x) dprintf x -#else -# define TRACE(x) ; -#endif - -#define LED_SCROLL 1 -#define LED_NUM 2 -#define LED_CAPS 4 - - -int32 api_version = B_CUR_DRIVER_API_VERSION; - -static sem_id keyboard_sem; -//static mutex keyboard_read_mutex; -static cbuf *keyboard_buf; -static isa_module_info *sIsa; - -static int32 sOpenMask; - -static bool sIsExtended = false; - -static void -wait_for_output(void) -{ - while (sIsa->read_io_8(0x64) & 0x2) - ; -} - - -static void -set_leds(led_info *ledInfo) -{ - int leds = 0; - if (ledInfo->scroll_lock) - leds |= LED_SCROLL; - if (ledInfo->num_lock) - leds |= LED_NUM; - if (ledInfo->caps_lock) - leds |= LED_CAPS; - - wait_for_output(); - sIsa->write_io_8(0x60, 0xed); - wait_for_output(); - sIsa->write_io_8(0x60, leds); -} - - -static int32 -handle_keyboard_interrupt(void *data) -{ - // TODO: Handle braindead "pause" key special case - at_kbd_io keyInfo; - unsigned char read, scancode; - - read = sIsa->read_io_8(0x60); - TRACE(("handle_keyboard_interrupt: read = 0x%x\n", read)); - - if (read == 0xE0) { - sIsExtended = true; - TRACE(("Extended key\n")); - return B_HANDLED_INTERRUPT; - } - - scancode = read; - - TRACE(("scancode: %x\n", scancode)); - if (scancode & 0x80) { - keyInfo.is_keydown = false; - scancode -= 0x80; - } else - keyInfo.is_keydown = true; - - if (sIsExtended) - scancode |= 0x80; - - keyInfo.timestamp = system_time(); - keyInfo.scancode = scancode; - - // TODO: Check return value - cbuf_memcpy_to_chain(keyboard_buf, 0, (void *)&keyInfo, sizeof(keyInfo)); - release_sem_etc(keyboard_sem, 1, B_DO_NOT_RESCHEDULE); - - sIsExtended = false; - - return B_INVOKE_SCHEDULER; -} - - -static status_t -read_keyboard_packet(at_kbd_io *buffer) -{ - status_t status; - status = acquire_sem_etc(keyboard_sem, 1, B_CAN_INTERRUPT, 0); - if (status < B_OK) - return status; - - status = cbuf_memcpy_from_chain((void *)buffer, keyboard_buf, 0, sizeof(at_kbd_io)); - if (status < B_OK) - TRACE(("read_keyboard_packet(): error reading packet: %s\n", strerror(status))); - - TRACE(("scancode: %x, keydown: %s\n", buffer->scancode, buffer->is_keydown ? "true" : "false")); - return status; -} - - -// #pragma mark - - - -static status_t -keyboard_open(const char *name, uint32 flags, void **cookie) -{ - TRACE(("keyboard open()\n")); - if (atomic_or(&sOpenMask, 1) != 0) - return B_BUSY; - - *cookie = NULL; - return B_OK; -} - - -static status_t -keyboard_close(void *cookie) -{ - atomic_and(&sOpenMask, 0); - return B_OK; -} - - -static status_t -keyboard_freecookie(void *cookie) -{ - return B_OK; -} - - -static status_t -keyboard_read(void *cookie, off_t pos, void *buffer, size_t *_length) -{ - TRACE(("keyboard read()\n")); - *_length = 0; - return EROFS; -} - - -static status_t -keyboard_write(void *cookie, off_t pos, const void *buf, size_t *len) -{ - TRACE(("keyboard write()\n")); - *len = 0; - return EROFS; -} - - -static status_t -keyboard_ioctl(void *cookie, uint32 op, void *buf, size_t len) -{ - TRACE(("keyboard ioctl()\n")); - switch (op) { - case KB_READ: - TRACE(("KB_READ\n")); - return read_keyboard_packet((at_kbd_io *)buf); - case KB_SET_LEDS: - set_leds((led_info *)buf); - TRACE(("KB_SET_LEDS\n")); - return B_OK; - case KB_SET_KEY_REPEATING: - case KB_SET_KEY_NONREPEATING: - TRACE(("ioctl 0x%x not implemented yet, returning B_OK\n", op)); - return B_OK; - default: - TRACE(("invalid ioctl 0x%x\n", op)); - return EINVAL; - } -} - - -device_hooks keyboard_hooks = { - &keyboard_open, - &keyboard_close, - &keyboard_freecookie, - &keyboard_ioctl, - &keyboard_read, - &keyboard_write, - NULL, - NULL, - NULL, - NULL -}; - - -// #pragma mark - -/***** driver hooks *****/ - - -status_t -init_hardware() -{ - return B_OK; -} - - -const char ** -publish_devices(void) -{ - static const char *devices[] = { - DEVICE_NAME, - NULL - }; - - return devices; -} - - -device_hooks * -find_device(const char *name) -{ - if (!strcmp(name, DEVICE_NAME)) - return &keyboard_hooks; - - return NULL; -} - - -status_t -init_driver() -{ - TRACE(("keyboard: init_driver()\n")); - if (get_module(B_ISA_MODULE_NAME, (module_info **)&sIsa) < B_OK) - panic("could not get ISA module\n"); - - keyboard_sem = create_sem(0, "keyboard_sem"); - if (keyboard_sem < 0) - panic("could not create keyboard sem!\n"); - - //if (mutex_init(&keyboard_read_mutex, "keyboard_read_mutex") < 0) - // panic("could not create keyboard read mutex!\n"); - - keyboard_buf = cbuf_get_chain(1024); - if (keyboard_buf == NULL) - panic("could not create keyboard cbuf chain!\n"); - - install_io_interrupt_handler(1, &handle_keyboard_interrupt, NULL, 0); - - sOpenMask = 0; - - return B_OK; -} - - -void -uninit_driver() -{ - remove_io_interrupt_handler(1, &handle_keyboard_interrupt, NULL); - - cbuf_free_chain(keyboard_buf); - delete_sem(keyboard_sem); - //mutex_destroy(&keyboard_read_mutex); - - put_module(B_ISA_MODULE_NAME); -}