On Wed, Mar 09, 2011 at 01:34:16PM +0200, Anton Zinoviev wrote: > > I hope the next version of console-setup will have some preliminary > support for FreeBSD kernel.
Done in version 1.71. Of course, the terminal settings do not work automatically as this is not a job for console-setup. I don't know how the Backspace/Delete problem will be solved in Debian. The following is an excerpt from the README file that I wrote specifically for FreeBSD, hopefully it will help. It deals with 8-bit encodings -- in Debian the line graphics symbols display correctly regardless of the terminal type. ============================ TERMINAL TYPE (FreeBSD only) ============================ In order to display properly the line draw symbols on FreeBSD, the programs use the description of the capabilities of the terminal of the console in order to find the position of these symbols in the current encoding. Traditionally this meant that the different encodings ought to be used with different terminal types. Obviously this is very inconvenient for a multi-lingual package such as console-setup. In order to overcome this difficulty, for the line draw symbols console-setup uses some of the special codes from 1 to 31. In this way only one unified terminal type can be used for all languages. Console-setup provides the description of the terminal it uses in two formats -- the older termcap and the newer terminfo. They are installed in /usr/local/etc/console-setup/. On FreeBSD the older format is used (termcap). You have to append the console-setup definition to the system-wide file and to recompile it: cat /usr/local/etc/console-setup/termcap >>/etc/termcap cap_mkdb -f /usr/share/misc/termcap /etc/termcap Then open /etc/ttys in a text editor and find all lines whose first word is of the form ttyv0, ttyv1, etc: ttyv0 "/usr/libexec/getty Pc" cons25 on secure Replace cons25 with cons25cs (cs is an abbreviation of console-setup). Console-setup provides also the following alternative terminal types: cons25cs-m, cons30cs, cons30cs-m, cons43cs, cons43cs-m, cons50cs, cons50cs-m, cons60cs and cons60cs-m. The number tells how many lines are used on the console and the suffix -m means 'monochrome'. If for example the console is configured to use video mode 80x30 with color video display, then in /etc/ttys use cons30cs instead of cons25cs If you login from the console to a remote system that doesn't understands the terminal types of console-setup, this can be a problem. In case the remote system uses the newer terminfo format (this is true on Linux systems) you can solve the problem in the following way (there is no need to be root on the remote system): local: scp /usr/local/etc/console-setup/terminfo remote.system.org:. local: ssh remote.system.org remote: tic terminfo remote: rm terminfo I don't know if something similar can be done as non-root user on systems that use termcap. If you login in a such system, then change the terminal type to 'cons25w': TERM=cons25w; export TERM # if you use Bourne-alike shell setenv TERM cons25w # if you use the C shell ==================== BACKSPACE AND DELETE ==================== This hasn't been a problem on Linux since a while. But on FreeBSD it is not unusual to have programs that do not respond correctly to these keys. For example in some situations Backspace will delete the symbol at the cursor (not the preceding symbol) in other situations the Backspace key will display help information (because this key actually generates the combination Control-h). I don't know why proper solution of the problem hasn't been applied by the FreeBSD project, considering how easy is it to do so. After I reconfigured properly the keys Backspace and Delete, all programs I tested worked correctly (absolutely no reconfiguration of these programs was necessary). In general, there are two standards for the codes these keys generate. The first one strives to be conformant with the behavior of the old DEC VT100 terminal. This standard is used by default on FreeBSD. The second standard is conformant with the newer terminal VT220. The following table summarizes the codes generated by the keys according to these two standards (^H is BS, ^? is DEL and ^[ is ESC): VT100 VT220 Control-h ^H ^H Backspace ^H ^? Delete ^? ^[[3~ Notice that VT100 makes Backspace and Control-h to behave identically. This means the programs (notably Emacs) are unable to differentiate between Backspace and Control-h. No reconfiguration can help this. The problem is aggravated by the fact that the other standard (that of VT220) is widespread on Linux systems, whence many programs require reconfiguration in order to work correctly with VT100 codes. There are two methods the programs can use in order to determine the properties of the terminal they are working on and in particular the codes generated by the keys Backspace and Delete. The first method is to read the settings of the terminal line. This method gives limited information; it is, however, in a sense directly supported by the kernel of the operating system. Use the command 'stty -a' to see these settings. The second method is based on the variable of the environment TERM. Use 'echo $TERM' to see its value. This variable tells the programs the name of the terminal you are using. When the name of the terminal is known, the programs look in a database describing the capabilities of all terminals in order to determine the capabilities of your particular terminal. There are two implementations of such a database -- termcap and the terminfo, but for our purposes it makes no difference which one is used on your system. Somewhat inconsistently, two different programs are responsible for the configuration of the terminal capabilities -- init and getty: 1. Init is the first process. It configures the environment and in particular it is responsible for the value of the variable TERM. 2. Init starts several instances of getty. Each virtual terminal has its own getty process. Getty is responsible to configure the terminal line before you login (the settings of 'stty -a'). So, the following is the plan. First, teach the system about the terminal types of console-setup (if you haven't done so yet): cat /usr/local/etc/console-setup/termcap >>/etc/termcap cap_mkdb -f /usr/share/misc/termcap /etc/termcap The second in order is getty. Open /etc/getty in a text editor. This file tells getty how to configure different kinds of terminals. Find the lines that look like this: P|Pc|Pc console:\ :ht:np:sp#115200: Make a copy of these lines and edit the copy to look like this: Pd|Pcd|Pc console del:\ :ht:np:sp#115200:er=^?: There are only two changes: first, the changed names ('Pd', 'Pcd' and 'Pc console del' instead of 'P', 'Pc' and 'Pc console') and second, the string 'er=^?:' is appended. And the third is init. Open /etc/ttys in a text editor. Find the lines starting with a word of the form ttyv0, ttyv1, ttyv2, etc. ttyv0 "/usr/libexec/getty Pc" cons25 on secure Then change these lines to look like this: ttyv0 "/usr/libexec/getty Pcd" cons25cs-del on secure There are two changes: first, the terminal name is 'cons25cs-del' (this is the value init will assign to the variable TERM) and second, init tells getty that the terminal type is Pcd. Here 'Pcd' is the new terminal type you've just defined in /etc/getty. Instead of 'cons25cs-del' you can use one of the following types: 'cons25cs-del-m', 'cons30cs-del', 'cons30cs-del-m', 'cons43cs-del', 'cons43cs-del-m', 'cons50cs-del', 'cons50cs-del-m', 'cons60cs-del' or 'cons60cs-del-m'. The number specifies how many lines are used on the console and the suffix '-m' stands for 'monochrome'. Anton Zinoviev -- To UNSUBSCRIBE, email to debian-bsd-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/20110321065819.ga30...@debian.lan