On Sat, Apr 11, 2015 at 03:27:46PM +0200, Hans de Goede wrote: > The Trust TB7300 (relabelled Waltop?) tablet has a scrollwheel which shows > up as a /dev/input/event# node all by itself. Currently input_id does not > set any ID_INPUT_FOO attr on this causing it it to not be recognized by > Xorg / libinput. > > This commit fixes this by marking it with ID_INPUT_KEY. > > Cc: Sjoerd Timmer <the...@randomdata.nl> > Reported-by: Sjoerd Timmer <the...@randomdata.nl> > Signed-off-by: Hans de Goede <hdego...@redhat.com> > --- > src/udev/udev-builtin-input_id.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/src/udev/udev-builtin-input_id.c > b/src/udev/udev-builtin-input_id.c > index ecfc447..f07f86e 100644 > --- a/src/udev/udev-builtin-input_id.c > +++ b/src/udev/udev-builtin-input_id.c > @@ -262,6 +262,13 @@ static int builtin_input_id(struct udev_device *dev, int > argc, char *argv[], boo > test_pointers(dev, bitmask_ev, bitmask_abs, bitmask_key, > bitmask_rel, bitmask_props, test); > test_key(dev, bitmask_ev, bitmask_key, test); > + /* > + * The scrollwheel on some devices is a device all by itself, > + * treat this as a keyboard with just a scrollwheel. > + */ > + if (bitmask_ev[0] == (BIT(EV_REL) | BIT(EV_SYN)) && > + bitmask_rel[0] == (bitmask_rel[0] & (BIT(REL_WHEEL) | > BIT(REL_HWHEEL)))) > + udev_builtin_add_property(dev, test, "ID_INPUT_KEY", > "1");
A simpler approach would be to return a value from test_pointers() if we set anything there and then use that: is_pointer = test_pointers(.....); is_keyboard = test_key(); if (!is_pointer && !is_keyboard && test_bit(EV_REL) && (test_bit(REL_WHEEL) || test_bit(REL_HWHEEL))) udev_builtin_add_property(); I also wonder what the side effect is of setting ID_INPUT_KEY on a device without EV_KEY but I can't really come up with a better tag (short of introducing a completely new one). Cheers, Peter > } > > devnode = udev_device_get_devnode(dev); > -- > 2.3.4 > _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel