pckbd.c (51276) | pckbd.c (54551) |
---|---|
1/* 2 * Copyright (c) 1999 FreeBSD(98) port team. 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 --- 11 unchanged lines hidden (view full) --- 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * | 1/* 2 * Copyright (c) 1999 FreeBSD(98) port team. 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 --- 11 unchanged lines hidden (view full) --- 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * |
28 * $FreeBSD: head/sys/pc98/cbus/pckbd.c 51276 1999-09-14 12:57:40Z nyan $ | 28 * $FreeBSD: head/sys/pc98/cbus/pckbd.c 54551 1999-12-13 13:19:38Z kato $ |
29 */ 30 31#include "pckbd.h" 32#include "opt_kbd.h" 33 34#if NPCKBD > 0 35 36#include <sys/param.h> --- 482 unchanged lines hidden (view full) --- 519pckbd_read(keyboard_t *kbd, int wait) 520{ 521 int c; 522 523 if (wait) 524 c = read_kbd_data(((pckbd_state_t *)kbd->kb_data)->kbdc); 525 else 526 c = read_kbd_data_no_wait(((pckbd_state_t *)kbd->kb_data)->kbdc); | 29 */ 30 31#include "pckbd.h" 32#include "opt_kbd.h" 33 34#if NPCKBD > 0 35 36#include <sys/param.h> --- 482 unchanged lines hidden (view full) --- 519pckbd_read(keyboard_t *kbd, int wait) 520{ 521 int c; 522 523 if (wait) 524 c = read_kbd_data(((pckbd_state_t *)kbd->kb_data)->kbdc); 525 else 526 c = read_kbd_data_no_wait(((pckbd_state_t *)kbd->kb_data)->kbdc); |
527 if (c != -1) 528 ++kbd->kb_count; |
|
527 return (KBD_IS_ACTIVE(kbd) ? c : -1); 528} 529 530/* check if data is waiting */ 531static int 532pckbd_check(keyboard_t *kbd) 533{ 534 if (!KBD_IS_ACTIVE(kbd)) --- 26 unchanged lines hidden (view full) --- 561 do { 562 scancode = read_kbd_data(state->kbdc); 563 } while (scancode == -1); 564 } else { 565 scancode = read_kbd_data_no_wait(state->kbdc); 566 if (scancode == -1) 567 return NOKEY; 568 } | 529 return (KBD_IS_ACTIVE(kbd) ? c : -1); 530} 531 532/* check if data is waiting */ 533static int 534pckbd_check(keyboard_t *kbd) 535{ 536 if (!KBD_IS_ACTIVE(kbd)) --- 26 unchanged lines hidden (view full) --- 563 do { 564 scancode = read_kbd_data(state->kbdc); 565 } while (scancode == -1); 566 } else { 567 scancode = read_kbd_data_no_wait(state->kbdc); 568 if (scancode == -1) 569 return NOKEY; 570 } |
571 ++kbd->kb_count; |
|
569 | 572 |
573#if 0 574 printf("pckbd_read_char(): scancode:0x%x\n", scancode); 575#endif 576 |
|
570 /* return the byte as is for the K_RAW mode */ 571 if (state->ks_mode == K_RAW) 572 return scancode; 573 574 /* translate the scan code into a keycode */ 575 keycode = scancode & 0x7F; 576 switch(scancode) { 577 case 0xF3: /* GRPH (compose key) released */ --- 17 unchanged lines hidden (view full) --- 595 596 /* compose a character code */ 597 if (state->ks_flags & COMPOSE) { 598 switch (scancode) { 599 /* key pressed, process it */ 600 case 0x42: case 0x43: case 0x44: /* keypad 7,8,9 */ 601 state->ks_composed_char *= 10; 602 state->ks_composed_char += scancode - 0x3B; | 577 /* return the byte as is for the K_RAW mode */ 578 if (state->ks_mode == K_RAW) 579 return scancode; 580 581 /* translate the scan code into a keycode */ 582 keycode = scancode & 0x7F; 583 switch(scancode) { 584 case 0xF3: /* GRPH (compose key) released */ --- 17 unchanged lines hidden (view full) --- 602 603 /* compose a character code */ 604 if (state->ks_flags & COMPOSE) { 605 switch (scancode) { 606 /* key pressed, process it */ 607 case 0x42: case 0x43: case 0x44: /* keypad 7,8,9 */ 608 state->ks_composed_char *= 10; 609 state->ks_composed_char += scancode - 0x3B; |
610 kbd->kb_prev_key = keycode | (scancode & 0x80); |
|
603 if (state->ks_composed_char > UCHAR_MAX) 604 return ERRKEY; 605 goto next_code; 606 case 0x46: case 0x47: case 0x48: /* keypad 4,5,6 */ 607 state->ks_composed_char *= 10; 608 state->ks_composed_char += scancode - 0x42; | 611 if (state->ks_composed_char > UCHAR_MAX) 612 return ERRKEY; 613 goto next_code; 614 case 0x46: case 0x47: case 0x48: /* keypad 4,5,6 */ 615 state->ks_composed_char *= 10; 616 state->ks_composed_char += scancode - 0x42; |
617 kbd->kb_prev_key = keycode | (scancode & 0x80); |
|
609 if (state->ks_composed_char > UCHAR_MAX) 610 return ERRKEY; 611 goto next_code; 612 case 0x4A: case 0x4B: case 0x4C: /* keypad 1,2,3 */ 613 state->ks_composed_char *= 10; 614 state->ks_composed_char += scancode - 0x49; | 618 if (state->ks_composed_char > UCHAR_MAX) 619 return ERRKEY; 620 goto next_code; 621 case 0x4A: case 0x4B: case 0x4C: /* keypad 1,2,3 */ 622 state->ks_composed_char *= 10; 623 state->ks_composed_char += scancode - 0x49; |
624 kbd->kb_prev_key = keycode | (scancode & 0x80); |
|
615 if (state->ks_composed_char > UCHAR_MAX) 616 return ERRKEY; 617 goto next_code; 618 case 0x4E: /* keypad 0 */ 619 state->ks_composed_char *= 10; | 625 if (state->ks_composed_char > UCHAR_MAX) 626 return ERRKEY; 627 goto next_code; 628 case 0x4E: /* keypad 0 */ 629 state->ks_composed_char *= 10; |
630 kbd->kb_prev_key = keycode | (scancode & 0x80); |
|
620 if (state->ks_composed_char > UCHAR_MAX) 621 return ERRKEY; 622 goto next_code; 623 624 /* key released, no interest here */ 625 case 0xC2: case 0xC3: case 0xC4: /* keypad 7,8,9 */ 626 case 0xC6: case 0xC7: case 0xC8: /* keypad 4,5,6 */ 627 case 0xCA: case 0xCB: case 0xCC: /* keypad 1,2,3 */ 628 case 0xCE: /* keypad 0 */ | 631 if (state->ks_composed_char > UCHAR_MAX) 632 return ERRKEY; 633 goto next_code; 634 635 /* key released, no interest here */ 636 case 0xC2: case 0xC3: case 0xC4: /* keypad 7,8,9 */ 637 case 0xC6: case 0xC7: case 0xC8: /* keypad 4,5,6 */ 638 case 0xCA: case 0xCB: case 0xCC: /* keypad 1,2,3 */ 639 case 0xCE: /* keypad 0 */ |
640 kbd->kb_prev_key = keycode | (scancode & 0x80); |
|
629 goto next_code; 630 631 case 0x73: /* GRPH key */ 632 break; 633 634 default: 635 if (state->ks_composed_char > 0) { 636 state->ks_flags &= ~COMPOSE; 637 state->ks_composed_char = 0; | 641 goto next_code; 642 643 case 0x73: /* GRPH key */ 644 break; 645 646 default: 647 if (state->ks_composed_char > 0) { 648 state->ks_flags &= ~COMPOSE; 649 state->ks_composed_char = 0; |
650 kbd->kb_prev_key = keycode | (scancode & 0x80); |
|
638 return ERRKEY; 639 } 640 break; 641 } 642 } 643 644 /* keycode to key action */ 645 action = genkbd_keyaction(kbd, keycode, scancode & 0x80, 646 &state->ks_state, &state->ks_accents); | 651 return ERRKEY; 652 } 653 break; 654 } 655 } 656 657 /* keycode to key action */ 658 action = genkbd_keyaction(kbd, keycode, scancode & 0x80, 659 &state->ks_state, &state->ks_accents); |
660 kbd->kb_prev_key = keycode | (scancode & 0x80); |
|
647 if (action == NOKEY) 648 goto next_code; 649 else 650 return action; 651} 652 653/* check if char is waiting */ 654static int --- 280 unchanged lines hidden --- | 661 if (action == NOKEY) 662 goto next_code; 663 else 664 return action; 665} 666 667/* check if char is waiting */ 668static int --- 280 unchanged lines hidden --- |