diff --git a/README.md b/README.md
index e4d5180..693f683 100644
--- a/README.md
+++ b/README.md
@@ -404,6 +404,26 @@ Vagrant.configure("2") do |config|
end
```
+## Input
+
+You can specify multiple inputs to the VM via `libvirt.input`. Available options are
+listed below. Note that both options are required:
+
+* `type` - The type of the input
+* `bus` - The bust of the input
+
+```ruby
+Vagrant.configure("2") do |config|
+ config.vm.provider :libvirt do |libvirt|
+ # this is the default
+ # libvirt.input :type => "mouse", :bus => "ps2"
+
+ # very useful when having mouse issues when viewing VM via VNC
+ libvirt.input :type => "tablet", :bus => "usb"
+ end
+end
+```
+
## SSH Access To VM
vagrant-libvirt supports vagrant's [standard ssh settings](https://docs.vagrantup.com/v2/vagrantfile/ssh_settings.html).
diff --git a/lib/vagrant-libvirt/action/create_domain.rb b/lib/vagrant-libvirt/action/create_domain.rb
index 92f2041..80fbbba 100644
--- a/lib/vagrant-libvirt/action/create_domain.rb
+++ b/lib/vagrant-libvirt/action/create_domain.rb
@@ -63,6 +63,9 @@ module VagrantPlugins
@disks = config.disks
@cdroms = config.cdroms
+ # Input
+ @inputs = config.inputs
+
config = env[:machine].provider_config
@domain_type = config.driver
@@ -154,7 +157,9 @@ module VagrantPlugins
@cdroms.each do |cdrom|
env[:ui].info(" -- CDROM(#{cdrom[:dev]}): #{cdrom[:path]}")
end
-
+ @inputs.each do |input|
+ env[:ui].info(" -- INPUT(type=#{input[:type]}, bus=#{input[:bus]})")
+ end
env[:ui].info(" -- Command line : #{@cmd_line}")
# Create libvirt domain.
diff --git a/lib/vagrant-libvirt/config.rb b/lib/vagrant-libvirt/config.rb
index 8618711..d5a6f62 100644
--- a/lib/vagrant-libvirt/config.rb
+++ b/lib/vagrant-libvirt/config.rb
@@ -84,6 +84,9 @@ module VagrantPlugins
attr_accessor :disks
attr_accessor :cdroms
+ # Inputs
+ attr_accessor :inputs
+
def initialize
@uri = UNSET_VALUE
@driver = UNSET_VALUE
@@ -127,7 +130,10 @@ module VagrantPlugins
@boot_order = []
# Storage
@disks = []
- @cdroms = []
+ @cdroms = []
+
+ # Inputs
+ @inputs = UNSET_VALUE
end
def boot(device)
@@ -165,6 +171,21 @@ module VagrantPlugins
raise "Only four cdroms may be attached at a time"
end
+ def input(options={})
+ if options[:type] == nil or options[:bus] == nil
+ raise "Input type AND bus must be specified"
+ end
+
+ if @inputs == UNSET_VALUE
+ @inputs = []
+ end
+
+ @inputs.push({
+ :type => options[:type],
+ :bus => options[:bus]
+ })
+ end
+
# NOTE: this will run twice for each time it's needed- keep it idempotent
def storage(storage_type, options={})
if storage_type == :file
@@ -324,6 +345,7 @@ module VagrantPlugins
# Storage
@disks = [] if @disks == UNSET_VALUE
@cdroms = [] if @cdroms == UNSET_VALUE
+ @inputs = [{:type => "mouse", :bus => "ps2"}] if @inputs == UNSET_VALUE
end
def validate(machine)
diff --git a/lib/vagrant-libvirt/templates/domain.xml.erb b/lib/vagrant-libvirt/templates/domain.xml.erb
index 22a57a9..dff3458 100644
--- a/lib/vagrant-libvirt/templates/domain.xml.erb
+++ b/lib/vagrant-libvirt/templates/domain.xml.erb
@@ -78,7 +78,11 @@
-
+
+ <% @inputs.each do |input| %>
+
+ <% end %>
+
<%# Video device -%>
/>