From: David Herrmann <dh.herrmann-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Gerd Hoffmann <kraxel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: virtio-dev-sDuHXQ4OtrM4h7I2RyI4rWD2FQJk+8+b@public.gmane.org,
virtualization-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
mst-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
Rusty Russell <rusty-8n+1lVoiYb80n/F98K4Iww@public.gmane.org>,
open list <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
"open list:ABI/API"
<linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Dmitry Torokhov
<dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: Re: [PATCH 1/1] Add virtio-input driver.
Date: Fri, 20 Mar 2015 10:55:07 +0100 [thread overview]
Message-ID: <CANq1E4QLPSK6NVeEx6yihYPdF-XPpXx4rKv0deHwX+s2RzFHCg@mail.gmail.com> (raw)
In-Reply-To: <1426844885.32097.36.camel-3OfP5uLMi4C46o+2HkPkLj4oCIwMql/M@public.gmane.org>
Hi
On Fri, Mar 20, 2015 at 10:48 AM, Gerd Hoffmann <kraxel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:
>
> Hi,
>
>> > +static int virtinput_send_status(struct virtio_input *vi,
>> > + u16 type, u16 code, s32 value)
>> > +{
>> > + struct virtio_input_event *stsbuf;
>> > + struct scatterlist sg[1];
>> > +
>> > + stsbuf = kzalloc(sizeof(*stsbuf), GFP_ATOMIC);
>> > + if (!stsbuf)
>> > + return -ENOMEM;
>> > +
>> > + stsbuf->type = cpu_to_le16(type);
>> > + stsbuf->code = cpu_to_le16(code);
>> > + stsbuf->value = cpu_to_le32(value);
>> > + sg_init_one(sg, stsbuf, sizeof(*stsbuf));
>> > + virtqueue_add_outbuf(vi->sts, sg, 1, stsbuf, GFP_ATOMIC);
>> > + virtqueue_kick(vi->sts);
>>
>> GFP_ATOMIC, eww. But everyone does that for input_event() callbacks..
>
> Yea, did it this way because I saw it elsewhere.
>
>> we should fix that for user-space input one day.
>
> Sounds like I have to use GFP_ATOMIC and can't switch to GFP_KERNEL,
> correct?
You cannot use GFP_KERNEL in this context, correct. GFP_ATOMIC is also
what all HID backends do, so it's fine here.
>> > + size = virtinput_cfg_select(vi, VIRTIO_INPUT_CFG_ABS_INFO, abs);
>> > + virtio_cread(vi->vdev, struct virtio_input_config, u.abs.min, &mi);
>> > + virtio_cread(vi->vdev, struct virtio_input_config, u.abs.max, &ma);
>> > + virtio_cread(vi->vdev, struct virtio_input_config, u.abs.fuzz, &fu);
>> > + virtio_cread(vi->vdev, struct virtio_input_config, u.abs.flat, &fl);
>>
>> abs.resolution is missing. Please add it, we really also need to add
>> it to uinput one day.
>
> Ok. How should I handle cases where the resolution is either not known
> or not fixed? Just leave it zero?
Leave it 0, which is what you already do by not assigning it.
>> > + vi->idev->name = vi->name;
>> > + vi->idev->phys = vi->phys;
>>
>> Can you set vi->idev->uniq to the virtio-bus path?
>>
>> > + vi->idev->id.bustype = BUS_VIRTUAL;
>> > + vi->idev->id.vendor = 0x0001;
>> > + vi->idev->id.product = 0x0001;
>> > + vi->idev->id.version = 0x0100;
>>
>> 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
next prev parent reply other threads:[~2015-03-20 9:55 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1426756391-26585-1-git-send-email-kraxel@redhat.com>
[not found] ` <1426756391-26585-1-git-send-email-kraxel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-03-19 9:13 ` [PATCH 1/1] Add virtio-input driver Gerd Hoffmann
[not found] ` <1426756391-26585-2-git-send-email-kraxel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-03-19 12:27 ` Michael S. Tsirkin
2015-03-20 10:28 ` Gerd Hoffmann
2015-03-21 22:22 ` Michael S. Tsirkin
2015-03-23 7:53 ` Gerd Hoffmann
2015-03-23 11:52 ` [virtio-dev] " Paolo Bonzini
2015-03-23 13:44 ` Gerd Hoffmann
2015-03-23 13:51 ` Michael S. Tsirkin
2015-03-23 14:27 ` Gerd Hoffmann
[not found] ` <1427120855.27137.55.camel-3OfP5uLMi4C46o+2HkPkLj4oCIwMql/M@public.gmane.org>
2015-03-23 14:54 ` Michael S. Tsirkin
2015-03-23 15:05 ` Gerd Hoffmann
[not found] ` <1427123129.27137.62.camel-3OfP5uLMi4C46o+2HkPkLj4oCIwMql/M@public.gmane.org>
2015-03-23 16:17 ` Cornelia Huck
2015-03-23 18:20 ` Michael S. Tsirkin
2015-03-19 12:29 ` David Herrmann
[not found] ` <CANq1E4TDj4pq3J_BVc=Yuzo5dVR=QcNexVUqaqwjg7Qi5_xX4Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-19 16:27 ` Dmitry Torokhov
2015-03-19 17:16 ` David Herrmann
2015-03-20 9:54 ` Gerd Hoffmann
2015-03-20 9:48 ` Gerd Hoffmann
[not found] ` <1426844885.32097.36.camel-3OfP5uLMi4C46o+2HkPkLj4oCIwMql/M@public.gmane.org>
2015-03-20 9:55 ` David Herrmann [this message]
[not found] ` <CANq1E4QLPSK6NVeEx6yihYPdF-XPpXx4rKv0deHwX+s2RzFHCg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-20 10:36 ` Gerd Hoffmann
[not found] ` <1426847799.32097.66.camel-3OfP5uLMi4C46o+2HkPkLj4oCIwMql/M@public.gmane.org>
2015-03-20 10:43 ` David Herrmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CANq1E4QLPSK6NVeEx6yihYPdF-XPpXx4rKv0deHwX+s2RzFHCg@mail.gmail.com \
--to=dh.herrmann-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=kraxel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mst-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=rusty-8n+1lVoiYb80n/F98K4Iww@public.gmane.org \
--cc=virtio-dev-sDuHXQ4OtrM4h7I2RyI4rWD2FQJk+8+b@public.gmane.org \
--cc=virtualization-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).