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
This commit is contained in:
parent
6141cc1d5a
commit
6a6f5ef6f3
@ -24,10 +24,6 @@ KernelLd keyboard :
|
||||
drivers/dev/keyboard
|
||||
;
|
||||
|
||||
R5KernelAddon <driver>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 <driver>keyboard : kernel drivers bin :
|
||||
RelSymLink $(instDriver) : <driver>keyboard ;
|
||||
}
|
||||
|
||||
#Package haiku-inputkit-cvs
|
||||
# :
|
||||
# <driver>keyboard
|
||||
# :
|
||||
# boot home config add-ons kernel drivers bin ;
|
||||
|
||||
#Package haiku-inputkit-cvs
|
||||
# :
|
||||
# <kernel!drivers!dev!input>keyboard
|
||||
# :
|
||||
# boot home config add-ons kernel drivers dev input ;
|
||||
|
||||
|
@ -1,279 +0,0 @@
|
||||
/*
|
||||
** Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
|
||||
** Distributed under the terms of the NewOS License.
|
||||
*/
|
||||
|
||||
#include <KernelExport.h>
|
||||
#include <Drivers.h>
|
||||
#include <OS.h>
|
||||
#include <ISA.h>
|
||||
|
||||
#include "cbuf_adapter.h"
|
||||
#include <string.h>
|
||||
//#include <lock.h>
|
||||
|
||||
#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);
|
||||
}
|
Loading…
Reference in New Issue
Block a user