diff --git a/emhttp/plugins/dynamix.vm.manager/include/libvirt_helpers.php b/emhttp/plugins/dynamix.vm.manager/include/libvirt_helpers.php index 8d78bcd93..75935cdfa 100644 --- a/emhttp/plugins/dynamix.vm.manager/include/libvirt_helpers.php +++ b/emhttp/plugins/dynamix.vm.manager/include/libvirt_helpers.php @@ -941,7 +941,17 @@ private static $encoding = 'UTF-8'; $xml = $lv->domain_get_xml($res) ; $xmldoc = new SimpleXMLElement($xml); $xmlpath = $xmldoc->xpath('//devices/input[@type="evdev"] '); - return $xmlpath; + $evdevs = []; + foreach ($xmlpath as $i => $evDev) { + $evdevs[$i] = [ + 'dev' => $evDev->source->attributes()->dev, + 'grab' => $evDev->source->attributes()->grab, + 'repeat' => $evDev->source->attributes()->repeat, + 'grabToggle' => $evDev->source->attributes()->grabToggle + ]; + } + if (empty($evdevs)) $evdevs[0] = ['dev'=>"",'grab'=>"",'repeat'=>"",'grabToggle'=>""]; + return $evdevs; } $cacheValidUSBDevices = null; diff --git a/emhttp/plugins/dynamix.vm.manager/templates/Custom.form.php b/emhttp/plugins/dynamix.vm.manager/templates/Custom.form.php index 12abb670b..c8086651b 100644 --- a/emhttp/plugins/dynamix.vm.manager/templates/Custom.form.php +++ b/emhttp/plugins/dynamix.vm.manager/templates/Custom.form.php @@ -1627,15 +1627,7 @@

- - "; - $evdevdoc = new SimpleXMLElement($evdevxml); - $arrConfig['evdev']= $evdevdoc->xpath('//input[@type="evdev"] '); - } - + if (!isset($arrConfig['evdev'])) $arrConfig['evdev'][0] = ['dev'=>"",'grab'=>"",'repeat'=>"",'grabToggle'=>""]; foreach ($arrConfig['evdev'] as $i => $arrEvdev) { $strLabel = ($i > 0) ? appendOrdinalSuffix($i + 1) : ''; ?> @@ -1645,8 +1637,8 @@ @@ -1655,8 +1647,8 @@ _(Grab)_: @@ -1665,8 +1657,8 @@ _(Repeat)_: @@ -1675,8 +1667,8 @@ _(Grab Toggle)_: