From: rlfnb Date: Wed, 3 Jun 2015 05:56:35 +0000 (+0200) Subject: handle lack of pckbd more gracefully X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zpipe.c?a=commitdiff_plain;h=refs%2Fchanges%2F02%2F3002%2F1;p=minix.git handle lack of pckbd more gracefully kb_init() panics, if no keyboard controller is found during self-test. Instead of panic, the driver should quit the init process and tell it the SEF . Change-Id: Icdfb7125f5d4062f46cfbbdbbb9e54ac4b273642 --- diff --git a/minix/drivers/hid/pckbd/pckbd.c b/minix/drivers/hid/pckbd/pckbd.c index b6a41f2b4..236cef088 100644 --- a/minix/drivers/hid/pckbd/pckbd.c +++ b/minix/drivers/hid/pckbd/pckbd.c @@ -250,7 +250,7 @@ kbc_read(void) /* * Initialize the keyboard hardware. */ -static void +static int kb_init(void) { int r, ccb; @@ -272,8 +272,10 @@ kb_init(void) /* Execute Controller Self Test. */ kbc_cmd0(0xAA); r = kbc_read(); - if (r != 0x55) - panic("PCKBD: Controller self-test failed.\n"); + if (r != 0x55){ + printf("PCKBD: Controller self-test failed.\n"); + return EGENERIC; + } /* Set interrupt handler and enable keyboard IRQ. */ irq_hook_id = KEYBOARD_IRQ; /* id to be returned on interrupt */ @@ -316,6 +318,7 @@ kb_init(void) kb_wait(); set_leds(0); + return OK; } /* @@ -466,7 +469,10 @@ pckbd_init(int UNUSED(type), sef_init_info_t *UNUSED(info)) init_timer(&tmr_kbd_wd); /* Initialize the keyboard. */ - kb_init(); + int r; + if((r = kb_init())!=OK){ + return r; + } /* Announce the driver's presence. */ if (aux_available != 0)