mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-05 16:33:50 +00:00
virkeycode: Allow ANSI_A
https://bugzilla.redhat.com/show_bug.cgi?id=1044806 Currently, sending the ANSI_A keycode from os_x codepage doesn't work as it has a special value of 0x0. Our internal code handles that no different to other not defined keycodes. Hence, in order to allow it we must change all the undefined keycodes from 0 to -1 and adapt some code too. # virsh send-key guestname --codeset os_x ANSI_A error: invalid keycode: 'ANSI_A' # virsh send-key guestname --codeset os_x ANSI_B # virsh send-key guestname --codeset os_x ANSI_C Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
aa4619337c
commit
72ffbd1bf3
@ -86,12 +86,12 @@ for i in range(len(cols)):
|
|||||||
if isname:
|
if isname:
|
||||||
print "const char *virKeymapNames_" + name + "[] = {"
|
print "const char *virKeymapNames_" + name + "[] = {"
|
||||||
else:
|
else:
|
||||||
print "unsigned short virKeymapValues_" + name + "[] = {"
|
print "int virKeymapValues_" + name + "[] = {"
|
||||||
|
|
||||||
for entry in keycodes:
|
for entry in keycodes:
|
||||||
if isname:
|
if isname:
|
||||||
print " " + quotestring(entry[i] or "NULL") + ","
|
print " " + quotestring(entry[i] or "NULL") + ","
|
||||||
else:
|
else:
|
||||||
print " " + (entry[i] or "0") + ","
|
print " " + (entry[i] or "-1") + ","
|
||||||
|
|
||||||
print "};\n"
|
print "};\n"
|
||||||
|
@ -50,7 +50,7 @@ static const char **virKeymapNames[] = {
|
|||||||
};
|
};
|
||||||
verify(ARRAY_CARDINALITY(virKeymapNames) == VIR_KEYCODE_SET_LAST);
|
verify(ARRAY_CARDINALITY(virKeymapNames) == VIR_KEYCODE_SET_LAST);
|
||||||
|
|
||||||
static unsigned short *virKeymapValues[] = {
|
static int *virKeymapValues[] = {
|
||||||
[VIR_KEYCODE_SET_LINUX] =
|
[VIR_KEYCODE_SET_LINUX] =
|
||||||
virKeymapValues_linux,
|
virKeymapValues_linux,
|
||||||
[VIR_KEYCODE_SET_XT] =
|
[VIR_KEYCODE_SET_XT] =
|
||||||
@ -113,7 +113,7 @@ int virKeycodeValueTranslate(virKeycodeSet from_codeset,
|
|||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
if (key_value <= 0)
|
if (key_value < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
|
||||||
|
@ -7049,7 +7049,7 @@ vshKeyCodeGetInt(const char *key_name)
|
|||||||
{
|
{
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
|
|
||||||
if (virStrToLong_ui(key_name, NULL, 0, &val) < 0 || val > 0xffff || !val)
|
if (virStrToLong_ui(key_name, NULL, 0, &val) < 0 || val > 0xffff)
|
||||||
return -1;
|
return -1;
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
@ -7090,8 +7090,8 @@ cmdSendKey(vshControl *ctl, const vshCmd *cmd)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((keycode = vshKeyCodeGetInt(opt->data)) <= 0) {
|
if ((keycode = vshKeyCodeGetInt(opt->data)) < 0) {
|
||||||
if ((keycode = virKeycodeValueFromString(codeset, opt->data)) <= 0) {
|
if ((keycode = virKeycodeValueFromString(codeset, opt->data)) < 0) {
|
||||||
vshError(ctl, _("invalid keycode: '%s'"), opt->data);
|
vshError(ctl, _("invalid keycode: '%s'"), opt->data);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user