Deleted Added
sdiff udiff text old ( 50477 ) new ( 54382 )
full compact
1/*-
2 * Copyright (c) 1999 Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
26 * $FreeBSD: head/sys/dev/atkbdc/atkbd.c 50477 1999-08-28 01:08:13Z peter $
27 */
28
29#include "atkbd.h"
30#include "opt_kbd.h"
31#include "opt_atkbd.h"
32
33#if NATKBD > 0
34

--- 474 unchanged lines hidden (view full) ---

509atkbd_read(keyboard_t *kbd, int wait)
510{
511 int c;
512
513 if (wait)
514 c = read_kbd_data(((atkbd_state_t *)kbd->kb_data)->kbdc);
515 else
516 c = read_kbd_data_no_wait(((atkbd_state_t *)kbd->kb_data)->kbdc);
517 return (KBD_IS_ACTIVE(kbd) ? c : -1);
518}
519
520/* check if data is waiting */
521static int
522atkbd_check(keyboard_t *kbd)
523{
524 if (!KBD_IS_ACTIVE(kbd))

--- 26 unchanged lines hidden (view full) ---

551 do {
552 scancode = read_kbd_data(state->kbdc);
553 } while (scancode == -1);
554 } else {
555 scancode = read_kbd_data_no_wait(state->kbdc);
556 if (scancode == -1)
557 return NOKEY;
558 }
559
560 /* return the byte as is for the K_RAW mode */
561 if (state->ks_mode == K_RAW)
562 return scancode;
563
564 /* translate the scan code into a keycode */
565 keycode = scancode & 0x7F;
566 switch (state->ks_prefix) {
567 case 0x00: /* normal scancode */

--- 136 unchanged lines hidden (view full) ---

704
705 /* compose a character code */
706 if (state->ks_flags & COMPOSE) {
707 switch (keycode | (scancode & 0x80)) {
708 /* key pressed, process it */
709 case 0x47: case 0x48: case 0x49: /* keypad 7,8,9 */
710 state->ks_composed_char *= 10;
711 state->ks_composed_char += keycode - 0x40;
712 if (state->ks_composed_char > UCHAR_MAX)
713 return ERRKEY;
714 goto next_code;
715 case 0x4B: case 0x4C: case 0x4D: /* keypad 4,5,6 */
716 state->ks_composed_char *= 10;
717 state->ks_composed_char += keycode - 0x47;
718 if (state->ks_composed_char > UCHAR_MAX)
719 return ERRKEY;
720 goto next_code;
721 case 0x4F: case 0x50: case 0x51: /* keypad 1,2,3 */
722 state->ks_composed_char *= 10;
723 state->ks_composed_char += keycode - 0x4E;
724 if (state->ks_composed_char > UCHAR_MAX)
725 return ERRKEY;
726 goto next_code;
727 case 0x52: /* keypad 0 */
728 state->ks_composed_char *= 10;
729 if (state->ks_composed_char > UCHAR_MAX)
730 return ERRKEY;
731 goto next_code;
732
733 /* key released, no interest here */
734 case 0xC7: case 0xC8: case 0xC9: /* keypad 7,8,9 */
735 case 0xCB: case 0xCC: case 0xCD: /* keypad 4,5,6 */
736 case 0xCF: case 0xD0: case 0xD1: /* keypad 1,2,3 */
737 case 0xD2: /* keypad 0 */
738 goto next_code;
739
740 case 0x38: /* left alt key */
741 break;
742
743 default:
744 if (state->ks_composed_char > 0) {
745 state->ks_flags &= ~COMPOSE;
746 state->ks_composed_char = 0;
747 return ERRKEY;
748 }
749 break;
750 }
751 }
752
753 /* keycode to key action */
754 action = genkbd_keyaction(kbd, keycode, scancode & 0x80,
755 &state->ks_state, &state->ks_accents);
756 if (action == NOKEY)
757 goto next_code;
758 else
759 return action;
760}
761
762/* check if char is waiting */
763static int

--- 287 unchanged lines hidden (view full) ---

1051 int c;
1052
1053 if (!kbdc_lock(kbdc, TRUE)) {
1054 /* driver error? */
1055 return EIO;
1056 }
1057
1058 /* save the current controller command byte */
1059 empty_both_buffers(kbdc, 10);
1060 c = get_controller_command_byte(kbdc);
1061 if (c == -1) {
1062 /* CONTROLLER ERROR */
1063 kbdc_lock(kbdc, FALSE);
1064 printf("atkbd: unable to get the current command byte value.\n");
1065 return EIO;
1066 }
1067 if (bootverbose)

--- 232 unchanged lines hidden ---