diff options
author | Simon Rettberg | 2016-11-22 16:08:46 +0100 |
---|---|---|
committer | Simon Rettberg | 2016-11-22 16:08:46 +0100 |
commit | 7900114257bed2039af3511b4101b11a47f2db70 (patch) | |
tree | 4839f1b2dff2c95cfbaf75401e74d8559bb74f82 | |
parent | [hardware-stats] Prefer busybox fdisk as it has GPT support (diff) | |
download | tm-scripts-7900114257bed2039af3511b4101b11a47f2db70.tar.gz tm-scripts-7900114257bed2039af3511b4101b11a47f2db70.tar.xz tm-scripts-7900114257bed2039af3511b4101b11a47f2db70.zip |
[run-virt/vmware] Add support for serial and parallel port
3 files changed, 46 insertions, 1 deletions
diff --git a/remote/modules/run-virt/data/opt/openslx/scripts/systemd-run_virt_env b/remote/modules/run-virt/data/opt/openslx/scripts/systemd-run_virt_env index cf94b3a2..a86b2d0b 100755 --- a/remote/modules/run-virt/data/opt/openslx/scripts/systemd-run_virt_env +++ b/remote/modules/run-virt/data/opt/openslx/scripts/systemd-run_virt_env @@ -122,6 +122,11 @@ for floppy in $(dmesg|grep -i "Floppy drive"|sed "s,.*(s): ,,;s, is .*,,"); do j=$(expr $j + 1) done +# Serial ports +echo "serial_ports='$(dmesg | grep -Eo 'ttyS[0-9]+' | sed 's,^,/dev/,' | tr '\n' ' ')'" >> "${VMCHOOSER_CONF_DIR}/virtualization.conf" +# Parallel ports +modprobe parport_pc + ################################################################################ ### Setup VM networking ################################################################################ diff --git a/remote/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/set_runvirt_hardware_variables.inc b/remote/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/set_runvirt_hardware_variables.inc index 7ef03c1c..508c9efe 100644 --- a/remote/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/set_runvirt_hardware_variables.inc +++ b/remote/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/set_runvirt_hardware_variables.inc @@ -77,6 +77,24 @@ cdtest=${cdrom_1:+"TRUE"} # if $cdtest not set cdrom1="FALSE", else "TRUE" cdrom1=${cdtest:-"FALSE"} +# Dynamically detect serial ports here instead of at boot time +# (virtualization.conf), since USB serial ports get quite common +# and might not be plugged in at boot time yet +serial_0= +#for port in $(awk '{ if ($1 ~ /^[0-9]+:/ && $2 != "uart:unknown") print "/dev/ttyS" sub(/:\$/, "", $1) }' /proc/tty/driver/serial); do +for port in $serial_ports /dev/ttyUSB*; do + [ -c "$port" ] || continue + serial_0="$port" + break +done + +parallel_0= +for port in /dev/parport*; do + [ -c "$port" ] || continue + parallel_0="$port" + break +done + # RDP/VNC port (59001 - 59099) remotedesktopport="590${VM_ID}" diff --git a/remote/modules/vmware/data/opt/openslx/vmchooser/vmware/includes/write_final_vmx.inc b/remote/modules/vmware/data/opt/openslx/vmchooser/vmware/includes/write_final_vmx.inc index e664f02f..f1395369 100644 --- a/remote/modules/vmware/data/opt/openslx/vmchooser/vmware/includes/write_final_vmx.inc +++ b/remote/modules/vmware/data/opt/openslx/vmchooser/vmware/includes/write_final_vmx.inc @@ -107,7 +107,29 @@ isolation.tools.copy.enable = "TRUE" isolation.tools.paste.enabled = "TRUE" HEREEND -# Serial, parallel: Empty, nothing is being currently set. TODO later. +# Serial port +if [ -n "$serial_0" ]; then + cat >> "${TMPCONFIG}" <<-HEREEND + serial0.present = "TRUE" + serial0.startConnected = "TRUE" + serial0.fileType = "device" + serial0.fileName = "$serial_0" + serial0.tryNoRxLoss = "FALSE" + serial0.autodetect = "FALSE" + HEREEND +fi + +# Parallel port +if [ -n "$parallel_0" ]; then + cat >> "${TMPCONFIG}" <<-HEREEND + parallel0.present = "TRUE" + parallel0.startConnected = "TRUE" + parallel0.fileType = "device" + parallel0.fileName = "$parallel_0" + parallel0.bidirectional = "TRUE" + parallel0.autodetect = "FALSE" + HEREEND +fi # Graphics, GPU: 3D will be enabled (even if vmware doesn't support the chip) if we whitelisted it. if [ -n "$SLX_VMWARE_3D" ]; then |