[libvirt] [PATCH] Fix for parallel port passtrough for QEMU

Beat.Joerg at ssatr.ch Beat.Joerg at ssatr.ch
Wed May 23 05:50:02 UTC 2012


Hi

As requested by Dave, I send this to the list.

I came across a bug that the command line generated for passtrough of the host parallel port /dev/parport0 by libvirt for QEMU is incorrect.

It currently produces:
-chardev tty,id=charparallel0,path=/dev/parport0
-device isa-parallel,chardev=charparallel0,id=parallel0


The first parameter is "tty". It sould be "parport".



If I launch qemu with -chardev parport,... it works as expected.



I have already filled a bug report ( https://bugzilla.redhat.com/show_bug.cgi?id=823879 ), the topic was already on the list some months ago:

https://www.redhat.com/archives/libvirt-users/2011-September/msg00095.html



Not sure if this is fix is very clean, but for my case it works.

Perhaps it should also be checked if similar problems / patches are required for other chardev backends.



Kind regards

Beat



diff -Naur libvirt-0.9.4.orig/src/qemu/qemu_command.c libvirt-0.9.4/src/qemu/qemu_command.c

--- libvirt-0.9.4.orig/src/qemu/qemu_command.c       2012-05-22 13:40:16.788633656 +0200

+++ libvirt-0.9.4/src/qemu/qemu_command.c     2012-05-22 13:52:18.453608557 +0200

@@ -2357,8 +2357,14 @@

         break;



     case VIR_DOMAIN_CHR_TYPE_DEV:

-        virBufferAsprintf(&buf, "tty,id=char%s,path=%s", alias,

-                          dev->data.file.path);

+        if (STRPREFIX(dev->data.file.path, "/dev/parport")) {

+            virBufferAsprintf(&buf, "parport,id=char%s,path=%s", alias,

+                              dev->data.file.path);

+        }

+        else {

+            virBufferAsprintf(&buf, "tty,id=char%s,path=%s", alias,

+                              dev->data.file.path);

+        }

         break;



     case VIR_DOMAIN_CHR_TYPE_FILE:

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120523/90af5ead/attachment-0001.htm>


More information about the libvir-list mailing list