Skip to content

Commit

Permalink
keyboard/qemu: translate symbols into key codes understood by QEMU's …
Browse files Browse the repository at this point in the history
…sendkey

Signed-off-by: Cedric Hombourger <cedric.hombourger@siemens.com>
  • Loading branch information
chombourger committed Dec 12, 2023
1 parent 8096451 commit 663a30a
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion mtda/keyboard/qemu.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,23 @@ def idle(self):
def press(self, key, repeat=1):
self.mtda.debug(3, "keyboard.qemu.press()")

symbols = {
',': 'comma',
'.': 'dot',
'*': 'asterisk',
'/': 'slash',
'-': 'minus',
'=': 'equal',
' ': 'spc',
'\t': 'tab',
'\n': 'ret'
}

result = True
while repeat > 0:
repeat = repeat - 1
self.qemu.cmd("sendkey %s" % key)
key = symbols[key] if key in symbols else key
self.qemu.cmd("sendkey {}".format(key))
time.sleep(0.1)
return result

Expand Down

0 comments on commit 663a30a

Please # to comment.