<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
  <!ENTITY % general-entities SYSTEM "../general.ent">
  %general-entities;
]>

<sect1 id="ch-system-kbd" role="wrap">
  <?dbhtml filename="kbd.html"?>

  <sect1info condition="script">
    <productname>kbd</productname>
    <productnumber>&kbd-version;</productnumber>
    <address>&kbd-url;</address>
  </sect1info>

  <title>Kbd-&kbd-version;</title>

  <indexterm zone="ch-system-kbd">
    <primary sortas="a-Kbd">Kbd</primary>
  </indexterm>

  <sect2 role="package">
    <title/>

    <para>Kbd 软件包包含按键表文件、控制台字体和键盘工具。</para>

    <segmentedlist>
      <segtitle>&buildtime;</segtitle>
      <segtitle>&diskspace;</segtitle>

      <seglistitem>
        <seg>&kbd-ch6-sbu;</seg>
        <seg>&kbd-ch6-du;</seg>
      </seglistitem>
    </segmentedlist>

  </sect2>

  <sect2 role="installation">
    <title>安装 Kbd</title>

    <para>退格和删除键的行为在 Kbd 软件包的不同按键映射中不一致。
    以下补丁修复 i386 按键映射中的这个问题：</para>

<screen><userinput remap="pre">patch -Np1 -i ../&kbd-backspace-patch;</userinput></screen>

    <para>在修补后，退格键生成编码为 127 的字符，删除键生成广为人知的
    escape 序列。</para>

    <para>删除多余的 <command>resizecons</command> 程序（它需要已经不存在的
    	svgalib 提供视频模式文件 —— 一般使用 <command>setfont</command>
    	即可调整控制台大小）及其 man 页面。</para>

<screen><userinput remap="pre">sed -i 's/\(RESIZECONS_PROGS=\)yes/\1no/g' configure
sed -i 's/resizecons.8 //' docs/man/man8/Makefile.in</userinput></screen>

    <para>准备安装 Kbd：</para>

<screen><userinput remap="configure">PKG_CONFIG_PATH=/tools/lib/pkgconfig ./configure --prefix=/usr --disable-vlock</userinput></screen>

    <variablelist>
      <title>配置选项的含义：</title>
<!--
      <varlistentry>
        <term><parameter>- -datadir=/lib/kbd</parameter></term>
        <listitem>
          <para>This option puts keyboard layout data in a directory that will
          always be on the root partition instead of the default <filename
          class="directory">/usr/share/kbd</filename>.</para>
       </listitem>
      </varlistentry>
-->
      <varlistentry>
        <term><parameter>--disable-vlock</parameter></term>
        <listitem>
          <para>该选项防止构建 vlock 工具，因为它需要 chroot 环境中不可用的
          	  PAM 库。</para>
       </listitem>
      </varlistentry>

    </variablelist>

    <para>编译该软件包：</para>

<screen><userinput remap="make">make</userinput></screen>

    <para>运行以下命令以测试编译结果：</para>

<screen><userinput remap="test">make check</userinput></screen>

    <para>安装该软件包：</para>

<screen><userinput remap="install">make install</userinput></screen>

    <note>
    <para>对于白罗斯文，Kbd 软件包没有提供有用的、
		假设白罗斯文使用 ISO-8859-5 编码的键盘映射，而是一般使用 CP1251
		键盘映射。使用白罗斯文等文字的用户需要单独下载可工作的键盘映射。
	</para>
    </note>

<!--
    <para>Some of the scripts in the LFS-Bootscripts package depend on
    <command>kbd_mode</command>, <command>loadkeys</command>,
    <command>openvt</command>, and
    <command>setfont</command>.  As <filename class="directory">/usr</filename>
    may not be available during the early stages of booting, those binaries
    need to be on the root partition:</para>

<screen><userinput remap="install">mv -v /usr/bin/{kbd_mode,loadkeys,openvt,setfont} /bin</userinput></screen>
-->
    <para>如果需要的话，安装文档：</para>

<screen><userinput remap="install">mkdir -v       /usr/share/doc/kbd-&kbd-version;
cp -R -v docs/doc/* /usr/share/doc/kbd-&kbd-version;</userinput></screen>

  </sect2>

  <sect2 id="contents-kbd" role="content">
    <title>Kbd 的内容</title>

    <segmentedlist>
      <segtitle>安装的程序</segtitle>
      <segtitle>安装的目录</segtitle>

      <seglistitem>
        <seg>chvt, deallocvt, dumpkeys, fgconsole, getkeycodes, kbdinfo,
        kbd_mode, kbdrate, loadkeys, loadunimap,
        mapscrn, openvt, psfaddtable (到 psfxtable 的链接), psfgettable (到
        psfxtable 的链接), psfstriptable (到 psfxtable 的链接), psfxtable, <!--resizecons,-->
        setfont, setkeycodes, setleds, setmetamode, setvtrgb,
        showconsolefont, showkey, unicode_start, 以及 unicode_stop</seg>
        <seg>/usr/share/consolefonts, /usr/share/consoletrans, /usr/share/keymaps, 
        /usr/share/doc/kbd-&kbd-version;,  以及 /usr/share/unimaps</seg>
      </seglistitem>
    </segmentedlist>

    <variablelist>
      <bridgehead renderas="sect3">简要描述</bridgehead>
      <?dbfo list-presentation="list"?>
      <?dbhtml list-presentation="table"?>

      <varlistentry id="chvt">
        <term><command>chvt</command></term>
        <listitem>
          <para>修改当前虚拟终端</para>
          <indexterm zone="ch-system-kbd chvt">
            <primary sortas="b-chvt">chvt</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="deallocvt">
        <term><command>deallocvt</command></term>
        <listitem>
          <para>取消未使用的虚拟终端分配</para>
          <indexterm zone="ch-system-kbd deallocvt">
            <primary sortas="b-deallocvt">deallocvt</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="dumpkeys">
        <term><command>dumpkeys</command></term>
        <listitem>
          <para>转储键盘转换表</para>
          <indexterm zone="ch-system-kbd dumpkeys">
            <primary sortas="b-dumpkeys">dumpkeys</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="fgconsole">
        <term><command>fgconsole</command></term>
        <listitem>
          <para>打印活动虚拟终端的个数</para>
          <indexterm zone="ch-system-kbd fgconsole">
            <primary sortas="b-fgconsole">fgconsole</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="getkeycodes">
        <term><command>getkeycodes</command></term>
        <listitem>
          <para>打印内核扫描码到键码的映射表</para>
          <indexterm zone="ch-system-kbd getkeycodes">
            <primary sortas="b-getkeycodes">getkeycodes</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="kbdinfo">
        <term><command>kbdinfo</command></term>
        <listitem>
          <para>获取终端状态信息</para>
          <indexterm zone="ch-system-kbd kbdinfo">
            <primary sortas="b-kbdinfo">kbdinfo</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="kbd_mode">
        <term><command>kbd_mode</command></term>
        <listitem>
          <para>报告或设置键盘模式</para>
          <indexterm zone="ch-system-kbd kbd_mode">
            <primary sortas="b-kbd_mode">kbd_mode</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="kbdrate">
        <term><command>kbdrate</command></term>
        <listitem>
          <para>设置键盘重复和延迟率</para>
          <indexterm zone="ch-system-kbd kbdrate">
            <primary sortas="b-kbdrate">kbdrate</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="loadkeys">
        <term><command>loadkeys</command></term>
        <listitem>
          <para>加载键盘翻译表</para>
          <indexterm zone="ch-system-kbd loadkeys">
            <primary sortas="b-loadkeys">loadkeys</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="loadunimap">
        <term><command>loadunimap</command></term>
        <listitem>
          <para>加载内核 unicode 到字体的映射表</para>
          <indexterm zone="ch-system-kbd loadunimap">
            <primary sortas="b-loadunimap">loadunimap</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="mapscrn">
        <term><command>mapscrn</command></term>
        <listitem>
          <para>一个过时程序，
			  曾用于将用户定义输出字符映射表加载到终端驱动程序；
			  现在该任务由 <command>setfont</command> 完成</para>
          <indexterm zone="ch-system-kbd mapscrn">
            <primary sortas="b-mapscrn">mapscrn</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="openvt">
        <term><command>openvt</command></term>
        <listitem>
          <para>在新的虚拟终端（VT）启动程序</para>
          <indexterm zone="ch-system-kbd openvt">
            <primary sortas="b-openvt">openvt</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="psfaddtable">
        <term><command>psfaddtable</command></term>
        <listitem>
          <para>向控制台字体增加 Unicode 字符表</para>
          <indexterm zone="ch-system-kbd psfaddtable">
            <primary sortas="b-psfaddtable">psfaddtable</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="psfgettable">
        <term><command>psfgettable</command></term>
        <listitem>
          <para>提取控制台字体中嵌入的 Unicode 字符表</para>
          <indexterm zone="ch-system-kbd psfgettable">
            <primary sortas="b-psfgettable">psfgettable</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="psfstriptable">
        <term><command>psfstriptable</command></term>
        <listitem>
          <para>删除控制台字体中嵌入的 Unicode 字符表</para>
          <indexterm zone="ch-system-kbd psfstriptable">
            <primary sortas="b-psfstriptable">psfstriptable</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="psfxtable">
        <term><command>psfxtable</command></term>
        <listitem>
          <para>处理控制台字体的 Unicode 字符表</para>
          <indexterm zone="ch-system-kbd psfxtable">
            <primary sortas="b-psfxtable">psfxtable</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="setfont">
        <term><command>setfont</command></term>
        <listitem>
          <para>修改控制台上的增强图形适配器（EGA）和视频图像阵列（VGA）
          字体</para>
          <indexterm zone="ch-system-kbd setfont">
            <primary sortas="b-setfont">setfont</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="setkeycodes">
        <term><command>setkeycodes</command></term>
        <listitem>
          <para>加载内核扫描码到键码的映射表项；
          在键盘上由特殊按键时很有用</para>
          <indexterm zone="ch-system-kbd setkeycodes">
            <primary sortas="b-setkeycodes">setkeycodes</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="setleds">
        <term><command>setleds</command></term>
        <listitem>
          <para>设置键盘标志位和发光二极管（LED）</para>
          <indexterm zone="ch-system-kbd setleds">
            <primary sortas="b-setleds">setleds</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="setmetamode">
        <term><command>setmetamode</command></term>
        <listitem>
          <para>定义键盘元键处理</para>
          <indexterm zone="ch-system-kbd setmetamode">
            <primary sortas="b-setmetamode">setmetamode</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="setvtrgb">
        <term><command>setvtrgb</command></term>
        <listitem>
          <para>设定所有虚拟终端的控制台颜色映射</para>
          <indexterm zone="ch-system-kbd setvtrgb">
            <primary sortas="b-setvtrgb">setvtrgb</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="showconsolefont">
        <term><command>showconsolefont</command></term>
        <listitem>
          <para>显示当前 EGA/VGA 控制台屏幕字体</para>
          <indexterm zone="ch-system-kbd showconsolefont">
            <primary sortas="b-showconsolefont">showconsolefont</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="showkey">
        <term><command>showkey</command></term>
        <listitem>
          <para>报告键盘按键的扫描码、键码和 ASCII 编码</para>
          <indexterm zone="ch-system-kbd showkey">
            <primary sortas="b-showkey">showkey</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="unicode_start">
        <term><command>unicode_start</command></term>
        <listitem>
          <para>将键盘和控制台设定为 UNICODE 模式 [不要使用该程序，
          除非您的键盘映射文件是 ISO-8859-1 编码的。
          对于其他编码，该工具产生错误结果。]</para>
          <indexterm zone="ch-system-kbd unicode_start">
            <primary sortas="b-unicode_start">unicode_start</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="unicode_stop">
        <term><command>unicode_stop</command></term>
        <listitem>
          <para>使键盘和控制台退出 UNICODE 模式</para>
          <indexterm zone="ch-system-kbd unicode_stop">
            <primary sortas="b-unicode_stop">unicode_stop</primary>
          </indexterm>
        </listitem>
      </varlistentry>

    </variablelist>

  </sect2>

</sect1>
