SpaceInvaderOne Posted August 19, 2020 Share Posted August 19, 2020 So evdev passthrough is used for passing through a keyboard and mouse to a vm. Yep we can easily do this by just passing through the usb device. However this works slightly differently. As well as having extremely low latency, it allows us to passthough any keyboard or mouse. That includes UBS and the old PS2 devices. Hit both control keys and the input will switch between the host and vm on the fly. If you like running old operating systems as vms the evdev is for you. Some old systems dont support usb. So using evdev you can still pass it through to those old systems. Hope you find this useful 1 1 Quote Link to comment
craigr Posted September 3, 2020 Share Posted September 3, 2020 (edited) I just used this tutorial SpaceInvader, thanks for another great one! I had just started looking at evdev as a means to use the mouse and keyboard to wake my Windows 10 VM up from sleep. I know a lot of people don't like to sleep their VM's, but I do to save electricity. And, the good news is that it works 🙂 You do have a couple errors in the tutorial syntax for the qemu.conf though. In the qemu.conf, you are missing a comma at the end of the line after "/dev/hpet", and you should not have a comma after the final device. This is what you have in your video and in your text instruction file: 3/. Next we need to add our input devices to the qemu conf file nano /etc/libvirt/qemu.conf use (ctrl _ ) to goto line 451 find this part #cgroup_device_acl = [ # "/dev/null", "/dev/full", "/dev/zero", # "/dev/random", "/dev/urandom", # "/dev/ptmx", "/dev/kvm", "/dev/kqemu", # "/dev/rtc","/dev/hpet" # ] Remove hashtags then add the parts in that you want to use cgroup_device_acl = [ "/dev/null", "/dev/full", "/dev/zero", "/dev/random", "/dev/urandom", "/dev/ptmx", "/dev/kvm", "/dev/kqemu", "/dev/rtc","/dev/hpet" "/dev/input/by-id/usb-Logitech_USB_Receiver-event-kbd", "/dev/input/by-id/usb-Logitech_USB_Receiver-if01-event-mouse", ] Instead, you should have: cgroup_device_acl = [ "/dev/null", "/dev/full", "/dev/zero", "/dev/random", "/dev/urandom", "/dev/ptmx", "/dev/kvm", "/dev/kqemu", "/dev/rtc","/dev/hpet", "/dev/input/by-id/usb-Logitech_USB_Receiver-event-kbd", "/dev/input/by-id/usb-Logitech_USB_Receiver-if01-event-mouse" ] So a comma after dev/hpet", and no comma after /usb-Logitech_USB_Receiver-if01-event-mouse". If you type it in according to your example, after the reboot you'll get a "Libvirt Service failed to start" and obviously no VM support... that's what happened to me until I corrected it. Anyway, your videos save me sooooo much time, so thanks again. I literally started looking at evdev yesterday evening and was like, "is it really worth learning all this just to get my VM to wake up." Then I quickly just happened to look at your channel, and your tutorial for exactly what I wanted to do was right on top. You're the best man! Kind regards, craigr Edited September 3, 2020 by craigr Quote Link to comment
craigr Posted September 3, 2020 Share Posted September 3, 2020 (edited) Question for you though. I did the "optional" virtio driver install for Windows 10 and then did install the virtio drivers and things were very snappy after that. However, I mucked about with my xml again after the fact, and am afraid that I may not have the virtio drivers installed properly now. Is there a way that I can verify that I have the virtio drivers installed in Windows 10 for my mouse and keyboard? I attached a grab of my device manager. For the keyboard and mouse the drivers both say Microsoft. Under "Human Interface Devices," are the VirtIO Input Drivers the actual virtio drivers for my moue and keyboard, or did I screw something up when I was later mucking about? The mouse and keyboard don't seem as snappy anymore compared to right after I installed their virtio drivers, but it could easily be my imagination. I have attached a copy of my current XML file as well. Kind regards, craigr current.xml Edited September 3, 2020 by craigr Quote Link to comment
byb Posted September 25, 2022 Share Posted September 25, 2022 Hello. I apologize if this is the wrong place to ask for support. I have been unable to get evdev working. I've made multiple attempts across several months. I've recently upgraded to version 6.10.3, but the result is the same. Here is a concise report. I am trying to set up evdev to be used with a VNC-based VM. I am configuring Unraid from a VM which has multiple passed-through USB PCIe host controllers to different VMs, each with a passed through nvme drive and GPU. I have my "primary" USB Ducky keyboard and mouse connected to a four port ATEN switch. Unraid doesn't see these devices. I want to use evdev to eliminate this complexity and free up PCIe lanes which I need for other devices. However, I've read that cycling through multiple VMs may not work. I connected a Lenovo-branded USB keyboard to a USB port which is shared with the host Unraid OS. This device has a single function. This is a re-branded LITE-ON device. root@Tower:/# ls /dev/input/by-id usb-LITE-ON_Technology_USB_NetVista_Full_Width_Keyboard.-event-kbd@ I confirmed that this is the correct device I want to pass through with evdev by running cat and pressing a key on the keyboard before pressing control+c with my "primary" keyboard. root@Tower:/# cat /dev/input/by-id/usb-LITE-ON_Technology_USB_NetVista_Full_Width_Keyboard.-event-kbd }/cr(}/cr}/cr}/cq (}/cq }/cq I edited the qemu.conf configuration with this command root@Tower:/# nano /etc/libvirt/qemu.conf I found the relevant lines and modified them accordingly: cgroup_device_acl = [ "/dev/null", "/dev/full", "/dev/zero", "/dev/random", "/dev/urandom", "/dev/ptmx", "/dev/kvm", "/dev/kqemu", "/dev/rtc","/dev/hpet", "/dev/input/by-id/usb-LITE-ON_Technology_USB_NetVista_Full_Width_Keyboard.-event-kbd" ] I modified the VM XML configuration: <qemu:commandline> <qemu:arg value='-object'/> <qemu:arg value='input-linux,id=kbd,evdev=/dev/input/by-id/usb-LITE-ON_Technology_USB_NetVista_Full_Width_Keyboard.-event-kbd,grab_all=on,repeat=on'/> <qemu:arg value='-object'/> </qemu:commandline> </domain> To make these changes take effect, I reboot the PC. I get this error when I start the VM. internal error: process exited while connecting to monitor: qemu-system-x86_64: -object -sandbox: Parameter 'qom-type' does not accept value '-sandbox' Searches for this error, or parts of this error on Google, the Unraid forums, github, and stackoverflow return no results. I am writing this post, mid-way through my troubleshooting process. After rebooting again, I get these errors I get this error when trying to launch the VNC VM: "error: Failed to attach device from /tmp/hotattach.tmp error: XML error: Invalid value for attribute 'id' in element 'product': '0x0000#remove'. Expected non-negative integer value" My existing VMs with passed-through USB devices lose connection to my primary USB devices! The /etc/libvirt folder is empty. Ultimately, my Unraid PC in this state is unsuable. I need to use another machine to revert the changes I made to my VM configuration and reboot again. This may take multiple attempts, and due to my PC's complex configuration (Slow BIOS boot, HBA BIOS boot), it takes about 5-7 minutes before I can attempt power on. I am about to try editing the permission level which libvirt run at according to this post: https://passthroughpo.st/using-evdev-passthrough-seamless-vm-input/ I made this change: user = "root" # The group for QEMU processes run by the system instance. It can be # specified in a similar way to user. group = "root" #group = "user" I am about to reboot and see if editing these permissions allow the VM to work successfully. Quote Link to comment
byb Posted September 25, 2022 Share Posted September 25, 2022 Bad news, I'm still getting this error: internal error: process exited while connecting to monitor: qemu-system-x86_64: -object -sandbox: Parameter 'qom-type' does not accept value '-sandbox' I also tried adding, but it had no effect. clear_emulator_capabilities = 0 At least the good news is that the subsequent errors 1 and 2 no longer occur - my passed through USB passthrough on my other VMs is working. Here is the qemu output from the diagnostic: 2022-09-25 04:20:07.370+0000: starting up libvirt version: 8.2.0, qemu version: 6.2.0, kernel: 5.15.46-Unraid, hostname: Tower LC_ALL=C \ PATH=/bin:/sbin:/usr/bin:/usr/sbin \ HOME='/var/lib/libvirt/qemu/domain-6-evdev VNC' \ XDG_DATA_HOME='/var/lib/libvirt/qemu/domain-6-evdev VNC/.local/share' \ XDG_CACHE_HOME='/var/lib/libvirt/qemu/domain-6-evdev VNC/.cache' \ XDG_CONFIG_HOME='/var/lib/libvirt/qemu/domain-6-evdev VNC/.config' \ /usr/local/sbin/qemu \ -name 'guest=evdev VNC,debug-threads=on' \ -S \ -object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain-6-evdev VNC/master-key.aes"}' \ -blockdev '{"driver":"file","filename":"/usr/share/qemu/ovmf-x64/OVMF_CODE-pure-efi.fd","node-name":"libvirt-pflash0-storage","auto-read-only":true,"discard":"unmap"}' \ -blockdev '{"node-name":"libvirt-pflash0-format","read-only":true,"driver":"raw","file":"libvirt-pflash0-storage"}' \ -blockdev '{"driver":"file","filename":"/etc/libvirt/qemu/nvram/7bafda78-eb87-7a41-da13-e4c92791ccd1_VARS-pure-efi.fd","node-name":"libvirt-pflash1-storage","auto-read-only":true,"discard":"unmap"}' \ -blockdev '{"node-name":"libvirt-pflash1-format","read-only":false,"driver":"raw","file":"libvirt-pflash1-storage"}' \ -machine pc-q35-6.2,usb=off,dump-guest-core=off,mem-merge=off,pflash0=libvirt-pflash0-format,pflash1=libvirt-pflash1-format,memory-backend=pc.ram \ -accel kvm \ -cpu host,migratable=on,host-cache-info=on,l3-cache=off \ -m 16384 \ -object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":17179869184}' \ -overcommit mem-lock=off \ -smp 14,sockets=1,dies=1,cores=7,threads=2 \ -uuid 7bafda78-eb87-7a41-da13-e4c92791ccd1 \ -no-user-config \ -nodefaults \ -chardev socket,id=charmonitor,fd=40,server=on,wait=off \ -mon chardev=charmonitor,id=monitor,mode=control \ -rtc base=utc,driftfix=slew \ -global kvm-pit.lost_tick_policy=delay \ -no-hpet \ -no-shutdown \ -boot strict=on \ -device pcie-root-port,port=16,chassis=1,id=pci.1,bus=pcie.0,multifunction=on,addr=0x2 \ -device pcie-root-port,port=17,chassis=2,id=pci.2,bus=pcie.0,addr=0x2.0x1 \ -device pcie-root-port,port=18,chassis=3,id=pci.3,bus=pcie.0,addr=0x2.0x2 \ -device pcie-root-port,port=19,chassis=4,id=pci.4,bus=pcie.0,addr=0x2.0x3 \ -device pcie-root-port,port=20,chassis=5,id=pci.5,bus=pcie.0,addr=0x2.0x4 \ -device ich9-usb-ehci1,id=usb,bus=pcie.0,addr=0x7.0x7 \ -device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pcie.0,multifunction=on,addr=0x7 \ -device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pcie.0,addr=0x7.0x1 \ -device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pcie.0,addr=0x7.0x2 \ -device virtio-serial-pci,id=virtio-serial0,bus=pci.2,addr=0x0 \ -blockdev '{"driver":"file","filename":"/mnt/user/domains/evdev VNC/vdisk1.img","node-name":"libvirt-1-storage","cache":{"direct":false,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"cache":{"direct":false,"no-flush":false},"driver":"raw","file":"libvirt-1-storage"}' \ -device virtio-blk-pci,bus=pci.3,addr=0x0,drive=libvirt-1-format,id=virtio-disk2,bootindex=1,write-cache=on \ -netdev tap,fd=41,id=hostnet0 \ -device virtio-net,netdev=hostnet0,id=net0,mac=52:54:00:1d:f9:b4,bus=pci.1,addr=0x0 \ -chardev pty,id=charserial0 \ -device isa-serial,chardev=charserial0,id=serial0,index=0 \ -chardev socket,id=charchannel0,fd=39,server=on,wait=off \ -device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=org.qemu.guest_agent.0 \ -device usb-tablet,id=input0,bus=usb.0,port=1 \ -audiodev '{"id":"audio1","driver":"none"}' \ -vnc 0.0.0.0:0,websocket=5700,audiodev=audio1 \ -k en-us \ -device qxl-vga,id=video0,max_outputs=1,ram_size=67108864,vram_size=67108864,vram64_size_mb=0,vgamem_mb=16,bus=pcie.0,addr=0x1 \ -device virtio-balloon-pci,id=balloon0,bus=pci.4,addr=0x0 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ -msg timestamp=on char device redirected to /dev/pts/2 (label charserial0) qxl_send_events: spice-server bug: guest stopped, ignoring 2022-09-25T04:20:58.305462Z qemu-system-x86_64: terminating on signal 15 from pid 8155 (/usr/sbin/libvirtd) 2022-09-25 04:20:58.505+0000: shutting down, reason=destroyed 2022-09-25 04:21:18.552+0000: starting up libvirt version: 8.2.0, qemu version: 6.2.0, kernel: 5.15.46-Unraid, hostname: Tower LC_ALL=C \ PATH=/bin:/sbin:/usr/bin:/usr/sbin \ HOME='/var/lib/libvirt/qemu/domain-7-evdev VNC' \ XDG_DATA_HOME='/var/lib/libvirt/qemu/domain-7-evdev VNC/.local/share' \ XDG_CACHE_HOME='/var/lib/libvirt/qemu/domain-7-evdev VNC/.cache' \ XDG_CONFIG_HOME='/var/lib/libvirt/qemu/domain-7-evdev VNC/.config' \ /usr/local/sbin/qemu \ -name 'guest=evdev VNC,debug-threads=on' \ -S \ -object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain-7-evdev VNC/master-key.aes"}' \ -blockdev '{"driver":"file","filename":"/usr/share/qemu/ovmf-x64/OVMF_CODE-pure-efi.fd","node-name":"libvirt-pflash0-storage","auto-read-only":true,"discard":"unmap"}' \ -blockdev '{"node-name":"libvirt-pflash0-format","read-only":true,"driver":"raw","file":"libvirt-pflash0-storage"}' \ -blockdev '{"driver":"file","filename":"/etc/libvirt/qemu/nvram/7bafda78-eb87-7a41-da13-e4c92791ccd1_VARS-pure-efi.fd","node-name":"libvirt-pflash1-storage","auto-read-only":true,"discard":"unmap"}' \ -blockdev '{"node-name":"libvirt-pflash1-format","read-only":false,"driver":"raw","file":"libvirt-pflash1-storage"}' \ -machine pc-q35-6.2,usb=off,dump-guest-core=off,mem-merge=off,pflash0=libvirt-pflash0-format,pflash1=libvirt-pflash1-format,memory-backend=pc.ram \ -accel kvm \ -cpu host,migratable=on,host-cache-info=on,l3-cache=off \ -m 16384 \ -object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":17179869184}' \ -overcommit mem-lock=off \ -smp 14,sockets=1,dies=1,cores=7,threads=2 \ -uuid 7bafda78-eb87-7a41-da13-e4c92791ccd1 \ -no-user-config \ -nodefaults \ -chardev socket,id=charmonitor,fd=40,server=on,wait=off \ -mon chardev=charmonitor,id=monitor,mode=control \ -rtc base=utc,driftfix=slew \ -global kvm-pit.lost_tick_policy=delay \ -no-hpet \ -no-shutdown \ -boot strict=on \ -device pcie-root-port,port=16,chassis=1,id=pci.1,bus=pcie.0,multifunction=on,addr=0x2 \ -device pcie-root-port,port=17,chassis=2,id=pci.2,bus=pcie.0,addr=0x2.0x1 \ -device pcie-root-port,port=18,chassis=3,id=pci.3,bus=pcie.0,addr=0x2.0x2 \ -device pcie-root-port,port=19,chassis=4,id=pci.4,bus=pcie.0,addr=0x2.0x3 \ -device pcie-root-port,port=20,chassis=5,id=pci.5,bus=pcie.0,addr=0x2.0x4 \ -device ich9-usb-ehci1,id=usb,bus=pcie.0,addr=0x7.0x7 \ -device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pcie.0,multifunction=on,addr=0x7 \ -device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pcie.0,addr=0x7.0x1 \ -device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pcie.0,addr=0x7.0x2 \ -device virtio-serial-pci,id=virtio-serial0,bus=pci.2,addr=0x0 \ -blockdev '{"driver":"file","filename":"/mnt/user/domains/evdev VNC/vdisk1.img","node-name":"libvirt-1-storage","cache":{"direct":false,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"cache":{"direct":false,"no-flush":false},"driver":"raw","file":"libvirt-1-storage"}' \ -device virtio-blk-pci,bus=pci.3,addr=0x0,drive=libvirt-1-format,id=virtio-disk2,bootindex=1,write-cache=on \ -netdev tap,fd=41,id=hostnet0 \ -device virtio-net,netdev=hostnet0,id=net0,mac=52:54:00:1d:f9:b4,bus=pci.1,addr=0x0 \ -chardev pty,id=charserial0 \ -device isa-serial,chardev=charserial0,id=serial0,index=0 \ -chardev socket,id=charchannel0,fd=39,server=on,wait=off \ -device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=org.qemu.guest_agent.0 \ -device usb-tablet,id=input0,bus=usb.0,port=1 \ -audiodev '{"id":"audio1","driver":"none"}' \ -vnc 0.0.0.0:0,websocket=5700,audiodev=audio1 \ -k en-us \ -device qxl-vga,id=video0,max_outputs=1,ram_size=67108864,vram_size=67108864,vram64_size_mb=0,vgamem_mb=16,bus=pcie.0,addr=0x1 \ -device virtio-balloon-pci,id=balloon0,bus=pci.4,addr=0x0 \ -object input-linux,id=kbd,evdev=/dev/input/by-id/usb-LITE-ON_Technology_USB_NetVista_Full_Width_Keyboard.-event-kbd,grab_all=on,repeat=on \ -object \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ -msg timestamp=on qemu-system-x86_64: -object -sandbox: Parameter 'qom-type' does not accept value '-sandbox' 2022-09-25 04:21:18.636+0000: shutting down, reason=failed And here is the XML: <domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'> <name>evdev VNC</name> <uuid>7bafda78-eb87-7a41-da13-e4c92791ccd1</uuid> <metadata> <vmtemplate xmlns="unraid" name="Linux" icon="linux.png" os="linux"/> </metadata> <memory unit='KiB'>16777216</memory> <currentMemory unit='KiB'>16777216</currentMemory> <memoryBacking> <nosharepages/> </memoryBacking> <vcpu placement='static'>14</vcpu> <cputune> <vcpupin vcpu='0' cpuset='3'/> <vcpupin vcpu='1' cpuset='21'/> <vcpupin vcpu='2' cpuset='5'/> <vcpupin vcpu='3' cpuset='23'/> <vcpupin vcpu='4' cpuset='7'/> <vcpupin vcpu='5' cpuset='25'/> <vcpupin vcpu='6' cpuset='9'/> <vcpupin vcpu='7' cpuset='27'/> <vcpupin vcpu='8' cpuset='11'/> <vcpupin vcpu='9' cpuset='29'/> <vcpupin vcpu='10' cpuset='13'/> <vcpupin vcpu='11' cpuset='31'/> <vcpupin vcpu='12' cpuset='15'/> <vcpupin vcpu='13' cpuset='33'/> </cputune> <os> <type arch='x86_64' machine='pc-q35-6.2'>hvm</type> <loader readonly='yes' type='pflash'>/usr/share/qemu/ovmf-x64/OVMF_CODE-pure-efi.fd</loader> <nvram>/etc/libvirt/qemu/nvram/7bafda78-eb87-7a41-da13-e4c92791ccd1_VARS-pure-efi.fd</nvram> </os> <features> <acpi/> <apic/> </features> <cpu mode='host-passthrough' check='none' migratable='on'> <topology sockets='1' dies='1' cores='7' threads='2'/> <cache mode='passthrough'/> </cpu> <clock offset='utc'> <timer name='rtc' tickpolicy='catchup'/> <timer name='pit' tickpolicy='delay'/> <timer name='hpet' present='no'/> </clock> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>restart</on_crash> <devices> <emulator>/usr/local/sbin/qemu</emulator> <disk type='file' device='disk'> <driver name='qemu' type='raw' cache='writeback'/> <source file='/mnt/user/domains/evdev VNC/vdisk1.img'/> <target dev='hdc' bus='virtio'/> <boot order='1'/> <address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/> </disk> <controller type='usb' index='0' model='ich9-ehci1'> <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x7'/> </controller> <controller type='usb' index='0' model='ich9-uhci1'> <master startport='0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0' multifunction='on'/> </controller> <controller type='usb' index='0' model='ich9-uhci2'> <master startport='2'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x1'/> </controller> <controller type='usb' index='0' model='ich9-uhci3'> <master startport='4'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x2'/> </controller> <controller type='sata' index='0'> <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/> </controller> <controller type='pci' index='0' model='pcie-root'/> <controller type='pci' index='1' model='pcie-root-port'> <model name='pcie-root-port'/> <target chassis='1' port='0x10'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0' multifunction='on'/> </controller> <controller type='pci' index='2' model='pcie-root-port'> <model name='pcie-root-port'/> <target chassis='2' port='0x11'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x1'/> </controller> <controller type='pci' index='3' model='pcie-root-port'> <model name='pcie-root-port'/> <target chassis='3' port='0x12'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x2'/> </controller> <controller type='pci' index='4' model='pcie-root-port'> <model name='pcie-root-port'/> <target chassis='4' port='0x13'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x3'/> </controller> <controller type='pci' index='5' model='pcie-root-port'> <model name='pcie-root-port'/> <target chassis='5' port='0x14'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x4'/> </controller> <controller type='virtio-serial' index='0'> <address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/> </controller> <interface type='bridge'> <mac address='redacted'/> <source bridge='br0'/> <model type='virtio-net'/> <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/> </interface> <serial type='pty'> <target type='isa-serial' port='0'> <model name='isa-serial'/> </target> </serial> <console type='pty'> <target type='serial' port='0'/> </console> <channel type='unix'> <target type='virtio' name='org.qemu.guest_agent.0'/> <address type='virtio-serial' controller='0' bus='0' port='1'/> </channel> <input type='tablet' bus='usb'> <address type='usb' bus='0' port='1'/> </input> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' websocket='-1' listen='0.0.0.0' keymap='en-us'> <listen type='address' address='0.0.0.0'/> </graphics> <audio id='1' type='none'/> <video> <model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='1' primary='yes'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> </video> <memballoon model='virtio'> <address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/> </memballoon> </devices> <qemu:commandline> <qemu:arg value='-object'/> <qemu:arg value='input-linux,id=kbd,evdev=/dev/input/by-id/usb-LITE-ON_Technology_USB_NetVista_Full_Width_Keyboard.-event-kbd,grab_all=on,repeat=on'/> <qemu:arg value='-object'/> </qemu:commandline> </domain> Quote Link to comment
coppit Posted April 18, 2023 Share Posted April 18, 2023 @byb I think you want to remove the 2nd "<qemu:arg value="-object"/>" if you're not doing a mouse as well as the keyboard. Quote Link to comment
coppit Posted April 18, 2023 Share Posted April 18, 2023 (edited) A couple of things I noticed... I got this working, but both my keyboard and my mouse seem to go to "sleep" after 3 seconds. I have to mash a bunch of keys or frantically move the mouse to wake the device up. After that the mouse and keyboard work fine, until I don't use them for 3 seconds. It looks like "powertop --auto-tune" was to blame. FYI, in case anyone else is running into this. I have two identical keyboards for two different VMs. Sadly, /dev/input/by-name only lists one of them. I'm using by-path, but I don't think that's any better than using the raw /dev/input/event. I wasn't sure how this would interact with USB Manager, where I had bound root hubs to the VMs. I unmapped those and instead mapped only the audio devices, leaving the keyboard and mouse to the XML config. Edit: Forget the comment below. I needed to use the one ending with "event-mouse" rather than just "mouse". I'm having trouble with one of my mice... I get this error: internal error: qemu unexpectedly closed the monitor: 2023-04-18T05:26:01.673092Z qemu-system-x86_64: /dev/input/by-id/usb-Gaming_Mouse_Gaming_Mouse-if01-mouse: is not an evdev device I tried with "/dev/input/by-id/usb-Gaming_Mouse_Gaming_Mouse-if01-event-mouse" as well and got the same error. Is there any hope for this mouse? Edited April 18, 2023 by coppit Quote Link to comment
mtongnz Posted December 24, 2023 Share Posted December 24, 2023 I finally got around to doing this so I could wake my sleeping VM with the keyboard. It works great. Thanks heaps. I have a minor issue however... using a Cooler Master MK750 on a Win11 VM. The capslock and numlock lights no longer work (so I can't tell if they're enabled or not). As far as I can tell, windows can't detect the keyboard anymore and only gets the events. If I try to install the Cooler Master Portal, it seems to not see any devices. Is there a way to pass keyboard events and the keyboard device so windows detects it correctly and sends back the caps/num states? I also have a win10 VM with just standard VM pass through which works fine, so it's not a keyboard issue. Thanks Quote Link to comment
theone Posted March 25 Share Posted March 25 I am trying to setup a mouse to wake up a Windows VM. I connected the mouse to the server and it appears corrrectly as "Microsoft Corp. Basic Optical Mouse" But when I run the following it does not appear ls /dev/input/by-id/ Also "by-path" doesn't give additional information How do I proceed? Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.