From 0079a89c3ee794098503f02e8f61fdb37083d805 Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Thu, 30 Mar 2017 16:11:41 +0200 Subject: [run-virt/vmware] reintroduce lost feature detection and passthrough of serial and parallel port --- .../data/opt/openslx/scripts/systemd-run_virt_env | 5 +++++ .../set_runvirt_hardware_variables.inc | 23 ++++++++++++++++++++++ 2 files changed, 28 insertions(+) (limited to 'core/modules/run-virt/data/opt') diff --git a/core/modules/run-virt/data/opt/openslx/scripts/systemd-run_virt_env b/core/modules/run-virt/data/opt/openslx/scripts/systemd-run_virt_env index 6a30acf4..ddffa4e9 100755 --- a/core/modules/run-virt/data/opt/openslx/scripts/systemd-run_virt_env +++ b/core/modules/run-virt/data/opt/openslx/scripts/systemd-run_virt_env @@ -143,6 +143,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_VIRT_CONF}" +# Parallel ports +modprobe parport_pc + ################################################################################ ### Setup VM networking ################################################################################ diff --git a/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/set_runvirt_hardware_variables.inc b/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/set_runvirt_hardware_variables.inc index e4a1353f..a2eb18f0 100644 --- a/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/set_runvirt_hardware_variables.inc +++ b/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/set_runvirt_hardware_variables.inc @@ -105,11 +105,34 @@ check_optical_drives() { readonly FLOPPY0 CDROM0 CDROM1 } +# 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 +set_serial_ports() { + declare -g SERIAL0= + #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 + SERIAL0="$PORT" + break + done + + declare -g PARALLEL0= + for PORT in /dev/parport*; do + [ -c "$PORT" ] || continue + PARALLEL0="$PORT" + break + done + + readonly SERIAL0 PARALLEL0 +} + ## MAIN ## call_post_source \ set_virt_cpu \ set_virt_memory \ set_virt_mac \ set_virt_hostname \ + set_serial_ports \ check_optical_drives -- cgit v1.2.3-55-g7522