From 30cf11632c4a5e876a4ef5a13dce84ab52c7740e Mon Sep 17 00:00:00 2001 From: Sebastien Boeuf Date: Fri, 21 Oct 2016 08:53:23 -0700 Subject: [PATCH] Add missing bus parameter for a CharDevice When creating a CharDevice, we need to add a "bus" parameter so that it can match the serial pci device previously created. Signed-off-by: Sebastien Boeuf --- qemu.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/qemu.go b/qemu.go index f5dd579374..ea344b2eba 100644 --- a/qemu.go +++ b/qemu.go @@ -263,6 +263,9 @@ type CharDevice struct { // Driver is the qemu device driver Driver DeviceDriver + // Bus is the serial bus associated to this device. + Bus string + // DeviceID is the user defined device ID. DeviceID string @@ -287,6 +290,9 @@ func (cdev CharDevice) QemuParams(config *Config) []string { var qemuParams []string deviceParams = append(deviceParams, fmt.Sprintf("%s", cdev.Driver)) + if cdev.Bus != "" { + deviceParams = append(deviceParams, fmt.Sprintf(",bus=%s", cdev.Bus)) + } deviceParams = append(deviceParams, fmt.Sprintf(",chardev=%s", cdev.ID)) deviceParams = append(deviceParams, fmt.Sprintf(",id=%s", cdev.DeviceID)) if cdev.Name != "" {