Usb-to-parallel passthrough as a parallel port ~Patch

jbennet

Renowned Member
Jul 19, 2013
19
0
66
France
Hello dear proxmox users, I am willing to pass-through a parallel port (via usb-to-parallel) to guest vm that is too stupid (2003 server) to use a usb-to-parallel, but functions properly when kvm gives it a ready-to-use parallel port.

It works beautifully with kvm/libvirt, but proxmox prevents me from doing such a terrible thing because the device is validated against a regexp.

I guess one modification would be to change file QemuServer.pm

Code:
my $paralleldesc= {
        optional => 1,
        type => 'string',
        pattern => '/dev/parport\d+|/dev/usb/lp\d+',
        description =>  <<EODESCR,
Map host parallel devices (n is 0 to 2).

Physical parallel ports are named /dev/parport<number>, while usb-to-parallel ports are named /dev/usb/lp<number>


but then kvm also complains about a wrong command line ..
Code:
chardev: opening backend "parport" failed

TASK  ERROR: start failed: command '/usr/bin/kvm -id 500 -chardev  'socket,id=qmp,path=/var/run/qemu-server/500.qmp,server,nowait' -mon  'chardev=qmp,mode=control' -vnc  unix:/var/run/qemu-server/500.vnc,x509,password -pidfile  /var/run/qemu-server/500.pid -daemonize -name Serveur -smp  'sockets=1,cores=2' -nodefaults -boot 'menu=on' -vga cirrus -cpu  kvm64,+x2apic,+sep -k fr -m 2048 -cpuunits 1000 -device  'piix3-usb-uhci,id=uhci,bus=pci.0,addr=0x1.0x2' -device  'usb-tablet,id=tablet,bus=uhci.0,port=1' -chardev  'parport,id=parallel0,path=/dev/usb/lp0' -device  'isa-parallel,chardev=parallel0' -device  'virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3' -drive  'file=/mnt/pve/BackupImages/template/iso/virtio-win-0.1-49.iso,if=none,id=drive-ide2,media=cdrom,aio=native'  -device  'ide-cd,bus=ide.1,unit=0,drive=drive-ide2,id=ide2,bootindex=200' -drive  'file=/mnt/pve/BackupImages/images/500/vm-500-disk-1.qcow2,if=none,id=drive-ide0,format=qcow2,aio=native,cache=none'  -device 'ide-hd,bus=ide.0,unit=0,drive=drive-ide0,id=ide0' -netdev  'type=user,id=net0,hostname=Serveur' -device  'e1000,mac=00:C0:9F:2C:D5:CB,netdev=net0,bus=pci.0,addr=0x12,id=net0,bootindex=300'  -rtc 'driftfix=slew,base=localtime'' failed: exit code 1

The line does not seems to be wrong ? can you spot a mistake ?

(I guess I just have to replug everything and compare with virt-manager generated command line)
 
Last edited:
I re-plugged the test platform.. the virt-manager kvm command-line is the folllowing :
Code:
/usr/bin/kvm -S -M pc-1.0 -enable-kvm -m 2048 -smp 2,sockets=2,cores=1,threads=1 -name dumb 
-uuid 0c7cff3b-072b-8e28-a909-c502754a7fcb -nodefconfig -nodefaults -chardev 
socket,id=charmonitor,path=/var/lib/libvirt/qemu/dumb.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control
 -rtc base=localtime -no-shutdown -drive file=/mnt/nfs/images/500/vm-500-disk-1.qcow2,if=none,id=drive-ide0-0-0,format=qcow2
 -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 -drive file=/mnt/nfs/template/iso/virtio-
win-0.1-49.iso,if=none,media=cdrom,id=drive-ide0-0-1,readonly=on,format=raw,cache=none -device ide-drive,bus=ide.0,unit=1,drive=drive-
ide0-0-1,id=ide0-0-1 -drive if=none,media=cdrom,id=drive-ide0-1-0,readonly=on,format=raw -device ide-drive,bus=ide.1,unit=0,drive=drive-
ide0-1-0,id=ide0-1-0 -netdev tap,fd=18,id=hostnet0 -device e1000,netdev=hostnet0,id=net0,mac=52:54:00:eb:d9:3a,bus=pci.0,addr=0x3
 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 [B]-chardev tty,id=charparallel0,path=/dev/usb/lp0 
-device isa-parallel,chardev=charparallel0,id=parallel0[/B] -usb -device usb-tablet,id=input0 -vnc 127.0.0.1:0 -vga std 
-device intel-hda,id=sound0,bus=pci.0,addr=0x4 -device hda-duplex,id=sound0-codec0,bus=sound0.0,cad=0
 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5

So I guess that I could pass the usb-to-parallel device with the ttys.. (edit: won't function, it needs a "device isa-parallel")
 
Last edited: