1*887d5775SLeo Yan.. _vhost_user_input: 2*887d5775SLeo Yan 3*887d5775SLeo YanQEMU vhost-user-input - Input emulation 4*887d5775SLeo Yan======================================= 5*887d5775SLeo Yan 6*887d5775SLeo YanThis document describes the setup and usage of the Virtio input device. 7*887d5775SLeo YanThe Virtio input device is a paravirtualized device for input events. 8*887d5775SLeo Yan 9*887d5775SLeo YanDescription 10*887d5775SLeo Yan----------- 11*887d5775SLeo Yan 12*887d5775SLeo YanThe vhost-user-input device implementation was designed to work with a daemon 13*887d5775SLeo Yanpolling on input devices and passes input events to the guest. 14*887d5775SLeo Yan 15*887d5775SLeo YanQEMU provides a backend implementation in contrib/vhost-user-input. 16*887d5775SLeo Yan 17*887d5775SLeo YanLinux kernel support 18*887d5775SLeo Yan-------------------- 19*887d5775SLeo Yan 20*887d5775SLeo YanVirtio input requires a guest Linux kernel built with the 21*887d5775SLeo Yan``CONFIG_VIRTIO_INPUT`` option. 22*887d5775SLeo Yan 23*887d5775SLeo YanExamples 24*887d5775SLeo Yan-------- 25*887d5775SLeo Yan 26*887d5775SLeo YanThe backend daemon should be started first: 27*887d5775SLeo Yan 28*887d5775SLeo Yan:: 29*887d5775SLeo Yan 30*887d5775SLeo Yan host# vhost-user-input --socket-path=input.sock \ 31*887d5775SLeo Yan --evdev-path=/dev/input/event17 32*887d5775SLeo Yan 33*887d5775SLeo YanThe QEMU invocation needs to create a chardev socket to communicate with the 34*887d5775SLeo Yanbackend daemon and access the VirtIO queues with the guest over the 35*887d5775SLeo Yan:ref:`shared memory <shared_memory_object>`. 36*887d5775SLeo Yan 37*887d5775SLeo Yan:: 38*887d5775SLeo Yan 39*887d5775SLeo Yan host# qemu-system \ 40*887d5775SLeo Yan -chardev socket,path=/tmp/input.sock,id=mouse0 \ 41*887d5775SLeo Yan -device vhost-user-input-pci,chardev=mouse0 \ 42*887d5775SLeo Yan -m 4096 \ 43*887d5775SLeo Yan -object memory-backend-file,id=mem,size=4G,mem-path=/dev/shm,share=on \ 44*887d5775SLeo Yan -numa node,memdev=mem \ 45*887d5775SLeo Yan ... 46