Using smooth scrolling over uinput

Raphael Isemann teemperor at
Sun May 5 15:43:28 PDT 2013

thanks for the information.
I signaled that i have a REL_WHEEL via
ioctl(file_descriptor, UI_SET_EVBIT, EV_REL);
ioctl(file_descriptor, UI_SET_RELBIT, REL_WHEEL);
and i can send REL_WHEEL events that are interpreted as mouse-wheel-"ticks"
but not as the smooth scrolling input i wanted.
Any error i made?

Some furhter information:
I test via scrolling in a GTK+ 3 application that supports smooth scrolling
via touchpad.

(evdev is version 2.7.0 and HAVE_SMOOTH_SCROLLING is also correctly defined
as 1 in the source of my package).
Relevant part of my source regarding the scrolling:
int uinput_gerbil_setup (void) {
    uinput_gerbil_fd = open("/dev/uinput", O_WRONLY);

    if (uinput_gerbil_fd < 0) {
             return 1;

    /* set input device capabilities */
    ioctl(uinput_gerbil_fd, UI_SET_EVBIT, EV_SYN);
    ioctl(uinput_gerbil_fd, UI_SET_EVBIT, EV_REL);
    ioctl(uinput_gerbil_fd, UI_SET_RELBIT, REL_X);
    ioctl(uinput_gerbil_fd, UI_SET_RELBIT, REL_Y);
    ioctl(uinput_gerbil_fd, UI_SET_RELBIT, REL_WHEEL);
    ioctl(uinput_gerbil_fd, UI_SET_EVBIT, EV_KEY);
    ioctl(uinput_gerbil_fd, UI_SET_KEYBIT, BTN_MOUSE);
    ioctl(uinput_gerbil_fd, UI_SET_KEYBIT, BTN_TOUCH);
    ioctl(uinput_gerbil_fd, UI_SET_KEYBIT, BTN_TOOL_DOUBLETAP);

    struct uinput_user_dev dev = {.name = "Gerbil Mouse"};
    write(uinput_gerbil_fd, &dev, sizeof(dev));

    /* create input device */
    ioctl(uinput_gerbil_fd, UI_DEV_CREATE);

    return 0;

void uinput_gerbil_scroll(int val){

    struct input_event ev  = {.type = EV_REL, .code = REL_WHEEL, .value =

2013/5/5 Peter Hutterer <peter.hutterer at>

> On Sun, May 05, 2013 at 02:24:36AM +0200, Raphael Isemann wrote:
> > Hi everybody,
> >
> > i use uinput for sending mouse-input from userland to emulate a mouse.
> Now
> > i want that the REL_WHEEL input is interpreted not as button-presses but
> > rather as a smooth/pixelperfect input.
> >
> > According to that:
> > this is
> > supported in evdev since a while and i only need to mark the axis as
> > scrolling axis ("""Instead, let the
> > driver mark axes as scrolling axes as required.""").
> > But how can i mark the axes? Any hints on useful documentation on that
> > topic or other functions that allow to sent signals that are interpreted
> as
> > smooth scrolling are welcome.
> if you have REL_WHEEL on a device, the evdev driver will mark that as a
> scrolling axis automatically. you don't have to do anything there.
> Cheers,
>    Peter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the xorg mailing list