From patchwork Fri Jan 15 18:14:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: sL1pKn07 SpinFlo X-Patchwork-Id: 8043781 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 45F079F1C0 for ; Fri, 15 Jan 2016 18:15:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3D9472020F for ; Fri, 15 Jan 2016 18:15:01 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 354612017D for ; Fri, 15 Jan 2016 18:15:00 +0000 (UTC) Received: from localhost ([::1]:48512 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aK8tn-00025S-Gi for patchwork-qemu-devel@patchwork.kernel.org; Fri, 15 Jan 2016 13:14:59 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32954) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aK8tb-00024G-BN for qemu-devel@nongnu.org; Fri, 15 Jan 2016 13:14:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aK8tZ-0004JM-P9 for qemu-devel@nongnu.org; Fri, 15 Jan 2016 13:14:47 -0500 Received: from mail-qg0-x241.google.com ([2607:f8b0:400d:c04::241]:35724) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aK8tZ-0004It-Js for qemu-devel@nongnu.org; Fri, 15 Jan 2016 13:14:45 -0500 Received: by mail-qg0-x241.google.com with SMTP id b35so50061610qge.2 for ; Fri, 15 Jan 2016 10:14:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=mXK0pbkvlWHk1us8mBIlYeeA3W2rFo109f+cc9Un9CI=; b=oR8kn/3An9bk/i4UW/Q4cyQ7ttAVU6XIHzPb55w0/oja9Hasl7yjzfkmW5XDccqBUr 8c0ogZzdUAioUkp1ArXJ8u2Ka9Glas3jQsjB/kvyexrF01kmAup5kBoX+XlI2PabzrwD ax2iNH9CjXTmnjidEbf/nLYlS/H2SCQOrXY+1V0MGfYMQSd6YDTbYvTrxTW168o6GvEB mq2WOXDQIATEuXq/nuVrw5F0qtdeDuNj9R2bZwNJOA8TUSCx6vj29x7/m+yITso+WGGD 5MZb0eRjhnz0dJsc/7VvjUTtjcN8R2RGk2UIuWHxvMgcGGdQyb0D6WF9gDddhPGzz5OU 9gKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=mXK0pbkvlWHk1us8mBIlYeeA3W2rFo109f+cc9Un9CI=; b=NARXvAjdWP7UniEPBW6D8DBZ2zGz8sz2qEBxbTboI9Pl9aQkz0NVb+jStjoJ9cvUsA BVJwOtX7AgMiYH80EtcOtYlZAUIMGX6BdZ12Xiie7e/Tqa5pVw2H5zNxuwvh6zJRBplf AFkvO+hka9VmEKOylWPKt3TCwkyqa7L5htfpF0RX7C33/ky/LVC3TWrV41J87de3XRmR NcnZElOsvzQKgYEo3MFWI7dFXEw1YpE0s8XrFcb66w0/LB9C0yS9b/Ca6CzXmPfUFjFa S1Kb0mXrbnrGKbzHRzQOZkUqA9Q31fdzbOXpRPBzMebr+hbXHkVAwNv/N8b83KPGC5wQ H3HA== X-Gm-Message-State: ALoCoQnao+5X9Po6m4FHSMqvlwhQRu4eeCJfPeCMqdIHxPsYjNYiGrkXtN+mlcYeV+SN9B4LdVcsi6uN0Awr/oc/pogVhuPAjw== X-Received: by 10.140.220.207 with SMTP id q198mr16057031qhb.24.1452881685243; Fri, 15 Jan 2016 10:14:45 -0800 (PST) MIME-Version: 1.0 Received: by 10.140.109.66 with HTTP; Fri, 15 Jan 2016 10:14:05 -0800 (PST) In-Reply-To: References: <1450102686-23855-1-git-send-email-kraxel@redhat.com> <1451908596.7377.95.camel@redhat.com> <1451977524.31764.2.camel@redhat.com> <1452066825.6096.18.camel@redhat.com> <1452087192.6096.38.camel@redhat.com> <1452847825.23156.22.camel@redhat.com> <1452864264.23156.72.camel@redhat.com> From: sL1pKn07 SpinFlo Date: Fri, 15 Jan 2016 19:14:05 +0100 Message-ID: To: kraxel@redhat.com X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400d:c04::241 Cc: qemu-devel@nongnu.org, vfio-users Subject: Re: [Qemu-devel] [vfio-users] [PATCH v2 1/3] input: add qemu_input_qcode_to_linux + qemu_input_linux_to_qcode X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 2016-01-15 19:06 GMT+01:00 sL1pKn07 SpinFlo : > ---------- Forwarded message ---------- > From: Gerd Hoffmann > Date: 2016-01-15 14:24 GMT+01:00 > Subject: Re: [vfio-users] [PATCH v2 1/3] input: add > qemu_input_qcode_to_linux + qemu_input_linux_to_qcode > To: sL1pKn07 SpinFlo > > >> --- a/include/standard-headers/linux/input-event-codes.h >> +++ b/include/standard-headers/linux/input-event-codes.h >> @@ -416,6 +416,11 @@ >> #define BTN_WHEEL 0x150 >> #define BTN_GEAR_DOWN 0x150 >> #define BTN_GEAR_UP 0x151 >> +#define BTN_GEAR_LEFT 0x??? /* FIXME! */ >> +#define BTN_GEAR_RIGHT 0x??? /* FIXME! */ >> +#define BTN_FUNCTION_1 0x??? /* FIXME! */ >> +#define BTN_FUNCTION_2 0x??? /* FIXME! */ > > The ones sent by your mouse most likely already in the list. > > Add "log=on" to the mouse, then qemu will log all mouse events it gets > from the kernel to stderr, including the ones it doesn't handle. That > should show which wheel and button events the mouse sends. Lets > continue from there. > > More buttons can be defined by adding them to InputButton in > qapi-schema.json > > Most tricky part is probably getting the mouse events to the guest os. > quick look as the ps/2 emulation looks like there are no unused bits for > more buttons. Possibly we have to extend the usb mouse emulation for > that. Need to google a bit on that (any hints are welcome ;) ... > > cheers, > Gerd With log=on evdev: relative HWHEEL -1 <- press wheel Left evdev: sync evdev: relative HWHEEL 1 <- press wheel right evdev: sync evdev: type=MSC code=0x4 value=0x90005 evdev: key/btn BTN_EXTRA down evdev: sync evdev: type=MSC code=0x4 value=0x90005 evdev: key/btn BTN_EXTRA up evdev: sync evdev: type=MSC code=0x4 value=0x90004 evdev: key/btn BTN_SIDE down evdev: sync evdev: type=MSC code=0x4 value=0x90004 evdev: key/btn BTN_SIDE up then ------------------------------------------------------------------------------------ ------------------------------------------------------- The part of whell left/right movement i don't know how paste on the code :/ and about the extra buttons on windows.... https://msdn.microsoft.com/en-us/library/windows/hardware/jj128406(v=vs.85).aspx bad business(?) greetings diff --git a/hw/input/hid.c b/hw/input/hid.c index 3221d29..686ca3c 100644 --- a/hw/input/hid.c +++ b/hw/input/hid.c @@ -112,6 +112,8 @@ static void hid_pointer_event(DeviceState *dev, QemuConsole *src, [INPUT_BUTTON_LEFT] = 0x01, [INPUT_BUTTON_RIGHT] = 0x02, [INPUT_BUTTON_MIDDLE] = 0x04, + [INPUT_BUTTON_EXTRA] = 0x114, + [INPUT_BUTTON_SIDE] = 0x113, }; HIDState *hs = (HIDState *)dev; HIDPointerEvent *e; diff --git a/hw/input/ps2.c b/hw/input/ps2.c index 79754cd..325eea8 100644 --- a/hw/input/ps2.c +++ b/hw/input/ps2.c @@ -386,6 +386,8 @@ static void ps2_mouse_event(DeviceState *dev, QemuConsole *src, [INPUT_BUTTON_LEFT] = MOUSE_EVENT_LBUTTON, [INPUT_BUTTON_MIDDLE] = MOUSE_EVENT_MBUTTON, [INPUT_BUTTON_RIGHT] = MOUSE_EVENT_RBUTTON, + [INPUT_BUTTON_EXTRA] = MOUSE_EVENT_EBUTTON, + [INPUT_BUTTON_SIDE] = MOUSE_EVENT_SBUTTON, }; PS2MouseState *s = (PS2MouseState *)dev; diff --git a/hw/input/virtio-input-hid.c b/hw/input/virtio-input-hid.c index a78d11c..c003eb5 100644 --- a/hw/input/virtio-input-hid.c +++ b/hw/input/virtio-input-hid.c @@ -144,6 +144,8 @@ static const unsigned int keymap_button[INPUT_BUTTON__MAX] = { [INPUT_BUTTON_MIDDLE] = BTN_MIDDLE, [INPUT_BUTTON_WHEELUP] = BTN_GEAR_UP, [INPUT_BUTTON_WHEELDOWN] = BTN_GEAR_DOWN, + [INPUT_BUTTON_EXTRA] = BTN_EXTRA, + [INPUT_BUTTON_SIDE] = BTN_SIDE, }; static const unsigned int axismap_rel[INPUT_AXIS__MAX] = { diff --git a/monitor.c b/monitor.c index e7e7ae2..61b7089 100644 --- a/monitor.c +++ b/monitor.c @@ -1390,6 +1390,8 @@ static void hmp_mouse_button(Monitor *mon, const QDict *qdict) [INPUT_BUTTON_LEFT] = MOUSE_EVENT_LBUTTON, [INPUT_BUTTON_MIDDLE] = MOUSE_EVENT_MBUTTON, [INPUT_BUTTON_RIGHT] = MOUSE_EVENT_RBUTTON, + [INPUT_BUTTON_SIDE] = MOUSE_EVENT_SBUTTON, + [INPUT_BUTTON_EXTRA] = MOUSE_EVENT_EBUTTON, }; int button_state = qdict_get_int(qdict, "button_state"); diff --git a/qapi-schema.json b/qapi-schema.json index 2e31733..74096ce 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -3667,7 +3667,7 @@ # x-input-send-event is promoted out of experimental status. ## { 'enum' : 'InputButton', - 'data' : [ 'Left', 'Middle', 'Right', 'WheelUp', 'WheelDown' ] } + 'data' : [ 'Left', 'Middle', 'Right', 'WheelUp', 'WheelDown', 'WheelLeft', 'WheelRight', 'Side', 'Extra' ] } ## # @InputAxis diff --git a/ui/input-linux.c b/ui/input-linux.c index 2e92c21..a6bf766 100644 --- a/ui/input-linux.c +++ b/ui/input-linux.c @@ -212,6 +212,11 @@ static void input_linux_event_mouse(void *opaque) case BTN_GEAR_DOWN: qemu_input_queue_btn(NULL, INPUT_BUTTON_WHEELDOWN, event.value); + case BTN_EXTRA: + qemu_input_queue_btn(NULL, INPUT_BUTTON_EXTRA, event.value); + break; + case BTN_SIDE: + qemu_input_queue_btn(NULL, INPUT_BUTTON_SIDE, event.value); break; }; break;