[Spice-devel] spice-vdagent: how to enable additional mouse buttons?

Uri Lublin uril at redhat.com
Mon May 11 13:23:30 UTC 2020


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
> 
> 
> 



More information about the Spice-devel mailing list