line 15360 the device specific routine is called using the pointer in the tp

Line 15360 the device specific routine is called

This preview shows page 52 - 55 out of 140 pages.

(line 15360), the device-specific routine, is called using the pointer in the tp->tty_devread field of the console's tty structure. [Page 352] Kb_read takes scan codes from the keyboard's circular buffer and places ASCII codes in its local buffer, which is large enough to hold the escape sequences that must be generated in response to some scan codes from the numeric keypad. Then it calls in_process in the hardware-independent code to put the characters into the input queue. On line 15379 icount is decremented. The call to make_break returns the ASCII code as an integer. Special keys, such as keypad and function keys, have values greater than 0xFF at this point. Codes in the range from HOME to INSRT (0x101 to 0x10C, defined in file include/minix/keymap.h) result from pressing the numeric keypad, and are converted into 3-character escape sequences shown in Fig. 3-42 using the numpad_map array.
Image of page 52
Figure 3-42. Escape codes generated by the numeric keypad. When scan codes for ordinary keys are translated into ASCII codes the special keys are assigned "pseudo ASCII" codes with values greater than 0xFF. (This item is displayed on page 353 in the print version) Key Scan code "ASCII" Escape sequence Home 71 0x101 ESC[H Up Arrow 72 0x103 ESC[A Pg Up 73 0x107 ESC[V - 74 0x10A ESC[S Left Arrow 75 0x105 ESC[D 5 76 0x109 ESC[G Right Arrow 77 0x106 ESC[C + 78 0x10B ESC[T End 79 0x102 ESC[Y Down Arrow 80 0x104 ESC[B Pg Dn 81 0x108 ESC[U Ins 82 0x10C ESC[@ The sequences are then passed to in_process (lines 15392 to 15397). Higher codes are not passed on to in_process. Instead, a check is made for the codes for ALT-LEFT-ARROW, ALT-RIGHT-ARROW, and ALT-F1 through ALT-F12, and if one of these is found, select_console is called to switch virtual consoles. CTRL-F1 through CTRL-F12 are similarly given special handling. CTRL-F1 shows the mappings of function keys (more on this later). CTRL-F3 toggles between hardware scrolling and software scrolling of the console screen. CTRL-F7, CTRL-F8, and CTRL-F9 generate signals with the same effects as CTRL-\, CTRL-C, and CTRL-U, respectively, except these cannot be changed by the stty command. Make_break (line 15431) converts scan codes into ASCII and then updates the variables that keep track of the state of modifier keys. First, however, it checks for the magic CTRL-ALT-DEL combination that PC users all know as the way to force a reboot under MS-DOS. Note the comment that it would be better to do this at a lower level. However,
Image of page 53
the simplicity of MINIX 3 interrupt handling in kernel space makes detecting CTRL- ALT-DEL impossible there, when an interrupt notification is sent the scan code has not yet been read. An orderly shutdown is desirable, so rather than try to start the PC BIOS routines, a sys_kill kernel call is made to initiate sending a SIGKILL signal TO init, the parent process of all other processes (line 15448). Init is expected to catch this signal and interpret it as a command to begin an orderly process of shutting down, prior to causing a return to the boot monitor, from which a full restart of the system or a reboot of MINIX 3 can be commanded.
Image of page 54
Image of page 55

You've reached the end of your free preview.

Want to read all 140 pages?

  • One '20
  • ASCII

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Ask Expert Tutors You can ask You can ask ( soon) You can ask (will expire )
Answers in as fast as 15 minutes