@@ -0,0 +1,65 @@+#ifndef _LINUX_VIRTIO_INPUT_H+#define _LINUX_VIRTIO_INPUT_H+/* This header is BSD licensed so anyone can use the definitions to implement+*compatibledrivers/servers.+*+*Redistributionanduseinsourceandbinaryforms,withorwithout+*modification,arepermittedprovidedthatthefollowingconditions+*aremet:+*1.Redistributionsofsourcecodemustretaintheabovecopyright+*notice,thislistofconditionsandthefollowingdisclaimer.+*2.Redistributionsinbinaryformmustreproducetheabovecopyright+*notice,thislistofconditionsandthefollowingdisclaimerinthe+*documentationand/orothermaterialsprovidedwiththedistribution.+*3.NeitherthenameofIBMnorthenamesofitscontributors+*maybeusedtoendorseorpromoteproductsderivedfromthissoftware+*withoutspecificpriorwrittenpermission.+*THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS``ASIS''AND+*ANYEXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THE+*IMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSE+*AREDISCLAIMED.INNOEVENTSHALLIBMORCONTRIBUTORSBELIABLE+*FORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIAL+*DAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODS+*ORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION)+*HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICT+*LIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAY+*OUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOF+*SUCHDAMAGE.*/+#include<linux/virtio_ids.h>+#include<linux/virtio_config.h>++enumvirtio_input_config_select{+VIRTIO_INPUT_CFG_UNSET=0x00,+VIRTIO_INPUT_CFG_ID_NAME=0x01,+VIRTIO_INPUT_CFG_ID_SERIAL=0x02,+VIRTIO_INPUT_CFG_PROP_BITS=0x10,+VIRTIO_INPUT_CFG_EV_BITS=0x11,+VIRTIO_INPUT_CFG_ABS_INFO=0x12,+};++structvirtio_input_absinfo{+__le32min;+__le32max;+__le32fuzz;+__le32flat;+};++structvirtio_input_config{+__u8select;+__u8subsel;+__u8size;+__u8reserved;+union{+charstring[128];+__u8bitmap[128];+structvirtio_input_absinfoabs;+}u;+};++structvirtio_input_event{+__le16type;+__le16code;+__le32value;+};++#endif /* _LINUX_VIRTIO_INPUT_H */
From: "Michael S. Tsirkin" <mst@redhat.com> Date: 2015-03-19 12:27:47
On Thu, Mar 19, 2015 at 10:13:11AM +0100, Gerd Hoffmann wrote:
virtio-input is basically evdev-events-over-virtio, so this driver isn't
much more than reading configuration from config space and forwarding
incoming events to the linux input layer.
Signed-off-by: Gerd Hoffmann <redacted>
What worries me is how well are these events specified.
Will we be able to write drivers for non-linux guests?
Not sure where to discuss this - this seems like an inappropriate
thread.
Comments on linux driver below.
Does this return an error to userspace?
If so it's not a good idea I think, GFP_ATOMIC failures are
transient conditions and should not be reported
to userspace.
Can use GFP_KERNEL here?
doesn't above just implement bitmap_copy or bitmap_or? Will it hurt to
just do virtio_cread_bytes into a temporary buffer and then invoke
bitmap ops? Looks like the buffer is at most 256 bytes:
too large to be on stack, but you can allocate it at probe time.
free on error is out of order with initialization.
Might lead to leaks or other bugs.
Also - can you name labels something sensible pls?
out is usually for exiting on success too...
E.g. out4 -> err_register etc.
@@ -0,0 +1,65 @@+#ifndef _LINUX_VIRTIO_INPUT_H+#define _LINUX_VIRTIO_INPUT_H+/* This header is BSD licensed so anyone can use the definitions to implement+*compatibledrivers/servers.+*+*Redistributionanduseinsourceandbinaryforms,withorwithout+*modification,arepermittedprovidedthatthefollowingconditions+*aremet:+*1.Redistributionsofsourcecodemustretaintheabovecopyright+*notice,thislistofconditionsandthefollowingdisclaimer.+*2.Redistributionsinbinaryformmustreproducetheabovecopyright+*notice,thislistofconditionsandthefollowingdisclaimerinthe+*documentationand/orothermaterialsprovidedwiththedistribution.+*3.NeitherthenameofIBMnorthenamesofitscontributors+*maybeusedtoendorseorpromoteproductsderivedfromthissoftware+*withoutspecificpriorwrittenpermission.+*THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS``ASIS''AND+*ANYEXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THE+*IMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSE+*AREDISCLAIMED.INNOEVENTSHALLIBMORCONTRIBUTORSBELIABLE+*FORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIAL+*DAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODS+*ORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION)+*HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICT+*LIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAY+*OUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOF+*SUCHDAMAGE.*/+#include<linux/virtio_ids.h>+#include<linux/virtio_config.h>++enumvirtio_input_config_select{+VIRTIO_INPUT_CFG_UNSET=0x00,+VIRTIO_INPUT_CFG_ID_NAME=0x01,+VIRTIO_INPUT_CFG_ID_SERIAL=0x02,+VIRTIO_INPUT_CFG_PROP_BITS=0x10,+VIRTIO_INPUT_CFG_EV_BITS=0x11,+VIRTIO_INPUT_CFG_ABS_INFO=0x12,+};++structvirtio_input_absinfo{+__le32min;+__le32max;+__le32fuzz;+__le32flat;+};++structvirtio_input_config{+__u8select;+__u8subsel;+__u8size;+__u8reserved;+union{+charstring[128];+__u8bitmap[128];+structvirtio_input_absinfoabs;+}u;+};++structvirtio_input_event{+__le16type;+__le16code;+__le32value;+};++#endif /* _LINUX_VIRTIO_INPUT_H */
Does this return an error to userspace?
If so it's not a good idea I think, GFP_ATOMIC failures are
transient conditions and should not be reported
to userspace.
Can use GFP_KERNEL here?
This can fail if queue is full. What prevents this from happening?
Nothing. It's highly unlikely though given the throughput we have for
input devices, not sure it is that useful to put too much effort into
this. Except for freeing stsbuf in the error case.
quoted
+ virtqueue_kick(vi->sts);
Also what prevents multiple virtinput_send_status calls
from racing with each other? Is there locking at a higher level?
doesn't above just implement bitmap_copy or bitmap_or?
Not fully sure how bitmaps are defined. virtio has a stream of bytes,
first byte carries bits 0-7, second 8-15 etc. linux kernel bitmaps ops
are operating on longs, and native byteorder longs would be something
else ...
you read le field into u32 value.
Please run sparse on this code. you will get a ton
of warnings. Same error appears elsewhere.
Indeed. IIRC that wasn't the case a while back. Guess those bitwise
annotations have been added with the virtio 1.0 patches?
In any case I'll fix it up.
quoted
+static int virtinput_probe(struct virtio_device *vdev)
+{
+ struct virtio_input *vi;
+ size_t size;
+ int abs, err;
How about checking VERSION_1 and bailing out of not there?
I don't think this is needed. There isn't a hard dependency on virtio
1.0. It's just that config space is relatively large and because of
that I want it be 1.0 on the host (qemu) side to not allocate large
portions of I/O address space for the legacy virtio pci bar.
free on error is out of order with initialization.
Might lead to leaks or other bugs.
Also - can you name labels something sensible pls?
out is usually for exiting on success too...
E.g. out4 -> err_register etc.
Does this return an error to userspace?
If so it's not a good idea I think, GFP_ATOMIC failures are
transient conditions and should not be reported
to userspace.
Can use GFP_KERNEL here?
This can fail if queue is full. What prevents this from happening?
Nothing. It's highly unlikely though given the throughput we have for
input devices, not sure it is that useful to put too much effort into
this. Except for freeing stsbuf in the error case.
quoted
quoted
+ virtqueue_kick(vi->sts);
Also what prevents multiple virtinput_send_status calls
from racing with each other? Is there locking at a higher level?
So you are really just reading in array of bytes?
All this set bit trickery is just to convert things from LE?
quoted
quoted
+ }
doesn't above just implement bitmap_copy or bitmap_or?
Not fully sure how bitmaps are defined. virtio has a stream of bytes,
first byte carries bits 0-7, second 8-15 etc. linux kernel bitmaps ops
are operating on longs, and native byteorder longs would be something
else ...
This still looks too complex.
At least, this needs a comment explaining what the function does,
and maybe wrap it in a helper like virtio_input_bitmap_copy or
virtio_bitmap_or.
you read le field into u32 value.
Please run sparse on this code. you will get a ton
of warnings. Same error appears elsewhere.
Indeed. IIRC that wasn't the case a while back. Guess those bitwise
annotations have been added with the virtio 1.0 patches?
In any case I'll fix it up.
I see you still didn't in v2?
quoted
quoted
+static int virtinput_probe(struct virtio_device *vdev)
+{
+ struct virtio_input *vi;
+ size_t size;
+ int abs, err;
How about checking VERSION_1 and bailing out of not there?
I don't think this is needed. There isn't a hard dependency on virtio
1.0. It's just that config space is relatively large and because of
that I want it be 1.0 on the host (qemu) side to not allocate large
portions of I/O address space for the legacy virtio pci bar.
You are doing leXXX everywhere, that's VERSION_1 dependency.
virtio_cread will do byteswaps differently without VERSION_1.
Just don't go there.
free on error is out of order with initialization.
Might lead to leaks or other bugs.
Also - can you name labels something sensible pls?
out is usually for exiting on success too...
E.g. out4 -> err_register etc.
So you are really just reading in array of bytes?
All this set bit trickery is just to convert things from LE?
Trickery? Just checking each bit from virtio config space, then set it
in the input layer bitmap. It's a simple stupid loop.
Surely not the most efficient way, but hey, it's not in the hot path and
I'm sure I'm setting the bits correctly because this uses the standard
linux kernel bitops.
At least, this needs a comment explaining what the function does,
and maybe wrap it in a helper like virtio_input_bitmap_copy or
virtio_bitmap_or.
you read le field into u32 value.
Please run sparse on this code. you will get a ton
of warnings. Same error appears elsewhere.
Indeed. IIRC that wasn't the case a while back. Guess those bitwise
annotations have been added with the virtio 1.0 patches?
In any case I'll fix it up.
I see you still didn't in v2?
v2 builds fine without sparse warnings. virtio_cread handles swapping
if needed and returns native endian, so I have to store this in normal
u32 variables and pass it on to the input layer as-is.
You are doing leXXX everywhere, that's VERSION_1 dependency.
virtio_cread will do byteswaps differently without VERSION_1.
Just don't go there.
Changed that for v2, for the config space structs. They have normal u32
in there now. virtio_cread() wants it this way.
cheers,
Gerd
So you are really just reading in array of bytes?
All this set bit trickery is just to convert things from LE?
Trickery? Just checking each bit from virtio config space, then set it
in the input layer bitmap. It's a simple stupid loop.
Surely not the most efficient way, but hey, it's not in the hot path and
I'm sure I'm setting the bits correctly because this uses the standard
linux kernel bitops.
Use __set_bit though, because set_bit is an atomic operation.
Paolo
quoted
quoted
At least, this needs a comment explaining what the function does,
and maybe wrap it in a helper like virtio_input_bitmap_copy or
virtio_bitmap_or.
At least, this needs a comment explaining what the function does,
and maybe wrap it in a helper like virtio_input_bitmap_copy or
virtio_bitmap_or.
Can do that, sure.
Well, the function where this is in already cares about the bitmap copy
only. Can add a comment though.
quoted
You are doing leXXX everywhere, that's VERSION_1 dependency.
virtio_cread will do byteswaps differently without VERSION_1.
Just don't go there.
Changed that for v2, for the config space structs. They have normal u32
in there now. virtio_cread() wants it this way.
I liked the __le32 in the config space structs more though, so I've
waded through the virtio_config.h header file.
To me it looks like we need separate virtio_cread() versions for
non-transitional drivers, which do __le32 -> u32 translation instead of
__virtio32 -> u32 translation, so I can have __le32 types in the config
space structs.
Or I could use vdev->config->get() directly instead of virtio_cread, but
I'll loose sparse checking that way.
Hmm. Recommendations? Better ideas?
cheers,
Gerd
From: "Michael S. Tsirkin" <mst@redhat.com> Date: 2015-03-23 13:51:25
On Mon, Mar 23, 2015 at 02:44:52PM +0100, Gerd Hoffmann wrote:
Hi,
quoted
quoted
At least, this needs a comment explaining what the function does,
and maybe wrap it in a helper like virtio_input_bitmap_copy or
virtio_bitmap_or.
Can do that, sure.
Well, the function where this is in already cares about the bitmap copy
only. Can add a comment though.
OK, I think that will be enough for now.
quoted
quoted
You are doing leXXX everywhere, that's VERSION_1 dependency.
virtio_cread will do byteswaps differently without VERSION_1.
Just don't go there.
Changed that for v2, for the config space structs. They have normal u32
in there now. virtio_cread() wants it this way.
I liked the __le32 in the config space structs more though, so I've
waded through the virtio_config.h header file.
To me it looks like we need separate virtio_cread() versions for
non-transitional drivers, which do __le32 -> u32 translation instead of
__virtio32 -> u32 translation, so I can have __le32 types in the config
space structs.
Or I could use vdev->config->get() directly instead of virtio_cread, but
I'll loose sparse checking that way.
Hmm. Recommendations? Better ideas?
cheers,
Gerd
So to clarify, you dislike using __virtio32 in virtio input header?
--
MST
You are doing leXXX everywhere, that's VERSION_1 dependency.
virtio_cread will do byteswaps differently without VERSION_1.
Just don't go there.
So to clarify, you dislike using __virtio32 in virtio input header?
Well, as I understand things __virtio32 implies byteorder depends on
whenever we are using VERSION_1 or not. And non-transitional drivers
should not need it as everything is by definition little endian.
So, yes, your suggestion to just require VERSION_1 in the driver implies
in my eyes that there should be no reason to use __virtio32 instead of
__le32.
Or do I miss something here?
cheers,
Gerd
From: "Michael S. Tsirkin" <mst@redhat.com> Date: 2015-03-23 14:54:15
On Mon, Mar 23, 2015 at 03:27:35PM +0100, Gerd Hoffmann wrote:
Hi,
quoted
quoted
quoted
quoted
You are doing leXXX everywhere, that's VERSION_1 dependency.
virtio_cread will do byteswaps differently without VERSION_1.
Just don't go there.
quoted
So to clarify, you dislike using __virtio32 in virtio input header?
Well, as I understand things __virtio32 implies byteorder depends on
whenever we are using VERSION_1 or not. And non-transitional drivers
should not need it as everything is by definition little endian.
So, yes, your suggestion to just require VERSION_1 in the driver implies
in my eyes that there should be no reason to use __virtio32 instead of
__le32.
Or do I miss something here?
cheers,
Gerd
You are right but then if you do require VERSION_1 then
__virtio32 becomes identical to __le32.
There's some runtime overhead as we check on each access,
but it shouldn't matter here, right?
I guess we could add virtio_cread_le - is this what
you'd like?
--
MST
On Mo, 2015-03-23 at 15:54 +0100, Michael S. Tsirkin wrote:
On Mon, Mar 23, 2015 at 03:27:35PM +0100, Gerd Hoffmann wrote:
quoted
Hi,
quoted
quoted
quoted
quoted
You are doing leXXX everywhere, that's VERSION_1 dependency.
virtio_cread will do byteswaps differently without VERSION_1.
Just don't go there.
quoted
So to clarify, you dislike using __virtio32 in virtio input header?
Well, as I understand things __virtio32 implies byteorder depends on
whenever we are using VERSION_1 or not. And non-transitional drivers
should not need it as everything is by definition little endian.
So, yes, your suggestion to just require VERSION_1 in the driver implies
in my eyes that there should be no reason to use __virtio32 instead of
__le32.
Or do I miss something here?
cheers,
Gerd
You are right but then if you do require VERSION_1 then
__virtio32 becomes identical to __le32.
Except that sparse doesn't know that and throws errors when I mix the
two.
There's some runtime overhead as we check on each access,
but it shouldn't matter here, right?
Correct, config space is used at initialization time only.
I guess we could add virtio_cread_le - is this what
you'd like?
I just want something that makes both you and sparse happy. I don't
care much whenever that is adding virtio_cread_le() or using __virtio32
even though it'll effectively is __le32 due to VERSION_1 being required.
cheers,
Gerd
On Mon, 23 Mar 2015 16:05:29 +0100
Gerd Hoffmann [off-list ref] wrote:
On Mo, 2015-03-23 at 15:54 +0100, Michael S. Tsirkin wrote:
quoted
On Mon, Mar 23, 2015 at 03:27:35PM +0100, Gerd Hoffmann wrote:
quoted
Hi,
quoted
quoted
quoted
quoted
You are doing leXXX everywhere, that's VERSION_1 dependency.
virtio_cread will do byteswaps differently without VERSION_1.
Just don't go there.
quoted
So to clarify, you dislike using __virtio32 in virtio input header?
Well, as I understand things __virtio32 implies byteorder depends on
whenever we are using VERSION_1 or not. And non-transitional drivers
should not need it as everything is by definition little endian.
So, yes, your suggestion to just require VERSION_1 in the driver implies
in my eyes that there should be no reason to use __virtio32 instead of
__le32.
Or do I miss something here?
cheers,
Gerd
You are right but then if you do require VERSION_1 then
__virtio32 becomes identical to __le32.
Except that sparse doesn't know that and throws errors when I mix the
two.
quoted
There's some runtime overhead as we check on each access,
but it shouldn't matter here, right?
Correct, config space is used at initialization time only.
quoted
I guess we could add virtio_cread_le - is this what
you'd like?
I just want something that makes both you and sparse happy. I don't
care much whenever that is adding virtio_cread_le() or using __virtio32
even though it'll effectively is __le32 due to VERSION_1 being required.
I think it is clearer if you use __virtio32: The fact that virtio-input
is VERSION_1 only is not apparent from looking at the config space
definition, and explicitly forcing le accesses makes it look similar to
the oddballs like virtio-balloon. Just my two cents.
From: "Michael S. Tsirkin" <mst@redhat.com> Date: 2015-03-23 18:21:05
On Mon, Mar 23, 2015 at 04:05:29PM +0100, Gerd Hoffmann wrote:
On Mo, 2015-03-23 at 15:54 +0100, Michael S. Tsirkin wrote:
quoted
On Mon, Mar 23, 2015 at 03:27:35PM +0100, Gerd Hoffmann wrote:
quoted
Hi,
quoted
quoted
quoted
quoted
You are doing leXXX everywhere, that's VERSION_1 dependency.
virtio_cread will do byteswaps differently without VERSION_1.
Just don't go there.
quoted
So to clarify, you dislike using __virtio32 in virtio input header?
Well, as I understand things __virtio32 implies byteorder depends on
whenever we are using VERSION_1 or not. And non-transitional drivers
should not need it as everything is by definition little endian.
So, yes, your suggestion to just require VERSION_1 in the driver implies
in my eyes that there should be no reason to use __virtio32 instead of
__le32.
Or do I miss something here?
cheers,
Gerd
You are right but then if you do require VERSION_1 then
__virtio32 becomes identical to __le32.
Except that sparse doesn't know that and throws errors when I mix the
two.
quoted
There's some runtime overhead as we check on each access,
but it shouldn't matter here, right?
Correct, config space is used at initialization time only.
quoted
I guess we could add virtio_cread_le - is this what
you'd like?
I just want something that makes both you and sparse happy. I don't
care much whenever that is adding virtio_cread_le() or using __virtio32
even though it'll effectively is __le32 due to VERSION_1 being required.
cheers,
Gerd
OK so how about we just use __virtio32 everywhere for now?
--
MST
Please don't hardcode those. All user-space based interaction with
input-devices relies on those IDs. Can we retrieve it from the host
just like the name?
@@ -0,0 +1,65 @@+#ifndef _LINUX_VIRTIO_INPUT_H+#define _LINUX_VIRTIO_INPUT_H+/* This header is BSD licensed so anyone can use the definitions to implement+*compatibledrivers/servers.+*+*Redistributionanduseinsourceandbinaryforms,withorwithout+*modification,arepermittedprovidedthatthefollowingconditions+*aremet:+*1.Redistributionsofsourcecodemustretaintheabovecopyright+*notice,thislistofconditionsandthefollowingdisclaimer.+*2.Redistributionsinbinaryformmustreproducetheabovecopyright+*notice,thislistofconditionsandthefollowingdisclaimerinthe+*documentationand/orothermaterialsprovidedwiththedistribution.+*3.NeitherthenameofIBMnorthenamesofitscontributors+*maybeusedtoendorseorpromoteproductsderivedfromthissoftware+*withoutspecificpriorwrittenpermission.+*THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS``ASIS''AND+*ANYEXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THE+*IMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSE+*AREDISCLAIMED.INNOEVENTSHALLIBMORCONTRIBUTORSBELIABLE+*FORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIAL+*DAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODS+*ORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION)+*HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICT+*LIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAY+*OUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOF+*SUCHDAMAGE.*/+#include<linux/virtio_ids.h>+#include<linux/virtio_config.h>++enumvirtio_input_config_select{+VIRTIO_INPUT_CFG_UNSET=0x00,+VIRTIO_INPUT_CFG_ID_NAME=0x01,+VIRTIO_INPUT_CFG_ID_SERIAL=0x02,+VIRTIO_INPUT_CFG_PROP_BITS=0x10,+VIRTIO_INPUT_CFG_EV_BITS=0x11,+VIRTIO_INPUT_CFG_ABS_INFO=0x12,+};++structvirtio_input_absinfo{+__le32min;+__le32max;+__le32fuzz;+__le32flat;+};++structvirtio_input_config{+__u8select;+__u8subsel;+__u8size;+__u8reserved;+union{+charstring[128];+__u8bitmap[128];+structvirtio_input_absinfoabs;+}u;+};++structvirtio_input_event{+__le16type;+__le16code;+__le32value;+};++#endif /* _LINUX_VIRTIO_INPUT_H */--
The input-parts look good to me (apart from my comments). No idea how
virtio exactly works, so I'll leave that to Rusty.
I put Dmitry on CC, he might have some more valuable input on the input-parts.
Thanks
David
Please don't hardcode those. All user-space based interaction with
input-devices relies on those IDs. Can we retrieve it from the host
just like the name?
Yes, we can.
There will be emulated devices, i.e. the input coming from
vnc/gtk/whatever will be sent to the virtio devices (instead of ps/2 or
usb). For these we should probably have fixed IDs per device. There
are keyboard/mouse/tablet at the moment. Suggestions how to pick IDs?
There will also be pass-through support, i.e. qemu
opening /dev/input/event<nr> and forwarding everything to the guest.
How should that be handled best? Copy all four from the host? Even
though the bustype is BUS_USB? Not sure this actually improves things
because the guest can match the device, or whenever this confuses apps
due to BUS_USB being applied to virtio devices ...
cheers,
Gerd
Please don't hardcode those. All user-space based interaction with
input-devices relies on those IDs. Can we retrieve it from the host
just like the name?
Yes, we can.
There will be emulated devices, i.e. the input coming from
vnc/gtk/whatever will be sent to the virtio devices (instead of ps/2 or
usb). For these we should probably have fixed IDs per device. There
are keyboard/mouse/tablet at the moment. Suggestions how to pick IDs?
There will also be pass-through support, i.e. qemu
opening /dev/input/event<nr> and forwarding everything to the guest.
How should that be handled best? Copy all four from the host? Even
though the bustype is BUS_USB? Not sure this actually improves things
because the guest can match the device, or whenever this confuses apps
due to BUS_USB being applied to virtio devices ...
Lemme give an example: We have databases in user-space, that allow
applications to figure out the mouse DPI values of a device. Those
databases match on all four, bus+vid+pid+ver (sometimes even more,
like name and dmi). If one of those is not forwarded, it will not be
detected.
I'd like to see all four forwarded from the host. I'd be fine with
"bus" being set to VIRTUAL, but I'm not sure why that would be a good
thing to do?
Thanks
David
There will also be pass-through support, i.e. qemu
opening /dev/input/event<nr> and forwarding everything to the guest.
How should that be handled best? Copy all four from the host? Even
though the bustype is BUS_USB? Not sure this actually improves things
because the guest can match the device, or whenever this confuses apps
due to BUS_USB being applied to virtio devices ...
Lemme give an example: We have databases in user-space, that allow
applications to figure out the mouse DPI values of a device. Those
databases match on all four, bus+vid+pid+ver (sometimes even more,
like name and dmi). If one of those is not forwarded, it will not be
detected.
Ok, so forward as much as possible.
I'd like to see all four forwarded from the host. I'd be fine with
"bus" being set to VIRTUAL, but I'm not sure why that would be a good
thing to do?
I think for the emulated devices it's fine to use VIRTUAL.
For the passthrough case suspected we could confuse apps because ->phys
points to a virtio device whereas ->type says "I'm usb".
But at least the device database probably doesn't care much about the
physical path I guess, because the mouse is the same no matter which usb
port I plug it in, correct?
cheers,
Gerd
From: David Herrmann <hidden> Date: 2015-03-20 10:43:49
Hi
On Fri, Mar 20, 2015 at 11:36 AM, Gerd Hoffmann [off-list ref] wrote:
quoted
I'd like to see all four forwarded from the host. I'd be fine with
"bus" being set to VIRTUAL, but I'm not sure why that would be a good
thing to do?
I think for the emulated devices it's fine to use VIRTUAL.
Yes, on the host side just use BUS_VIRTUAL if you don't have a real bus to set.
For the passthrough case suspected we could confuse apps because ->phys
points to a virtio device whereas ->type says "I'm usb".
That's not an issue. The "phys" field hasn't been standardized in any
way that I'm aware of (except on a per-driver basis, maybe).
But at least the device database probably doesn't care much about the
physical path I guess, because the mouse is the same no matter which usb
port I plug it in, correct?