查看“PS/2 Keyboard”的源代码
←
PS/2 Keyboard
跳到导航
跳到搜索
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
== 概述 == PS/2键盘是一种使用 [[PS/2|串行通信]] 与PS/2控制器对话的设备。 理想情况下,每种不同类型的PS/2控制器驱动程序都应提供某种标准/简单的 “发送字节/接收字节” 接口,PS/2键盘驱动程序将使用此接口,而无需关心较低级别的详细信息 (例如设备插入的PS/2控制器类型)。 PS/2键盘接受命令并发送对这些命令的响应,还发送指示何时按下或释放键的Scan Code。(译者注:键盘硬件一般使用矩阵电路扫描的方式来识别当前按下的键位,具体请查阅其它资料) 请记住,这些Scan Code(来自下表) 可以由PS/2控制器更改 (即翻译),具体取决于控制器的设置。 == 命令 == PS/2键盘接受许多类型的命令。 一个命令是一个字节。 某些命令具有多个数据byte,必须在命令byte之后发送。 键盘通常通过发送 “ACK” (确认命令) 或 “Resend” (说明上一个命令有问题) 来响应命令。 不要忘记在命令,数据和键盘响应之间等待。 PS/2键盘接受的命令是: {| {{wikitable}} |- ! 命令字节 ! 数据字节 ! 含义 ! 响应 |- | 0xED | LED状态: {| {{wikitable}} |- ! Bit ! Use |- | 0 | ScrollLock |- | 1 | NumberLock |- | 2 | CapsLock |} 注意: 其他位可以在国际键盘中用于其他目的 (例如,日本键盘可能将位4用于 “假名模式” LED)。 | 设置LED | 0xFA (ACK) or 0xFE (Resend) |- | 0xEE | None | Echo (用于诊断目的,对于设备移除检测很有用) | 0xEE (Echo) 或 0xFE (Resend) |- | 0xF0 | 子命令: {| {{wikitable}} |- ! 值 ! 用途 |- | 0 | 获取当前Scan Code Set |- | 1 | 设置Scan Code Set1 |- | 2 |设置Scan Code Set2 |- | 3 |设置Scan Code Set3 |} | 获取/设置当前Scan Code Set | 当Scan Code Set正在被设置时,返回0xFA (ACK) 或 0xFE (Resend); 当正在获取Scan Code Set时,返回 0xFA (ACK) 以及Scan Code Set编号,或者0xFE (Resend) |- | 0xF2 | None | 识别键盘 | 0xFA (ACK) 后跟零或多个ID字节 (参见 [["8042" PS/2 Controller#Detecting PS.2F2 Device Types | "检测设备类型"]]) |- | 0xF3 | 类型字节: {| {{wikitable}} |- ! 逐位 ! 含义 |- | 0 to 4 | 重复频率 (00000b = 30Hz,...,11111b = 2Hz) |- | 5 to 6 | 键重复之前的延迟 (00b = 250 ms,01b = 500 ms,10b = 750 ms,11b = 1000 ms) |- | 7 | 必须为零 |} | 设置类型速率和延迟 | 0xFA (ACK) 或 0xFE (Resend) |- | 0xF4 | None | 启用扫描 (键盘会发送Scan Code) | 0xFA (ACK) 或 0xFE (Resend) |- | 0xF5 | None | 禁用扫描 (键盘不会发送Scan Code) 注意: 也许会恢复默认参数 | 0xFA (ACK) 或 0xFE (Resend) |- | 0xF6 | None | 设置默认参数 | 0xFA (ACK) 或 0xFE (Resend) |- | 0xF7 | None | 将所有键设置为仅typematic/autorepeat (仅scancode Set 3) | 0xFA (ACK) 或 0xFE (Resend) |- | 0xF8 | None | 将所有键设置为make/release (仅scancode Set 3) | 0xFA (ACK) 或 0xFE (Resend) |- | 0xF9 | None | 将所有键设置为仅make (仅scancode Set 3) | 0xFA (ACK) 或 0xFE (Resend) |- | 0xFA | None | 将所有键设置为 typematic/autorepeat/make/release (仅scancode Set 3) | 0xFA (ACK) or 0xFE (Resend) |- | 0xFB | 按键Scan Code | 将特定键设置为仅typematic/autorepeat (仅scancode Set 3) | 0xFA (ACK) 或 0xFE (Resend) |- | 0xFC | 按键Scan Code | 设置要制作/释放的特定键 (仅scancode Set 3) | 0xFA (ACK) 或 0xFE (Resend) |- | 0xFD | 按键Scan Code | 将特定键设置为仅使 (仅scancode Set 3) | 0xFA (ACK) 或 0xFE (Resend) |- | 0xFE | None | 重新发送最后一个字节 | 先前发送的字节或0xFE (Resend) |- | 0xFF | None | 重置并开始自检 | 0xAA (自检通过), 0xFC 或 0xFD (自检失败), 或 0xFE (Resend) |} == 特殊字节 == 键盘向系统发送字节。 其中一些字节具有特殊含义 (例如,来自上述命令的响应)。 键盘可能发送的字节是: {| {{wikitable}} |- ! 响应字节 ! 含义 |- | 0x00 | 键检测错误或内部缓冲区溢出 |- | 0xAA | 自检通过 (在 “0xFF (reset)” 命令或键盘加电后发送) |- | 0xEE | 对 “0xEE (echo)” 命令的响应 |- | 0xFA | 命令确认 (ACK) |- | 0xFC and 0xFD | 自检失败 (在 “0xFF (reset)” 命令或键盘加电后发送) |- | 0xFE | 重新发送 (键盘希望控制器重复它发送的最后一个命令) |- | 0xFF | 键检测错误或内部缓冲区溢出 |} 键盘发送的所有其他字节都是Scan Code,其中解释取决于当前选择的Scan Code Set。 == 驱动程序模型 == === 命令队列和状态机 === 命令必须一次发送一个 (例如,如果你的驱动程序是中断驱动的,则无法在IRQ处理程序中开始发送命令,因为IRQ处理程序之外的代码可能正在发送命令的中间)。 直到你收到确认后,该命令才完成。 例如,如果你发送命令,并且键盘以 “0xFE (重新发送)” 作为响应,那么你必须再次发送命令 (可能在你放弃之前限制为3次重试,并可以认为键盘不支持你正在发送的命令或出现硬件故障)。 最后,假如有时您想一次发送几个命令。 你可能有一个 “reinitialise()” 函数,该函数设置Scan Code Set,设置typematic字节,设置led并启用扫描。 实现这一目标的最简单方法是驱动程序维护一个命令队列。 将命令添加到队列时,如果队列为空,则开始发送命令; 否则,将命令附加到队列。 当你从键盘收到 “0xFA (ACK)” 时,你会丢弃队列头部的命令,并开始发送队列中的下一个命令 (如果有的话)。 如果你从键盘收到 “0xFE (Resend)”,则可以在队列的头部重新发送命令。 驱动程序的剩余部分应该是一种状态机。 当一些命令成功完成时,以及当从键盘接收到各种字节时,状态机进入不同的状态。 例如,驱动程序可能开始处于默认状态,然后接收到中断代码,此时该中断代码将其置于 “接收到中断代码后等待Scan Code” 状态。 然后,它可能会接收多字节Scan Code的第一个字节,并切换到 “在接收中断代码后等待第二个字节Scan Code” 状态。 最后,它可能会接收Scan Code的第二个/最后一个字节,然后切换回默认状态。 === Scan Code Sets, Scan Codes 和 Key Codes === Scan Code Set是一组编码,用于确定何时按下或重复或释放某个键。 有3组不同的Scan Code Set。 最老的是 “scan code set 1”,默认是 “scan code set 2”,还有更新的 (更复杂的) “scan code set 3”。 ''注意: 通常在PC兼容系统上,键盘本身使用Scan Code Set 2,并且键盘控制器将其转换为Scan Code Set 1以实现兼容性。 有关此处转换的更多信息,请参阅 [["8042"_PS/2_Controller#Translation|"8042"_PS/2_Controller]]。'' 现代键盘应该支持所有三个Scan Code Set,但是仍有些则不支持。 Scan Code Set 2 (默认值) 是唯一保证支持的Scan Code Set。 从理论上讲 (我还没有尝试过),应该可以尝试设置Scan Code Set 1或Scan Code Set 3,然后询问键盘当前正在使用哪个Scan Code,看看它是否实际上正在使用请求的Scan Code Set。 以这种方式,可以确定键盘确实支持哪个Scan Code Set。 Scan Code本身是一个或多个字节的序列。 在某些情况下,序列可以多达6个字节 (例如,Scan Code Set 1中的Pause/Break键 按下时生成序列0xE1,0x1D,0x45,0xE1,0x9D,0xC5)。 这种情况对后续开发并不理想。 通常,你希望将这些 “一个或多个字节序列” 转换为唯一标识特定键的单个整数,可以在诸如查找表之类的事情中有效使用 (这种表不需要是那种稀疏的又有几个G的查找表)。 所以提出了Key Code,“Key Code” 没有标准 - 这是你必须为操作系统弥补或发明的东西。 我个人喜欢一个有8位Key Code的想法,其中最高的3位确定键盘上的哪一行,最低的5位确定哪一列 (本质上,键盘被视为最多8行和最多32列键的网格)。 无论你选择使用什么Key Code,它都应该是所有键盘驱动程序 (包括USB键盘) 使用的东西,也可能用于其他输入设备 (例如,鼠标左键可能被视为 “Key Code 0xF1”)。 基本上,当键盘驱动程序的状态机知道它已经收到完整的Scan Code时,下一步就是将 “一个或多个字节” 的Scan Code转换为Key Code。 === Key Code、按键状态和键映射 === 一旦有了Key Code,下一步就是跟踪当前正在按下的键。 想象一个使用 “WASD” 键进行玩家移动的计算机游戏-按下 “a” 键时,玩家会逆时针旋转。 游戏如何知道当前是否正在按下 “A” 键?为此,你需要一个标志数组,其中每个标志对应于一个Key Code。 这里有一个隐藏的奖励-键盘驱动程序本身可以使用相同的 “标志数组” 来确定shift键,控制键,alt键等是否按下,这在尝试将Key Code转换为实际的ASCII字符或Unicode码点时非常有用。 例如,如果用户按下 “a” 键,则它可能对应于 “a” 或 “A” (取决于capslock状态以及当时是否按住shift键),或者可能根本不对应于有效字符 (例如 “control-a” 或 “alt-a” “)。 还要注意 (例如) “WASD” 游戏不在乎键是否为 'W','A','S' 和 'D'。 游戏只希望掌握键盘 “T形” 区域的按键。 如果有键盘恰好这些键不是T形布局的,那么在同一位置的键可能是完全不同的 (例如,它们将是Dvorak键盘上的 '<' 、 'A' 、 'O' 和 'E' 键)。 这也解释了我的偏好8位键代码方案的原因,其中最高的3位决定键盘上的哪一行,最低的5位决定哪一列 (这很容易让游戏询问第三行左边的第三个键的状态)。 一旦能够跟踪当前正在按下的键,下一步就是 (尝试) 将键转换为ASCII字符或Unicode代码点。 在这一点上,你需要知道用户拥有哪种类型的键盘-是 “US QWERTY” 还是 “French AZERTY”,某种形式的Dvorak,还是阿拉伯语。 要处理许多不同的键盘布局,键盘驱动程序需要使用表格将Key Code转换为ASCII字符或Unicode代码点; 因此,你只需要加载不同的 “键映射” 表即可支持不同的键盘布局。 然而,事情并不是那么简单。 不同的键盘布局可以有不同的元键(meta keys)、不同的状态LED等。 键映射表也必须对这些差异进行处理。 这就是为什么如有必要的情况下,你不应该检测键盘LED是否已发生了变化,而应该在你在键映射表中找到Key Code的条目后发送 “设置LED” 命令。 处理的最后一步是将所有相关信息组合成某种 “keypress数据包” 结构,并将其发送给任何人 (例如GUI)。 整个 “keypress数据包” 可能包括以下内容: * Unicode码点 (如适用) * Key Code * 按下/释放标志 * 各种其他关键状态 (shift、alt、control等) * 各种 “切换” 状态 (CapsLock、ScrollLock、NumberLock等) == Scan Code Set == 由于有3个不同的Scan Code Set,因此有3个不同的表 (每个Scan Code Set一个)。 一些Scan Code对应于随着时间的推移而添加的额外键,并且变得 “相对标准”。 为了帮助保持跟踪,Scan Code已在下表中进行了分类和标记。 首先使用的分类标签如下: {| {{wikitable}} |- ! 标签 ! 含义 |- | (keypad) | 数字键盘上的键 (通常在键盘的右侧找到)。 |- | (ACPI) | 属于 “ACPI” 键组部分的键 (通常在键盘顶部附近找到)。 许多现代键盘实际上没有这些键 (如果我没记错的话,它们在20世纪90年代末很流行,但此后变得不那么普遍了)。 注意: 不要让这个名字愚弄你-这些键与ACPI(译者注:BIOS有Advanced Configuration and Power Interface-高级配置与电源接口)完全无关,并且表现得像任何其他普通键 (但对于支持电源管理的操作系统可能有用)。 |- | (multimedia) | 是多媒体键组的一部分的键 (通常在键盘顶部附近找到)。 许多现代键盘确实至少有一些这样的键。 这些键中的一些用于媒体播放器 (音量控制、播放/暂停、下一首曲目、上一首曲目等), 一些用于网络浏览(上一网页、下一网页、刷新、收藏夹/书签等), 还有一些用于启动应用程序(例如启动电子邮件客户端、启动计算器、打开“我的电脑”等)。 |} === Scan Code Set 1 === 下表显示了使用Scan Code Set 1 (仅适用于 “US QWERTY” 键盘) 时,哪些Scan Code对应于哪些键: {| {{wikitable}} |- ! Scan code ! Key ! style="background: #E8E8E8" | Scan code ! style="background: #E8E8E8" | Key ! Scan code ! Key ! style="background: #E8E8E8" | Scan code ! style="background: #E8E8E8" | Key |- | | | style="background: #E8E8E8" align="right" | 0x01 | style="background: #E8E8E8" | escape pressed | align="right" | 0x02 | 1 pressed | style="background: #E8E8E8" align="right" | 0x03 | style="background: #E8E8E8" | 2 pressed |- | align="right" | 0x04 | 3 pressed | style="background: #E8E8E8" align="right" | 0x05 | style="background: #E8E8E8" | 4 pressed | align="right" | 0x06 | 5 pressed | style="background: #E8E8E8" align="right" | 0x07 | style="background: #E8E8E8" | 6 pressed |- | align="right" | 0x08 | 7 pressed | style="background: #E8E8E8" align="right" | 0x09 | style="background: #E8E8E8" | 8 pressed | align="right" | 0x0A | 9 pressed | style="background: #E8E8E8" align="right" | 0x0B | style="background: #E8E8E8" | 0 (zero) pressed |- | align="right" | 0x0C | - pressed | style="background: #E8E8E8" align="right" | 0x0D | style="background: #E8E8E8" | = pressed | align="right" | 0x0E | backspace pressed | style="background: #E8E8E8" align="right" | 0x0F | style="background: #E8E8E8" | tab pressed |- | align="right" | 0x10 | Q pressed | style="background: #E8E8E8" align="right" | 0x11 | style="background: #E8E8E8" | W pressed | align="right" | 0x12 | E pressed | style="background: #E8E8E8" align="right" | 0x13 | style="background: #E8E8E8" | R pressed |- | align="right" | 0x14 | T pressed | style="background: #E8E8E8" align="right" | 0x15 | style="background: #E8E8E8" | Y pressed | align="right" | 0x16 | U pressed | style="background: #E8E8E8" align="right" | 0x17 | style="background: #E8E8E8" | I pressed |- | align="right" | 0x18 | O pressed | style="background: #E8E8E8" align="right" | 0x19 | style="background: #E8E8E8" | P pressed | align="right" | 0x1A | [ pressed | style="background: #E8E8E8" align="right" | 0x1B | style="background: #E8E8E8" | ] pressed |- | align="right" | 0x1C | enter pressed | style="background: #E8E8E8" align="right" | 0x1D | style="background: #E8E8E8" | left control pressed | align="right" | 0x1E | A pressed | style="background: #E8E8E8" align="right" | 0x1F | style="background: #E8E8E8" | S pressed |- | align="right" | 0x20 | D pressed | style="background: #E8E8E8" align="right" | 0x21 | style="background: #E8E8E8" | F pressed | align="right" | 0x22 | G pressed | style="background: #E8E8E8" align="right" | 0x23 | style="background: #E8E8E8" | H pressed |- | align="right" | 0x24 | J pressed | style="background: #E8E8E8" align="right" | 0x25 | style="background: #E8E8E8" | K pressed | align="right" | 0x26 | L pressed | style="background: #E8E8E8" align="right" | 0x27 | style="background: #E8E8E8" | ; pressed |- | align="right" | 0x28 | ' (single quote) pressed | style="background: #E8E8E8" align="right" | 0x29 | style="background: #E8E8E8" | ` (back tick) pressed | align="right" | 0x2A | left shift pressed | style="background: #E8E8E8" align="right" | 0x2B | style="background: #E8E8E8" | \ pressed |- | align="right" | 0x2C | Z pressed | style="background: #E8E8E8" align="right" | 0x2D | style="background: #E8E8E8" | X pressed | align="right" | 0x2E | C pressed | style="background: #E8E8E8" align="right" | 0x2F | style="background: #E8E8E8" | V pressed |- | align="right" | 0x30 | B pressed | style="background: #E8E8E8" align="right" | 0x31 | style="background: #E8E8E8" | N pressed | align="right" | 0x32 | M pressed | style="background: #E8E8E8" align="right" | 0x33 | style="background: #E8E8E8" | , pressed |- | align="right" | 0x34 | . pressed | style="background: #E8E8E8" align="right" | 0x35 | style="background: #E8E8E8" | / pressed | align="right" | 0x36 | right shift pressed | style="background: #E8E8E8" align="right" | 0x37 | style="background: #E8E8E8" | (keypad) * pressed |- | align="right" | 0x38 | left alt pressed | style="background: #E8E8E8" align="right" | 0x39 | style="background: #E8E8E8" | space pressed | align="right" | 0x3A | CapsLock pressed | style="background: #E8E8E8" align="right" | 0x3B | style="background: #E8E8E8" | F1 pressed |- | align="right" | 0x3C | F2 pressed | style="background: #E8E8E8" align="right" | 0x3D | style="background: #E8E8E8" | F3 pressed | align="right" | 0x3E | F4 pressed | style="background: #E8E8E8" align="right" | 0x3F | style="background: #E8E8E8" | F5 pressed |- | align="right" | 0x40 | F6 pressed | style="background: #E8E8E8" align="right" | 0x41 | style="background: #E8E8E8" | F7 pressed | align="right" | 0x42 | F8 pressed | style="background: #E8E8E8" align="right" | 0x43 | style="background: #E8E8E8" | F9 pressed |- | align="right" | 0x44 | F10 pressed | style="background: #E8E8E8" align="right" | 0x45 | style="background: #E8E8E8" | NumberLock pressed | align="right" | 0x46 | ScrollLock pressed | style="background: #E8E8E8" align="right" | 0x47 | style="background: #E8E8E8" | (keypad) 7 pressed |- | align="right" | 0x48 | (keypad) 8 pressed | style="background: #E8E8E8" align="right" | 0x49 | style="background: #E8E8E8" | (keypad) 9 pressed | align="right" | 0x4A | (keypad) - pressed | style="background: #E8E8E8" align="right" | 0x4B | style="background: #E8E8E8" | (keypad) 4 pressed |- | align="right" | 0x4C | (keypad) 5 pressed | style="background: #E8E8E8" align="right" | 0x4D | style="background: #E8E8E8" | (keypad) 6 pressed | align="right" | 0x4E | (keypad) + pressed | style="background: #E8E8E8" align="right" | 0x4F | style="background: #E8E8E8" | (keypad) 1 pressed |- | align="right" | 0x50 | (keypad) 2 pressed | style="background: #E8E8E8" align="right" | 0x51 | style="background: #E8E8E8" | (keypad) 3 pressed | align="right" | 0x52 | (keypad) 0 pressed | style="background: #E8E8E8" align="right" | 0x53 | style="background: #E8E8E8" | (keypad) . pressed |- | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | | | | style="background: #E8E8E8" align="right" | 0x57 | style="background: #E8E8E8" | F11 pressed |- | align="right" | 0x58 | F12 pressed | style="background: #E8E8E8" | | style="background: #E8E8E8" | | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | | | style="background: #E8E8E8" align="right" | 0x81 | style="background: #E8E8E8" | escape released | align="right" | 0x82 | 1 released | style="background: #E8E8E8" align="right" | 0x83 | style="background: #E8E8E8" | 2 released |- | align="right" | 0x84 | 3 released | style="background: #E8E8E8" align="right" | 0x85 | style="background: #E8E8E8" | 4 released | align="right" | 0x86 | 5 released | style="background: #E8E8E8" align="right" | 0x87 | style="background: #E8E8E8" | 6 released |- | align="right" | 0x88 | 7 released | style="background: #E8E8E8" align="right" | 0x89 | style="background: #E8E8E8" | 8 released | align="right" | 0x8A | 9 released | style="background: #E8E8E8" align="right" | 0x8B | style="background: #E8E8E8" | 0 (zero) released |- | align="right" | 0x8C | - released | style="background: #E8E8E8" align="right" | 0x8D | style="background: #E8E8E8" | = released | align="right" | 0x8E | backspace released | style="background: #E8E8E8" align="right" | 0x8F | style="background: #E8E8E8" | tab released |- | align="right" | 0x90 | Q released | style="background: #E8E8E8" align="right" | 0x91 | style="background: #E8E8E8" | W released | align="right" | 0x92 | E released | style="background: #E8E8E8" align="right" | 0x93 | style="background: #E8E8E8" | R released |- | align="right" | 0x94 | T released | style="background: #E8E8E8" align="right" | 0x95 | style="background: #E8E8E8" | Y released | align="right" | 0x96 | U released | style="background: #E8E8E8" align="right" | 0x97 | style="background: #E8E8E8" | I released |- | align="right" | 0x98 | O released | style="background: #E8E8E8" align="right" | 0x99 | style="background: #E8E8E8" | P released | align="right" | 0x9A | [ released | style="background: #E8E8E8" align="right" | 0x9B | style="background: #E8E8E8" | ] released |- | align="right" | 0x9C | enter released | style="background: #E8E8E8" align="right" | 0x9D | style="background: #E8E8E8" | left control released | align="right" | 0x9E | A released | style="background: #E8E8E8" align="right" | 0x9F | style="background: #E8E8E8" | S released |- | align="right" | 0xA0 | D released | style="background: #E8E8E8" align="right" | 0xA1 | style="background: #E8E8E8" | F released | align="right" | 0xA2 | G released | style="background: #E8E8E8" align="right" | 0xA3 | style="background: #E8E8E8" | H released |- | align="right" | 0xA4 | J released | style="background: #E8E8E8" align="right" | 0xA5 | style="background: #E8E8E8" | K released | align="right" | 0xA6 | L released | style="background: #E8E8E8" align="right" | 0xA7 | style="background: #E8E8E8" | ; released |- | align="right" | 0xA8 | ' (single quote) released | style="background: #E8E8E8" align="right" | 0xA9 | style="background: #E8E8E8" | ` (back tick) released | align="right" | 0xAA | left shift released | style="background: #E8E8E8" align="right" | 0xAB | style="background: #E8E8E8" | \ released |- | align="right" | 0xAC | Z released | style="background: #E8E8E8" align="right" | 0xAD | style="background: #E8E8E8" | X released | align="right" | 0xAE | C released | style="background: #E8E8E8" align="right" | 0xAF | style="background: #E8E8E8" | V released |- | align="right" | 0xB0 | B released | style="background: #E8E8E8" align="right" | 0xB1 | style="background: #E8E8E8" | N released | align="right" | 0xB2 | M released | style="background: #E8E8E8" align="right" | 0xB3 | style="background: #E8E8E8" | , released |- | align="right" | 0xB4 | . released | style="background: #E8E8E8" align="right" | 0xB5 | style="background: #E8E8E8" | / released | align="right" | 0xB6 | right shift released | style="background: #E8E8E8" align="right" | 0xB7 | style="background: #E8E8E8" | (keypad) * released |- | align="right" | 0xB8 | left alt released | style="background: #E8E8E8" align="right" | 0xB9 | style="background: #E8E8E8" | space released | align="right" | 0xBA | CapsLock released | style="background: #E8E8E8" align="right" | 0xBB | style="background: #E8E8E8" | F1 released |- | align="right" | 0xBC | F2 released | style="background: #E8E8E8" align="right" | 0xBD | style="background: #E8E8E8" | F3 released | align="right" | 0xBE | F4 released | style="background: #E8E8E8" align="right" | 0xBF | style="background: #E8E8E8" | F5 released |- | align="right" | 0xC0 | F6 released | style="background: #E8E8E8" align="right" | 0xC1 | style="background: #E8E8E8" | F7 released | align="right" | 0xC2 | F8 released | style="background: #E8E8E8" align="right" | 0xC3 | style="background: #E8E8E8" | F9 released |- | align="right" | 0xC4 | F10 released | style="background: #E8E8E8" align="right" | 0xC5 | style="background: #E8E8E8" | NumberLock released | align="right" | 0xC6 | ScrollLock released | style="background: #E8E8E8" align="right" | 0xC7 | style="background: #E8E8E8" | (keypad) 7 released |- | align="right" | 0xC8 | (keypad) 8 released | style="background: #E8E8E8" align="right" | 0xC9 | style="background: #E8E8E8" | (keypad) 9 released | align="right" | 0xCA | (keypad) - released | style="background: #E8E8E8" align="right" | 0xCB | style="background: #E8E8E8" | (keypad) 4 released |- | align="right" | 0xCC | (keypad) 5 released | style="background: #E8E8E8" align="right" | 0xCD | style="background: #E8E8E8" | (keypad) 6 released | align="right" | 0xCE | (keypad) + released | style="background: #E8E8E8" align="right" | 0xCF | style="background: #E8E8E8" | (keypad) 1 released |- | align="right" | 0xD0 | (keypad) 2 released | style="background: #E8E8E8" align="right" | 0xD1 | style="background: #E8E8E8" | (keypad) 3 released | align="right" | 0xD2 | (keypad) 0 released | style="background: #E8E8E8" align="right" | 0xD3 | style="background: #E8E8E8" | (keypad) . released |- | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | | | | style="background: #E8E8E8" align="right" | 0xD7 | style="background: #E8E8E8" | F11 released |- | align="right" | 0xD8 | F12 released | style="background: #E8E8E8" | | style="background: #E8E8E8" | | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | align="right" | 0xE0, 0x10 | (multimedia) previous track pressed | style="background: #E8E8E8" | | style="background: #E8E8E8" | | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | | | style="background: #E8E8E8" align="right" | 0xE0, 0x19 | style="background: #E8E8E8" | (multimedia) next track pressed | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | align="right" | 0xE0, 0x1C | (keypad) enter pressed | style="background: #E8E8E8" align="right" | 0xE0, 0x1D | style="background: #E8E8E8" | right control pressed | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | align="right" | 0xE0, 0x20 | (multimedia) mute pressed | style="background: #E8E8E8" align="right" | 0xE0, 0x21 | style="background: #E8E8E8" | (multimedia) calculator pressed | align="right" | 0xE0, 0x22 | (multimedia) play pressed | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | align="right" | 0xE0, 0x24 | (multimedia) stop pressed | style="background: #E8E8E8" | | style="background: #E8E8E8" | | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | | align="right" | 0xE0, 0x2E | (multimedia) volume down pressed | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | align="right" | 0xE0, 0x30 | (multimedia) volume up pressed | style="background: #E8E8E8" | | style="background: #E8E8E8" | | align="right" | 0xE0, 0x32 | (multimedia) WWW home pressed | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | | | style="background: #E8E8E8" align="right" | 0xE0, 0x35 | style="background: #E8E8E8" | (keypad) / pressed | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | align="right" | 0xE0, 0x38 | right alt (or altGr) pressed | style="background: #E8E8E8" | | style="background: #E8E8E8" | | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | | | | style="background: #E8E8E8" align="right" | 0xE0, 0x47 | style="background: #E8E8E8" | home pressed |- | align="right" | 0xE0, 0x48 | cursor up pressed | style="background: #E8E8E8" align="right" | 0xE0, 0x49 | style="background: #E8E8E8" | page up pressed | | | style="background: #E8E8E8" align="right" | 0xE0, 0x4B | style="background: #E8E8E8" | cursor left pressed |- | | | style="background: #E8E8E8" align="right" | 0xE0, 0x4D | style="background: #E8E8E8" | cursor right pressed | | | style="background: #E8E8E8" align="right" | 0xE0, 0x4F | style="background: #E8E8E8" | end pressed |- | align="right" | 0xE0, 0x50 | cursor down pressed | style="background: #E8E8E8" align="right" | 0xE0, 0x51 | style="background: #E8E8E8" | page down pressed | align="right" | 0xE0, 0x52 | insert pressed | style="background: #E8E8E8" align="right" | 0xE0, 0x53 | style="background: #E8E8E8" | delete pressed |- | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | | | | style="background: #E8E8E8" align="right" | 0xE0, 0x5B | style="background: #E8E8E8" | left GUI pressed |- | align="right" | 0xE0, 0x5C | right GUI pressed | style="background: #E8E8E8" align="right" | 0xE0, 0x5D | style="background: #E8E8E8" | "apps" pressed | align="right" | 0xE0, 0x5E | (ACPI) power pressed | style="background: #E8E8E8" align="right" | 0xE0, 0x5F | style="background: #E8E8E8" | (ACPI) sleep pressed |- | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | | | | style="background: #E8E8E8" align="right" | 0xE0, 0x63 | style="background: #E8E8E8" | (ACPI) wake pressed |- | | | style="background: #E8E8E8" align="right" | 0xE0, 0x65 | style="background: #E8E8E8" | (multimedia) WWW search pressed | align="right" | 0xE0, 0x66 | (multimedia) WWW favorites pressed | style="background: #E8E8E8" align="right" | 0xE0, 0x67 | style="background: #E8E8E8" | (multimedia) WWW refresh pressed |- | align="right" | 0xE0, 0x68 | (multimedia) WWW stop pressed | style="background: #E8E8E8" align="right" | 0xE0, 0x69 | style="background: #E8E8E8" | (multimedia) WWW forward pressed | align="right" | 0xE0, 0x6A | (multimedia) WWW back pressed | style="background: #E8E8E8" align="right" | 0xE0, 0x6B | style="background: #E8E8E8" | (multimedia) my computer pressed |- | align="right" | 0xE0, 0x6C | (multimedia) email pressed | style="background: #E8E8E8" align="right" | 0xE0, 0x6D | style="background: #E8E8E8" | (multimedia) media select pressed | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | align="right" | 0xE0, 0x90 | (multimedia) previous track released | style="background: #E8E8E8" | | style="background: #E8E8E8" | | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | | | style="background: #E8E8E8" align="right" | 0xE0, 0x99 | style="background: #E8E8E8" | (multimedia) next track released | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | align="right" | 0xE0, 0x9C | (keypad) enter released | style="background: #E8E8E8" align="right" | 0xE0, 0x9D | style="background: #E8E8E8" | right control released | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | align="right" | 0xE0, 0xA0 | (multimedia) mute released | style="background: #E8E8E8" align="right" | 0xE0, 0xA1 | style="background: #E8E8E8" | (multimedia) calculator released | align="right" | 0xE0, 0xA2 | (multimedia) play released | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | align="right" | 0xE0, 0xA4 | (multimedia) stop released | style="background: #E8E8E8" | | style="background: #E8E8E8" | | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | | align="right" | 0xE0, 0xAE | (multimedia) volume down released | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | align="right" | 0xE0, 0xB0 | (multimedia) volume up released | style="background: #E8E8E8" | | style="background: #E8E8E8" | | align="right" | 0xE0, 0xB2 | (multimedia) WWW home released | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | | | style="background: #E8E8E8" align="right" | 0xE0, 0xB5 | style="background: #E8E8E8" | (keypad) / released | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | align="right" | 0xE0, 0xB8 | right alt (or altGr) released | style="background: #E8E8E8" | | style="background: #E8E8E8" | | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | | | | style="background: #E8E8E8" align="right" | 0xE0, 0xC7 | style="background: #E8E8E8" | home released |- | align="right" | 0xE0, 0xC8 | cursor up released | style="background: #E8E8E8" align="right" | 0xE0, 0xC9 | style="background: #E8E8E8" | page up released | | | style="background: #E8E8E8" align="right" | 0xE0, 0xCB | style="background: #E8E8E8" | cursor left released |- | | | style="background: #E8E8E8" align="right" | 0xE0, 0xCD | style="background: #E8E8E8" | cursor right released | | | style="background: #E8E8E8" align="right" | 0xE0, 0xCF | style="background: #E8E8E8" | end released |- | align="right" | 0xE0, 0xD0 | cursor down released | style="background: #E8E8E8" align="right" | 0xE0, 0xD1 | style="background: #E8E8E8" | page down released | align="right" | 0xE0, 0xD2 | insert released | style="background: #E8E8E8" align="right" | 0xE0, 0xD3 | style="background: #E8E8E8" | delete released |- | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | | | | style="background: #E8E8E8" align="right" | 0xE0, 0xDB | style="background: #E8E8E8" | left GUI released |- | align="right" | 0xE0, 0xDC | right GUI released | style="background: #E8E8E8" align="right" | 0xE0, 0xDD | style="background: #E8E8E8" | "apps" released | align="right" | 0xE0, 0xDE | (ACPI) power released | style="background: #E8E8E8" align="right" | 0xE0, 0xDF | style="background: #E8E8E8" | (ACPI) sleep released |- | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | | | | style="background: #E8E8E8" align="right" | 0xE0, 0xE3 | style="background: #E8E8E8" | (ACPI) wake released |- | | | style="background: #E8E8E8" align="right" | 0xE0, 0xE5 | style="background: #E8E8E8" | (multimedia) WWW search released | align="right" | 0xE0, 0xE6 | (multimedia) WWW favorites released | style="background: #E8E8E8" align="right" | 0xE0, 0xE7 | style="background: #E8E8E8" | (multimedia) WWW refresh released |- | align="right" | 0xE0, 0xE8 | (multimedia) WWW stop released | style="background: #E8E8E8" align="right" | 0xE0, 0xE9 | style="background: #E8E8E8" | (multimedia) WWW forward released | align="right" | 0xE0, 0xEA | (multimedia) WWW back released | style="background: #E8E8E8" align="right" | 0xE0, 0xEB | style="background: #E8E8E8" | (multimedia) my computer released |- | align="right" | 0xE0, 0xEC | (multimedia) email released | style="background: #E8E8E8" align="right" | 0xE0, 0xED | style="background: #E8E8E8" | (multimedia) media select released | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | | | | style="background: #E8E8E8" align="right" | 0xE0, 0x2A, 0xE0, 0x37 | style="background: #E8E8E8" | print screen pressed |- | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | | | | style="background: #E8E8E8" align="right" | 0xE0, 0xB7, 0xE0, 0xAA | style="background: #E8E8E8" | print screen released |- | | | style="background: #E8E8E8" align="right" | 0xE1, 0x1D, 0x45, 0xE1, 0x9D, 0xC5 | style="background: #E8E8E8" | pause pressed | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | |} 注意: “pause key released” 没有Scan Code (它的行为就像按下后立即释放一样) === Scan Code Set 2 === 下表显示了使用Scan Code Set 2时,哪些Scan Code对应于哪些键(仅适用于“US QWERTY”键盘): {| {{wikitable}} |- ! Scan code ! Key ! style="background: #E8E8E8" | Scan code ! style="background: #E8E8E8" | Key ! Scan code ! Key ! style="background: #E8E8E8" | Scan code ! style="background: #E8E8E8" | Key |- | | | style="background: #E8E8E8" align="right" | 0x01 | style="background: #E8E8E8" | F9 pressed | | | style="background: #E8E8E8" align="right" | 0x03 | style="background: #E8E8E8" | F5 pressed |- | align="right" | 0x04 | F3 pressed | style="background: #E8E8E8" align="right" | 0x05 | style="background: #E8E8E8" | F1 pressed | align="right" | 0x06 | F2 pressed | style="background: #E8E8E8" align="right" | 0x07 | style="background: #E8E8E8" | F12 pressed |- | | | style="background: #E8E8E8" align="right" | 0x09 | style="background: #E8E8E8" | F10 pressed | align="right" | 0x0A | F8 pressed | style="background: #E8E8E8" align="right" | 0x0B | style="background: #E8E8E8" | F6 pressed |- | align="right" | 0x0C | F4 pressed | style="background: #E8E8E8" align="right" | 0x0D | style="background: #E8E8E8" | tab pressed | align="right" | 0x0E | ` (back tick) pressed | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | | | style="background: #E8E8E8" align="right" | 0x11 | style="background: #E8E8E8" | left alt pressed | align="right" | 0x12 | left shift pressed | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | align="right" | 0x14 | left control pressed | style="background: #E8E8E8" align="right" | 0x15 | style="background: #E8E8E8" | Q pressed | align="right" | 0x16 | 1 pressed | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | | align="right" | 0x1A | Z pressed | style="background: #E8E8E8" align="right" | 0x1B | style="background: #E8E8E8" | S pressed |- | align="right" | 0x1C | A pressed | style="background: #E8E8E8" align="right" | 0x1D | style="background: #E8E8E8" | W pressed | align="right" | 0x1E | 2 pressed | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | | | style="background: #E8E8E8" align="right" | 0x21 | style="background: #E8E8E8" | C pressed | align="right" | 0x22 | X pressed | style="background: #E8E8E8" align="right" | 0x23 | style="background: #E8E8E8" | D pressed |- | align="right" | 0x24 | E pressed | style="background: #E8E8E8" align="right" | 0x25 | style="background: #E8E8E8" | 4 pressed | align="right" | 0x26 | 3 pressed | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | | | style="background: #E8E8E8" align="right" | 0x29 | style="background: #E8E8E8" | space pressed | align="right" | 0x2A | V pressed | style="background: #E8E8E8" align="right" | 0x2B | style="background: #E8E8E8" | F pressed |- | align="right" | 0x2C | T pressed | style="background: #E8E8E8" align="right" | 0x2D | style="background: #E8E8E8" | R pressed | align="right" | 0x2E | 5 pressed | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | | | style="background: #E8E8E8" align="right" | 0x31 | style="background: #E8E8E8" | N pressed | align="right" | 0x32 | B pressed | style="background: #E8E8E8" align="right" | 0x33 | style="background: #E8E8E8" | H pressed |- | align="right" | 0x34 | G pressed | style="background: #E8E8E8" align="right" | 0x35 | style="background: #E8E8E8" | Y pressed | align="right" | 0x36 | 6 pressed | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | | align="right" | 0x3A | M pressed | style="background: #E8E8E8" align="right" | 0x3B | style="background: #E8E8E8" | J pressed |- | align="right" | 0x3C | U pressed | style="background: #E8E8E8" align="right" | 0x3D | style="background: #E8E8E8" | 7 pressed | align="right" | 0x3E | 8 pressed | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | | | style="background: #E8E8E8" align="right" | 0x41 | style="background: #E8E8E8" | , pressed | align="right" | 0x42 | K pressed | style="background: #E8E8E8" align="right" | 0x43 | style="background: #E8E8E8" | I pressed |- | align="right" | 0x44 | O pressed | style="background: #E8E8E8" align="right" | 0x45 | style="background: #E8E8E8" | 0 (zero) pressed | align="right" | 0x46 | 9 pressed | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | | | style="background: #E8E8E8" align="right" | 0x49 | style="background: #E8E8E8" | . pressed | align="right" | 0x4A | / pressed | style="background: #E8E8E8" align="right" | 0x4B | style="background: #E8E8E8" | L pressed |- | align="right" | 0x4C | ; pressed | style="background: #E8E8E8" align="right" | 0x4D | style="background: #E8E8E8" | P pressed | align="right" | 0x4E | - pressed | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | | align="right" | 0x52 | ' pressed | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | align="right" | 0x54 | [ pressed | style="background: #E8E8E8" align="right" | 0x55 | style="background: #E8E8E8" | = pressed | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | align="right" | 0x58 | CapsLock pressed | style="background: #E8E8E8" align="right" | 0x59 | style="background: #E8E8E8" | right shift pressed | align="right" | 0x5A | enter pressed | style="background: #E8E8E8" align="right" | 0x5B | style="background: #E8E8E8" | ] pressed |- | | | style="background: #E8E8E8" align="right" | 0x5D | style="background: #E8E8E8" | \ pressed | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | | align="right" | 0x66 | backspace pressed | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | | | style="background: #E8E8E8" align="right" | 0x69 | style="background: #E8E8E8" | (keypad) 1 pressed | | | style="background: #E8E8E8" align="right" | 0x6B | style="background: #E8E8E8" | (keypad) 4 pressed |- | align="right" | 0x6C | (keypad) 7 pressed | style="background: #E8E8E8" | | style="background: #E8E8E8" | | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | align="right" | 0x70 | (keypad) 0 pressed | style="background: #E8E8E8" align="right" | 0x71 | style="background: #E8E8E8" | (keypad) . pressed | align="right" | 0x72 | (keypad) 2 pressed | style="background: #E8E8E8" align="right" | 0x73 | style="background: #E8E8E8" | (keypad) 5 pressed |- | align="right" | 0x74 | (keypad) 6 pressed | style="background: #E8E8E8" align="right" | 0x75 | style="background: #E8E8E8" | (keypad) 8 pressed | align="right" | 0x76 | escape pressed | style="background: #E8E8E8" align="right" | 0x77 | style="background: #E8E8E8" | NumberLock pressed |- | align="right" | 0x78 | F11 pressed | style="background: #E8E8E8" align="right" | 0x79 | style="background: #E8E8E8" | (keypad) + pressed | align="right" | 0x7A | (keypad) 3 pressed | style="background: #E8E8E8" align="right" | 0x7B | style="background: #E8E8E8" | (keypad) - pressed |- | align="right" | 0x7C | (keypad) * pressed | style="background: #E8E8E8" align="right" | 0x7D | style="background: #E8E8E8" | (keypad) 9 pressed | align="right" | 0x7E | ScrollLock pressed | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | | | | style="background: #E8E8E8" align="right" | 0x83 | style="background: #E8E8E8" | F7 pressed |- | align="right" | 0xE0, 0x10 | (multimedia) WWW search pressed | style="background: #E8E8E8" align="right" | 0xE0, 0x11 | style="background: #E8E8E8" | right alt pressed | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | align="right" | 0xE0, 0x14 | right control pressed | style="background: #E8E8E8" align="right" | 0xE0, 0x15 | style="background: #E8E8E8" | (multimedia) previous track pressed | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | align="right" | 0xE0, 0x18 | (multimedia) WWW favourites pressed | style="background: #E8E8E8" | | style="background: #E8E8E8" | | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | | | | style="background: #E8E8E8" align="right" | 0xE0, 0x1F | style="background: #E8E8E8" | left GUI pressed |- | align="right" | 0xE0, 0x20 | (multimedia) WWW refresh pressed | style="background: #E8E8E8" align="right" | 0xE0, 0x21 | style="background: #E8E8E8" | (multimedia) volume down pressed | | | style="background: #E8E8E8" align="right" | 0xE0, 0x23 | style="background: #E8E8E8" | (multimedia) mute pressed |- | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | | | | style="background: #E8E8E8" align="right" | 0xE0, 0x27 | style="background: #E8E8E8" | right GUI pressed |- | align="right" | 0xE0, 0x28 | (multimedia) WWW stop pressed | style="background: #E8E8E8" | | style="background: #E8E8E8" | | | | style="background: #E8E8E8" align="right" | 0xE0, 0x2B | style="background: #E8E8E8" | (multimedia) calculator pressed |- | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | | | | style="background: #E8E8E8" align="right" | 0xE0, 0x2F | style="background: #E8E8E8" | apps pressed |- | align="right" | 0xE0, 0x30 | (multimedia) WWW forward pressed | style="background: #E8E8E8" | | style="background: #E8E8E8" | | align="right" | 0xE0, 0x32 | (multimedia) volume up pressed | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | align="right" | 0xE0, 0x34 | (multimedia) play/pause pressed | style="background: #E8E8E8" | | style="background: #E8E8E8" | | | | style="background: #E8E8E8" align="right" | 0xE0, 0x37 | style="background: #E8E8E8" | (ACPI) power pressed |- | align="right" | 0xE0, 0x38 | (multimedia) WWW back pressed | style="background: #E8E8E8" | | style="background: #E8E8E8" | | align="right" | 0xE0, 0x3A | (multimedia) WWW home pressed | style="background: #E8E8E8" align="right" | 0xE0, 0x3B | style="background: #E8E8E8" | (multimedia) stop pressed |- | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | | | | style="background: #E8E8E8" align="right" | 0xE0, 0x3F | style="background: #E8E8E8" | (ACPI) sleep pressed |- | align="right" | 0xE0, 0x40 | (multimedia) my computer pressed | style="background: #E8E8E8" | | style="background: #E8E8E8" | | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | align="right" | 0xE0, 0x48 | (multimedia) email pressed | style="background: #E8E8E8" | | style="background: #E8E8E8" | | align="right" | 0xE0, 0x4A | (keypad) / pressed | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | | | style="background: #E8E8E8" align="right" | 0xE0, 0x4D | style="background: #E8E8E8" | (multimedia) next track pressed | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | align="right" | 0xE0, 0x50 | (multimedia) media select pressed | style="background: #E8E8E8" | | style="background: #E8E8E8" | | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | | align="right" | 0xE0, 0x5A | (keypad) enter pressed | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | | align="right" | 0xE0, 0x5E | (ACPI) wake pressed | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | | | style="background: #E8E8E8" align="right" | 0xE0, 0x69 | style="background: #E8E8E8" | end pressed | | | style="background: #E8E8E8" align="right" | 0xE0, 0x6B | style="background: #E8E8E8" | cursor left pressed |- | align="right" | 0xE0, 0x6C | home pressed | style="background: #E8E8E8" | | style="background: #E8E8E8" | | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | align="right" | 0xE0, 0x70 | insert pressed | style="background: #E8E8E8" align="right" | 0xE0, 0x71 | style="background: #E8E8E8" | delete pressed | align="right" | 0xE0, 0x72 | cursor down pressed | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | align="right" | 0xE0, 0x74 | cursor right pressed | style="background: #E8E8E8" align="right" | 0xE0, 0x75 | style="background: #E8E8E8" | cursor up pressed | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | | align="right" | 0xE0, 0x7A | page down pressed | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | | | style="background: #E8E8E8" align="right" | 0xE0, 0x7D | style="background: #E8E8E8" | page up pressed | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | | | style="background: #E8E8E8" align="right" | 0xF0, 0x01 | style="background: #E8E8E8" | F9 released | | | style="background: #E8E8E8" align="right" | 0xF0, 0x03 | style="background: #E8E8E8" | F5 released |- | align="right" | 0xF0, 0x04 | F3 released | style="background: #E8E8E8" align="right" | 0xF0, 0x05 | style="background: #E8E8E8" | F1 released | align="right" | 0xF0, 0x06 | F2 released | style="background: #E8E8E8" align="right" | 0xF0, 0x07 | style="background: #E8E8E8" | F12 released |- | | | style="background: #E8E8E8" align="right" | 0xF0, 0x09 | style="background: #E8E8E8" | F10 released | align="right" | 0xF0, 0x0A | F8 released | style="background: #E8E8E8" align="right" | 0xF0, 0x0B | style="background: #E8E8E8" | F6 released |- | align="right" | 0xF0, 0x0C | F4 released | style="background: #E8E8E8" align="right" | 0xF0, 0x0D | style="background: #E8E8E8" | tab released | align="right" | 0xF0, 0x0E | ` (back tick) released | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | | | style="background: #E8E8E8" align="right" | 0xF0, 0x11 | style="background: #E8E8E8" | left alt released | align="right" | 0xF0, 0x12 | left shift released | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | align="right" | 0xF0, 0x14 | left control released | style="background: #E8E8E8" align="right" | 0xF0, 0x15 | style="background: #E8E8E8" | Q released | align="right" | 0xF0, 0x16 | 1 released | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | | align="right" | 0xF0, 0x1A | Z released | style="background: #E8E8E8" align="right" | 0xF0, 0x1B | style="background: #E8E8E8" | S released |- | align="right" | 0xF0, 0x1C | A released | style="background: #E8E8E8" align="right" | 0xF0, 0x1D | style="background: #E8E8E8" | W released | align="right" | 0xF0, 0x1E | 2 released | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | | | style="background: #E8E8E8" align="right" | 0xF0, 0x21 | style="background: #E8E8E8" | C released | align="right" | 0xF0, 0x22 | X released | style="background: #E8E8E8" align="right" | 0xF0, 0x23 | style="background: #E8E8E8" | D released |- | align="right" | 0xF0, 0x24 | E released | style="background: #E8E8E8" align="right" | 0xF0, 0x25 | style="background: #E8E8E8" | 4 released | align="right" | 0xF0, 0x26 | 3 released | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | | | style="background: #E8E8E8" align="right" | 0xF0, 0x29 | style="background: #E8E8E8" | space released | align="right" | 0xF0, 0x2A | V released | style="background: #E8E8E8" align="right" | 0xF0, 0x2B | style="background: #E8E8E8" | F released |- | align="right" | 0xF0, 0x2C | T released | style="background: #E8E8E8" align="right" | 0xF0, 0x2D | style="background: #E8E8E8" | R released | align="right" | 0xF0, 0x2E | 5 released | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | | | style="background: #E8E8E8" align="right" | 0xF0, 0x31 | style="background: #E8E8E8" | N released | align="right" | 0xF0, 0x32 | B released | style="background: #E8E8E8" align="right" | 0xF0, 0x33 | style="background: #E8E8E8" | H released |- | align="right" | 0xF0, 0x34 | G released | style="background: #E8E8E8" align="right" | 0xF0, 0x35 | style="background: #E8E8E8" | Y released | align="right" | 0xF0, 0x36 | 6 released | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | | align="right" | 0xF0, 0x3A | M released | style="background: #E8E8E8" align="right" | 0xF0, 0x3B | style="background: #E8E8E8" | J released |- | align="right" | 0xF0, 0x3C | U released | style="background: #E8E8E8" align="right" | 0xF0, 0x3D | style="background: #E8E8E8" | 7 released | align="right" | 0xF0, 0x3E | 8 released | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | | | style="background: #E8E8E8" align="right" | 0xF0, 0x41 | style="background: #E8E8E8" | , released | align="right" | 0xF0, 0x42 | K released | style="background: #E8E8E8" align="right" | 0xF0, 0x43 | style="background: #E8E8E8" | I released |- | align="right" | 0xF0, 0x44 | O released | style="background: #E8E8E8" align="right" | 0xF0, 0x45 | style="background: #E8E8E8" | 0 (zero) released | align="right" | 0xF0, 0x46 | 9 released | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | | | style="background: #E8E8E8" align="right" | 0xF0, 0x49 | style="background: #E8E8E8" | . released | align="right" | 0xF0, 0x4A | / released | style="background: #E8E8E8" align="right" | 0xF0, 0x4B | style="background: #E8E8E8" | L released |- | align="right" | 0xF0, 0x4C | ; released | style="background: #E8E8E8" align="right" | 0xF0, 0x4D | style="background: #E8E8E8" | P released | align="right" | 0xF0, 0x4E | - released | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | | align="right" | 0xF0, 0x52 | ' released | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | align="right" | 0xF0, 0x54 | [ released | style="background: #E8E8E8" align="right" | 0xF0, 0x55 | style="background: #E8E8E8" | = released | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | align="right" | 0xF0, 0x58 | CapsLock released | style="background: #E8E8E8" align="right" | 0xF0, 0x59 | style="background: #E8E8E8" | right shift released | align="right" | 0xF0, 0x5A | enter released | style="background: #E8E8E8" align="right" | 0xF0, 0x5B | style="background: #E8E8E8" | ] released |- | | | style="background: #E8E8E8" align="right" | 0xF0, 0x5D | style="background: #E8E8E8" | \ released | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | | align="right" | 0xF0, 0x66 | backspace released | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | | | style="background: #E8E8E8" align="right" | 0xF0, 0x69 | style="background: #E8E8E8" | (keypad) 1 released | | | style="background: #E8E8E8" align="right" | 0xF0, 0x6B | style="background: #E8E8E8" | (keypad) 4 released |- | align="right" | 0xF0, 0x6C | (keypad) 7 released | style="background: #E8E8E8" | | style="background: #E8E8E8" | | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | align="right" | 0xF0, 0x70 | (keypad) 0 released | style="background: #E8E8E8" align="right" | 0xF0, 0x71 | style="background: #E8E8E8" | (keypad) . released | align="right" | 0xF0, 0x72 | (keypad) 2 released | style="background: #E8E8E8" align="right" | 0xF0, 0x73 | style="background: #E8E8E8" | (keypad) 5 released |- | align="right" | 0xF0, 0x74 | (keypad) 6 released | style="background: #E8E8E8" align="right" | 0xF0, 0x75 | style="background: #E8E8E8" | (keypad) 8 released | align="right" | 0xF0, 0x76 | escape released | style="background: #E8E8E8" align="right" | 0xF0, 0x77 | style="background: #E8E8E8" | NumberLock released |- | align="right" | 0xF0, 0x78 | F11 released | style="background: #E8E8E8" align="right" | 0xF0, 0x79 | style="background: #E8E8E8" | (keypad) + released | align="right" | 0xF0, 0x7A | (keypad) 3 released | style="background: #E8E8E8" align="right" | 0xF0, 0x7B | style="background: #E8E8E8" | (keypad) - released |- | align="right" | 0xF0, 0x7C | (keypad) * released | style="background: #E8E8E8" align="right" | 0xF0, 0x7D | style="background: #E8E8E8" | (keypad) 9 released | align="right" | 0xF0, 0x7E | ScrollLock released | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | | | | style="background: #E8E8E8" align="right" | 0xF0, 0x83 | style="background: #E8E8E8" | F7 released |- | align="right" | 0xE0, 0x12, 0xE0, 0x7C | print screen pressed | style="background: #E8E8E8" | | style="background: #E8E8E8" | | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | align="right" | 0xE0, 0xF0, 0x10 | (multimedia) WWW search released | style="background: #E8E8E8" align="right" | 0xE0, 0xF0, 0x11 | style="background: #E8E8E8" | right alt released | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | align="right" | 0xE0, 0xF0, 0x14 | right control released | style="background: #E8E8E8" align="right" | 0xE0, 0xF0, 0x15 | style="background: #E8E8E8" | (multimedia) previous track released | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | align="right" | 0xE0, 0xF0, 0x18 | (multimedia) WWW favourites released | style="background: #E8E8E8" | | style="background: #E8E8E8" | | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | | | | style="background: #E8E8E8" align="right" | 0xE0, 0xF0, 0x1F | style="background: #E8E8E8" | left GUI released |- | align="right" | 0xE0, 0xF0, 0x20 | (multimedia) WWW refresh released | style="background: #E8E8E8" align="right" | 0xE0, 0xF0, 0x21 | style="background: #E8E8E8" | (multimedia) volume down released | | | style="background: #E8E8E8" align="right" | 0xE0, 0xF0, 0x23 | style="background: #E8E8E8" | (multimedia) mute released |- | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | | | | style="background: #E8E8E8" align="right" | 0xE0, 0xF0, 0x27 | style="background: #E8E8E8" | right GUI released |- | align="right" | 0xE0, 0xF0, 0x28 | (multimedia) WWW stop released | style="background: #E8E8E8" | | style="background: #E8E8E8" | | | | style="background: #E8E8E8" align="right" | 0xE0, 0xF0, 0x2B | style="background: #E8E8E8" | (multimedia) calculator released |- | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | | | | style="background: #E8E8E8" align="right" | 0xE0, 0xF0, 0x2F | style="background: #E8E8E8" | apps released |- | align="right" | 0xE0, 0xF0, 0x30 | (multimedia) WWW forward released | style="background: #E8E8E8" | | style="background: #E8E8E8" | | align="right" | 0xE0, 0xF0, 0x32 | (multimedia) volume up released | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | align="right" | 0xE0, 0xF0, 0x34 | (multimedia) play/pause released | style="background: #E8E8E8" | | style="background: #E8E8E8" | | | | style="background: #E8E8E8" align="right" | 0xE0, 0xF0, 0x37 | style="background: #E8E8E8" | (ACPI) power released |- | align="right" | 0xE0, 0xF0, 0x38 | (multimedia) WWW back released | style="background: #E8E8E8" | | style="background: #E8E8E8" | | align="right" | 0xE0, 0xF0, 0x3A | (multimedia) WWW home released | style="background: #E8E8E8" align="right" | 0xE0, 0xF0, 0x3B | style="background: #E8E8E8" | (multimedia) stop released |- | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | | | | style="background: #E8E8E8" align="right" | 0xE0, 0xF0, 0x3F | style="background: #E8E8E8" | (ACPI) sleep released |- | align="right" | 0xE0, 0xF0, 0x40 | (multimedia) my computer released | style="background: #E8E8E8" | | style="background: #E8E8E8" | | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | align="right" | 0xE0, 0xF0, 0x48 | (multimedia) email released | style="background: #E8E8E8" | | style="background: #E8E8E8" | | align="right" | 0xE0, 0xF0, 0x4A | (keypad) / released | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | | | style="background: #E8E8E8" align="right" | 0xE0, 0xF0, 0x4D | style="background: #E8E8E8" | (multimedia) next track released | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | align="right" | 0xE0, 0xF0, 0x50 | (multimedia) media select released | style="background: #E8E8E8" | | style="background: #E8E8E8" | | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | | align="right" | 0xE0, 0xF0, 0x5A | (keypad) enter released | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | | align="right" | 0xE0, 0xF0, 0x5E | (ACPI) wake released | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | | | style="background: #E8E8E8" align="right" | 0xE0, 0xF0, 0x69 | style="background: #E8E8E8" | end released | | | style="background: #E8E8E8" align="right" | 0xE0, 0xF0, 0x6B | style="background: #E8E8E8" | cursor left released |- | align="right" | 0xE0, 0xF0, 0x6C | home released | style="background: #E8E8E8" | | style="background: #E8E8E8" | | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | align="right" | 0xE0, 0xF0, 0x70 | insert released | style="background: #E8E8E8" align="right" | 0xE0, 0xF0, 0x71 | style="background: #E8E8E8" | delete released | align="right" | 0xE0, 0xF0, 0x72 | cursor down released | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | align="right" | 0xE0, 0xF0, 0x74 | cursor right released | style="background: #E8E8E8" align="right" | 0xE0, 0xF0, 0x75 | style="background: #E8E8E8" | cursor up released | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | | align="right" | 0xE0, 0xF0, 0x7A | page down released | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | | | style="background: #E8E8E8" align="right" | 0xE0, 0xF0, 0x7D | style="background: #E8E8E8" | page up released | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | | align="right" | 0xE0, 0xF0, 0x7C, 0xE0, 0xF0, 0x12 | print screen released | style="background: #E8E8E8" | | style="background: #E8E8E8" | |- | | | style="background: #E8E8E8" | | style="background: #E8E8E8" | | | | style="background: #E8E8E8" align="right" | 0xE1, 0x14, 0x77, 0xE1, 0xF0, 0x14, 0xF0, 0x77 | style="background: #E8E8E8" | pause pressed |} 注意:没有“pause key released”的Scan Code(它的行为就像它一按下就被释放一样) === Scan Code Set 3 === 下表显示了使用Scan Code Set 3 (仅适用于 “US QWERTY” 键盘) 时,哪些Scan Code对应于哪些键: {| {{wikitable}} |- !Key ! Scan Code Set 3 编码 |- |A || 1C |- |B || 32 |- |C || 21 |- |D || 23 |- |E || 24 |- |F || 2B |- |G || 34 |- |H || 33 |- |I || 43 |- |J || 3B |- |K || 42 |- |L || 4B |- |M || 3A |- |N || 31 |- |O || 44 |- |P || 4D |- |Q || 15 |- |R || 2D |- |S || 1B |- |T || 2C |- |U || 3C |- |V || 2A |- |W || 1D |- |X || 22 |- |Y || 35 |- |Z || 1A |- [https://web.archive.org/web/20170108131104/http://www.computer-engineering.org/ps2keyboard/scancodes3.html Scan code] == 另见 == *[[PS/2]] *[["8042" PS/2 Controller]] *[[PL050 PS/2 Controller | PL050 PS/2 Controller (ARM)]] *[[PS/2 Mouse]] === 论坛主题 === *[[Topic:9746|Keyboard input]] *[[Topic:9761|Up or down press?]] *[[Topic:9711|Change typerate]] *[[Topic:9648|Converting the scancodes]] *[[Topic:9448|Discussion about keyboard input in a GUI]] *[[Topic:9590|Scroll-lock LED]] *[[Topic:10153|Keyboard LEDs (asm source)]] *[[Topic:10053|Keyboard LEDs (C source)]] === 外部链接 === *[http://www.win.tue.nl/~aeb/linux/kbd/scancodes.html Keyboard scancodes] - 关于你可能遇到的所有Scan Code的完整引用。 *[https://web.archive.org/web/20030621203107/http://www.microsoft.com/whdc/hwdev/tech/input/Scancode.mspx USB HID to PS/2 Translation Table] - 微软的scancodes和USB等效表 *[https://web.archive.org/web/20190301075756/http://download.microsoft.com/download/1/6/1/161ba512-40e2-4cc9-843a-923143f3456c/scancode.doc Keyboard Scan Code Specification] - 微软的scancodes规范 *[https://www.youtube.com/playlist?list=PLUZozxlhse-NUto5JeJ0EDXEUFloWBdAj PS/2 keyboard interface playlist] - Ben Eater在面包板上构建PS/2键盘接口的视频播放列表。 ==== 实现 ==== * [http://lxr.linux.no/#linux+v3.5.4/drivers/input/keyboard/atkbd.c Linux] (C,GPL) * [https://github.com/Stichting-MINIX-Research-Foundation/minix/blob/master/minix/drivers/hid/pckbd/pckbd.c Minix] [[Category:Human Interface Device]] [[Category:Common Devices]] [[de:Keyboard Controller]]
本页使用的模板:
模板:Wikitable
(
查看源代码
)
返回至“
PS/2 Keyboard
”。
导航菜单
个人工具
登录
命名空间
页面
讨论
变体
已展开
已折叠
查看
阅读
查看源代码
查看历史
更多
已展开
已折叠
搜索
导航
首页
最近更改
随机页面
MediaWiki帮助
工具
链入页面
相关更改
特殊页面
页面信息