Re: spice-vdagent: how to enable additional mouse buttons?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Uri (and others),

I found the similar question in a few corners of the internet and I think adding at least the additional default mouse buttons should not be all that much work.
With some guidance I could probably do it myself, though the guidance would need to be quite substantial :)
The mouse and the main buttons is already forwarded and that is the main part.
with xev it is clear to see which buttons work on the host, but not on the guest.
Anyone with some spare time (which I know is always limited for everyone), but help me where to fix this in the code and i will write a patch - or give me a good start - or start yourself.

a semi working mouse in the guest is very annoying and can be one of the critical points why to use spice (or not) - at least i know it is in my case.

Thanks!!



De : Uri Lublin <uril@xxxxxxxxxx>
À : bruts@xxxxxxx;
   spice-devel@xxxxxxxxxxxxxxxxxxxxx
Sujet : Re: 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@xxxxxxx 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@xxxxxxxxxx>
> À : bruts@xxxxxxx;
>    spice-devel@xxxxxxxxxxxxxxxxxxxxx
> Sujet : Re: 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@xxxxxxx 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@xxxxxxxxxx>
>> À : bruts@xxxxxxx;
>>    spice-devel@xxxxxxxxxxxxxxxxxxxxx
>> Sujet : Re: 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@xxxxxxx 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
>>
>>
>>
>
>
>

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel

[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]