[Spice-devel] spice-vdagent: how to enable additional mouse buttons?
bruts at netc.fr
bruts at netc.fr
Mon May 11 15:24:44 UTC 2020
Hi Uri,
Ok that's probably a bridge too far for me without any help from a developer...
Any chance I could get this help you think, or will I have to wait until future release when this might be implemented?
As I wrote in the first post, my thumb is kind of addicted to the BACK button (button 8) on my mouse and it gives just too much frustration
using Spice on qemu-kvm if I keep clicking that button in any guest without a result...
What help/advise could you give me on top of what you already did?
Your help is/has been appreciated!
Cheers!
De : Uri Lublin <uril at redhat.com>
À : bruts at netc.fr;
spice-devel at lists.freedesktop.org
Sujet : Re: [Spice-devel] spice-vdagent: how to enable additional mouse buttons?
Date : 11/05/2020 17:15:31 Europe/Paris
On 5/11/20 4:47 PM, bruts at netc.fr wrote:
>
>
> Uri,
>
>
>
> Would it be as simple as adding:
>
>
>
> ioctl(uinput->fd, UI_SET_KEYBIT, BTN_BACK);
>
> ioctl(uinput->fd, UI_SET_KEYBIT, BTN_FORWARD);
>
>
>
> and re-compiling / testing?
I'm sorry, but it is not that simple.
That's the agent side.
You also need the client side, and
to add those buttons to the protocol (including client/server, possibly
with a proper capability).
Uri.
>
>
>
> I am not an experienced coder and have not had the time yet to get a good overview of the spice-vdagent code, so this might be a too simple approach.
>
>
>
> I guess all of these values might be tested:
>
>
>
> #define BTN_MISC 0x100
> #define BTN_0 0x100
> #define BTN_1 0x101
> #define BTN_2 0x102
> #define BTN_3 0x103
> #define BTN_4 0x104
> #define BTN_5 0x105
> #define BTN_6 0x106
> #define BTN_7 0x107
> #define BTN_8 0x108
> #define BTN_9 0x109
>
> #define BTN_MOUSE 0x110
> #define BTN_LEFT 0x110
> #define BTN_RIGHT 0x111
> #define BTN_MIDDLE 0x112
> #define BTN_SIDE 0x113
> #define BTN_EXTRA 0x114
> #define BTN_FORWARD 0x115
> #define BTN_BACK 0x116
> #define BTN_TASK 0x117
>
>
>
> Is there any way to test the btn value? Like xev is not showing me anything related to this value?
>
>
>
> Your input is appreciated!
>
>
>
> Thanks
>
>
>
>
>
> De : Uri Lublin <uril at redhat.com>
> À : bruts at netc.fr;
> spice-devel at lists.freedesktop.org
> Sujet : Re: [Spice-devel] spice-vdagent: how to enable additional mouse buttons?
> Date : 11/05/2020 15:23:30 Europe/Paris
>
> On 5/11/20 4:08 PM, bruts at netc.fr wrote:
>> Hi,
>>
>>
>>
>> Yes most likely.
>>
>> I find these lines of code:
>>
>>
>>
>> /* buttons */
>> ioctl(uinput->fd, UI_SET_EVBIT, EV_KEY);
>> ioctl(uinput->fd, UI_SET_KEYBIT, BTN_LEFT);
>> ioctl(uinput->fd, UI_SET_KEYBIT, BTN_MIDDLE);
>> ioctl(uinput->fd, UI_SET_KEYBIT, BTN_RIGHT);
>>
>> /* wheel */
>> ioctl(uinput->fd, UI_SET_EVBIT, EV_REL);
>> ioctl(uinput->fd, UI_SET_RELBIT, REL_WHEEL);
>>
>>
>> I will probably need to declare the additional mouse buttons of my mouse (Logitech G403), so I run xev to find some information:
>>
>>
>>
>> (BTN_LEFT, BTN_RIGHT, button 8, button 9)
>>
>>
>>
>> ButtonPress event, serial 48, synthetic NO, window 0x3000001,
>> root 0x3ad, subw 0x0, time 361327, (127,94), root:(128,144),
>> state 0x0, button 1, same_screen YES
>>
>> ButtonRelease event, serial 48, synthetic NO, window 0x3000001,
>> root 0x3ad, subw 0x0, time 361426, (127,94), root:(128,144),
>> state 0x100, button 1, same_screen YES
>>
>> ButtonPress event, serial 48, synthetic NO, window 0x3000001,
>> root 0x3ad, subw 0x0, time 362448, (127,94), root:(128,144),
>> state 0x0, button 3, same_screen YES
>>
>> ButtonRelease event, serial 48, synthetic NO, window 0x3000001,
>> root 0x3ad, subw 0x0, time 362556, (127,94), root:(128,144),
>> state 0x400, button 3, same_screen YES
>>
>> ButtonPress event, serial 48, synthetic NO, window 0x3000001,
>> root 0x3ad, subw 0x0, time 366829, (127,94), root:(128,144),
>> state 0x0, button 8, same_screen YES
>>
>> ButtonRelease event, serial 48, synthetic NO, window 0x3000001,
>> root 0x3ad, subw 0x0, time 366949, (127,94), root:(128,144),
>> state 0x0, button 8, same_screen YES
>>
>> ButtonPress event, serial 48, synthetic NO, window 0x3000001,
>> root 0x3ad, subw 0x0, time 368093, (127,94), root:(128,144),
>> state 0x0, button 9, same_screen YES
>>
>> ButtonRelease event, serial 48, synthetic NO, window 0x3000001,
>> root 0x3ad, subw 0x0, time 368250, (127,94), root:(128,144),
>> state 0x0, button 9, same_screen YES
>>
>>
>>
>> Now the next question is obvious: how do I adjust the code to add support for button 8,9 ?
>>
>>
>>
>> I thought BTN_LEFT and BTN_RIGHT would be declared in uinput.h but they are global variables? or where are they declared?
>
> I found them in
> /usr/include/linux/input-event-codes.h.
> There is also BTN_BACK but I'm not sure it's mapped to any of button-8
> or 9.
>
> Uri.
>
>>
>> Any help with adding support for these buttons would be very appreciated and finally make me stop using virtualbox lol.
>>
>> Thanks!
>>
>>
>>
>>
>>
>>
>>
>> De : Uri Lublin <uril at redhat.com>
>> À : bruts at netc.fr;
>> spice-devel at lists.freedesktop.org
>> Sujet : Re: [Spice-devel] spice-vdagent: how to enable additional mouse buttons?
>> Date : 03/05/2020 17:33:55 Europe/Paris
>>
>> On 5/1/20 3:51 PM, bruts at netc.fr wrote:
>>>
>>> I am using spice-vdagent on most of my qemu-kvm vm's, while this is very
>>> convenient, mouse button 8 and 9 are not working (those are the side
>>> buttons of the mouse, one is often used for BACK function of the
>>> browser, which my thumb is actually addicted to).
>>> How could i make these buttons work with spice-vdagent?
>>
>> Hi,
>>
>> Currently 5 mouse buttons are supported. I think some code is needed to
>> be added in order to support more buttons.
>>
>> Uri.
>>
>>>
>>> Thanks for the suggestions,
>>>
>>> Bruts
>>
>>
>>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20200511/8ed7c8c6/attachment.htm>
More information about the Spice-devel
mailing list