Content in the linux Console

Source: Internet
Author: User
For more information about general linux technology-Linux programming and kernel in the Linux console, see the following. When I got started with the DD zhcon, I learned some knowledge, recorded some important content, and understood the concept very well.

Current situation in the Linux Console

Linux is a powerful, outstanding, stable, and reliable operating system. However, at the beginning of the Linux design, it did not take into account the needs of non-English users, resulting in difficulties in using Chinese on Linux, it greatly restricts the application and popularization of Linux in China. With the popularity of Linux, some people of insight have already started research on cultural issues, from the early chdrv, yact, wzce, cce to the later blue point, TurboLinux Chinese kernel, many Free Software enthusiasts have contributed to Linux culture.

The character interface-based console does not support dot matrix character output. To support Chinese characters, you must switch the console to the graphic mode and add Chinese decoding support. These console Chinese solutions use different technologies, which can be divided into two types: External mounting and kernel localization. The external mounting solution uses pseudo terminal technology to connect to the Chinese platform. The advantage is that the kernel does not need to be re-compiled. The disadvantage is that the compatibility is not good, especially for the escape processing on the console (it is quite difficult to rewrite VT Parser.

There are more or less deficiencies in the usability, scalability, and application compatibility of the existing Chinese platform. zhcon was born in this context. Zhcon aims to provide a convenient and easy-to-use Chinese language environment for Chinese Linux users, especially for beginners and developers who need to publish linux Chinese applications.

Basic working principle

Generally, the Linux console works in text mode. To correctly display Chinese characters on the screen, you must switch the screen to the graphic mode, which can be achieved by calling the kernel FrameBuffer driver. In addition, you must be able to correctly identify the Chinese character information output from the system to the console and call the Chinese character display module to output it to the screen.

One method is to monitor the display buffer at B800: 0000 using the system clock interruption timing as the Chinese Character System in DOS to dynamically identify the character information in the buffer zone. This method requires modifying the kernel interrupt and TTY driver, which is difficult to implement and requires direct control of the hardware video buffer, which greatly affects the portability and stability of the system.

Another method is the Pseudo-Terminals-based external mounting solution adopted by most Chinese platforms in UNIX. Pseudo-Terminal is a special inter-process communication channel similar to the Terminal ). One end of the channel is called the master pseudo-terminal device and the other end is called the slave device. The data written to the master device is sent to the slave device, and the data written to the slave device can also be read from the master device, as if they were actually connected to a real computer terminal. In short, a Pseudo Terminal is a device between a virtual terminal and a final terminal device that undertakes the input/output conversion function.

The Pseudo Terminal was widely used at the beginning. A typical example is the Telnet service program. Telnet is a remote Logon Service. You can use the Telnet client program to log on to the remote host over the network for various operations. The Telnet service is a Pseudo Terminal. One end is connected to the Telnet client program, and the other end is connected to the Host application program. The client and the application communicate with each other through a Pseudo Terminal.

When an application needs to read data from the input device (keyboard), it sends a system call read () to the console device (/dev/console), and then the kernel console driver responds to the system request, from the Input Device Driver (usually the keyboard-driven keyboard. c) obtain the input data and return it to the application. When an application needs to output data on the console, it sends the data to the console device through the write () System Call, then, the kernel console driver forwards data to the real output device (terminal, printer ...).

Through the above analysis, we can find that if the keyboard input information is intercepted before the application reads data from the console device (/dev/console) and submitted to the input method module for processing, then, send the processed Chinese and English information to the application to complete Chinese input. The application intercepts the output data before writing the output data to the/dev/console device and submits it to the Chinese character recognition module for processing. The Chinese Character Display Module outputs the output data to the screen, which enables both Chinese and English output. This is the basic working principle of the Chinese console such as zhcon.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.