Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\debug\kdb\kdb_keyboard.c Create Date:2022-07-28 11:44:41
Last Modify:2020-03-17 19:12:05 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:Check if the keyboard controller has a keypress for us.* Some parts (Enter Release, LED change) are still blocking polled here,* but hopefully they are all short.

Proto:int kdb_get_kbd_char(void)

Type:int

Parameter:Nothing

43  If KDB_FLAG(NO_I8042) || KDB_FLAG(NO_VT_CONSOLE) || inb(Status register (R) ) == 0xff && inb(Keyboard data register (R/W) ) == 0xff Then
45  kbd_exists = 0
46  Return -1
48  kbd_exists = 1
50  If (inb(Status register (R) ) & Keyboard output buffer full ) == 0 Then Return -1
56  scancode = inb(Keyboard data register (R/W) )
57  scanstatus = inb(Status register (R) )
62  If scanstatus & Mouse output buffer full Then Return -1
72  If (scancode & 0x7f) == 0x2a || (scancode & 0x7f) == 0x36 Then
76  If (scancode & 0x80) == 0 Then shift_key = 1
78  Else shift_key = 0
80  Return -1
83  If (scancode & 0x7f) == 0x1d Then
87  If (scancode & 0x80) == 0 Then ctrl_key = 1
89  Else ctrl_key = 0
91  Return -1
94  If (scancode & 0x80) != 0 Then
95  If scancode == 0x9c Then kbd_last_ret = 0
97  Return -1
100  scancode &= 0x7f
106  If scancode == 0x3a Then
110  shift_lock ^= 1
115  Return -1
118  If scancode == 0x0e Then
122  Return 8
127  Case scancode == 0xF
128  Return 9
129  Case scancode == 0x53
130  Return 4
131  Case scancode == 0x47
132  Return 1
133  Case scancode == 0x4F
134  Return 5
135  Case scancode == 0x4B
136  Return 2
137  Case scancode == 0x48
138  Return 16
139  Case scancode == 0x50
140  Return 14
141  Case scancode == 0x4D
142  Return 6
145  If scancode == 0xe0 Then Return -1
153  If scancode == 0x73 Then scancode = 0x59
155  Else if scancode == 0x7d Then scancode = 0x7c
158  If Not shift_lock && Not shift_key && Not ctrl_key Then
160  Else if (shift_lock || shift_key) && key_maps[1] Then
161  keychar = key_maps[1][scancode]
162  Else if ctrl_key && key_maps[4] Then
163  keychar = key_maps[4][scancode]
164  Else
165  keychar = 0x0020
166  kdb_printf("Unknown state/scancode (%d)\n", scancode)
168  keychar &= 0x0fff
169  If keychar == '\t' Then keychar = ' '
172  Case KTYP(keychar) == symbol that can be acted upon by CapsLock
174  If isprint(keychar) Then Break
177  Case KTYP(keychar) == KT_SPEC
178  If keychar == K_ENTER Then Break
181  Default
182  Return -1
185  If scancode == 0x1c Then
186  kbd_last_ret = 1
187  Return 13
190  Return keychar & 0xff