Skip to content

Commit 8d06778

Browse files
Merge pull request #272 from simonjbeaumont/cp-17631
CP-17631: Don't use a default QEMU keymap
2 parents 1807630 + 0066fbf commit 8d06778

File tree

3 files changed

+24
-22
lines changed

3 files changed

+24
-22
lines changed

xc/device.ml

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1418,7 +1418,7 @@ type disp_intf_opt =
14181418
(* Display output / keyboard input *)
14191419
type disp_opt =
14201420
| NONE
1421-
| VNC of disp_intf_opt * string option * bool * int * string (* IP address, auto-allocate, port if previous false, keymap *)
1421+
| VNC of disp_intf_opt * string option * bool * int * string option (* IP address, auto-allocate, port if previous false, keymap *)
14221422
| SDL of disp_intf_opt * string (* X11 display *)
14231423

14241424
type media = Disk | Cdrom
@@ -1528,40 +1528,42 @@ let cmdline_of_disp info =
15281528
match x with
15291529
| Vgpu [{implementation = Nvidia _}] -> ["-vgpu"]
15301530
| Vgpu [{implementation = GVT_g gvt_g}] ->
1531-
[
1531+
let base_opts = [
15321532
"-xengt";
15331533
"-vgt_low_gm_sz"; Int64.to_string gvt_g.low_gm_sz;
15341534
"-vgt_high_gm_sz"; Int64.to_string gvt_g.high_gm_sz;
15351535
"-vgt_fence_sz"; Int64.to_string gvt_g.fence_sz;
1536-
] @ (
1537-
match gvt_g.monitor_config_file with
1538-
| Some monitor_config_file ->
1539-
["-vgt_monitor_config_file"; monitor_config_file]
1540-
| None -> []
1541-
) @ [
1542-
"-priv"
15431536
]
1537+
and config_file_opt = match gvt_g.monitor_config_file with
1538+
| Some path -> ["-vgt_monitor_config_file"; path]
1539+
| None -> []
1540+
and priv_opt = ["-priv"] in
1541+
List.flatten [base_opts; config_file_opt; priv_opt]
15441542
| Vgpu _ -> failwith "Unsupported vGPU configuration"
15451543
| Std_vga -> ["-std-vga"]
15461544
| Cirrus -> []
15471545
| GVT_d -> ["-std-vga"; "-gfx_passthru"]
15481546
in
15491547
let videoram_opt = ["-videoram"; string_of_int info.video_mib] in
1548+
let vnc_opts_of ip_addr_opt auto port keymap =
1549+
let unused_opt = if auto then ["-vncunused"] else [] in
1550+
let vnc_opt =
1551+
let ip_addr = Opt.default "127.0.0.1" ip_addr_opt
1552+
and port = if auto then "1" else string_of_int port in
1553+
["-vnc"; ip_addr ^ ":" ^ port] in
1554+
let keymap_opt = match keymap with Some k -> ["-k"; k] | None -> [] in
1555+
List.flatten [unused_opt; vnc_opt; keymap_opt]
1556+
in
15501557
let disp_options, wait_for_port =
15511558
match info.disp with
15521559
| NONE ->
1553-
([], false)
1554-
| SDL (opts,x11name) ->
1555-
( [], false)
1560+
([], false)
1561+
| SDL (opts, x11name) ->
1562+
([], false)
15561563
| VNC (disp_intf, ip_addr_opt, auto, port, keymap) ->
1557-
let ip_addr = Opt.default "127.0.0.1" ip_addr_opt in
1558-
let vga_type_opts = vga_type_opts disp_intf in
1559-
let vnc_opts =
1560-
if auto
1561-
then [ "-vncunused"; "-k"; keymap; "-vnc"; ip_addr ^ ":1" ]
1562-
else [ "-vnc"; ip_addr ^ ":" ^ (string_of_int port); "-k"; keymap ]
1563-
in
1564-
(vga_type_opts @ videoram_opt @ vnc_opts), true
1564+
let vga_type_opts = vga_type_opts disp_intf in
1565+
let vnc_opts = vnc_opts_of ip_addr_opt auto port keymap in
1566+
(vga_type_opts @ videoram_opt @ vnc_opts), true
15651567
in
15661568
disp_options, wait_for_port
15671569

xc/device.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ sig
178178

179179
type disp_opt =
180180
| NONE
181-
| VNC of disp_intf_opt * string option * bool * int * string (* IP address, auto-allocate, port if previous false, keymap *)
181+
| VNC of disp_intf_opt * string option * bool * int * string option (* IP address, auto-allocate, port if previous false, keymap *)
182182
| SDL of disp_intf_opt * string (* X11 display *)
183183

184184
type media = Disk | Cdrom

xc/xenops_server_xen.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1102,7 +1102,7 @@ module VM = struct
11021102
?(nics=[]) ?(disks=[]) ?(vgpus=[])
11031103
?(pci_emulations=[]) ?(usb=Device.Dm.Disabled)
11041104
?(parallel=None)
1105-
?(acpi=true) ?(video=Cirrus) ?(keymap="en-us")
1105+
?(acpi=true) ?(video=Cirrus) ?keymap
11061106
?vnc_ip ?(pci_passthrough=false) ?(hvm=true) ?(video_mib=4) () =
11071107
let video = match video, vgpus with
11081108
| Cirrus, [] -> Device.Dm.Cirrus

0 commit comments

Comments
 (0)