Commit graph

139 commits

Author SHA1 Message Date
Peter Hutterer
e3d04088bd tools: print axes, but not capabilities on proximity out
Print the axis values on proximity out because it a) ensures we have the right
values and b) makes the output better aligned with the proximity in, so it's
easier to spot in a log file. But don't print the tool capabilities because
they're unrelated to the prox out anyway and again it makes the output easier
to spot.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-03-22 10:48:43 +10:00
Peter Hutterer
07ce6c8954 tools: fix printing of tablet coordinates
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-03-01 09:34:46 +10:00
Peter Hutterer
451c6913e5 tools: add "--quiet" option to only log libinput messages
Supresses any printf statements from the tool itself, i.e. it skips printing
any of the events.

Makes it easier to debug the internal state since it's not intermixed with a
whole lot of messages about the events that are generated. Best combined with
--verbose (yes, hilarious, isn't it...)

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Hans de Goede <hdegoede@redhat.com>
2017-02-24 16:11:46 +10:00
Peter Hutterer
a6b550cb78 tools: print the key as -1 for obfuscated keys
Missing from 8c1aa1de where we hid the human-readable parts but the keycode
itself is still enough information to recover the typed bits.
Print it as -1 as that keycode doesn't exist for real keys so it stands out
nicely.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-02-21 11:24:08 +10:00
Peter Hutterer
63fcf46951 tools: don't print device options on device removed
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-02-14 09:07:33 +10:00
Peter Hutterer
8c1aa1de00 tools: hide key codes by default
libinput-debug-events prints keycodes as they come in. This makes it dangerous
to be run by users (especially in the background) because it will leak
sensitive information as it is typed. Obfuscate the base set of keycodes
by default, require a --show-keycodes switch to show it.

The few times we actually need the keycodes, we can run the switch in the
debugging tool.

This does not affect keys outside of the main block on the keyboard (F-keys,
multimedia keys).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2017-02-14 07:53:22 +10:00
James Ye
1f0223e9fd Add a "switch" interface for parts of the SW_* range
This will allow switch devices known to libinput to be exposed. Currently,
this is SW_LID.

libinput also handles switch events internally, e.g. a laptop touchpad will
be disabled autmoatically when the lid is closed. This is transparent to
the caller, although the caller will also receive the event. See
https://bugs.freedesktop.org/show_bug.cgi?id=86223
This features is intended to be the main driver for the interface.

Co-Authored-By: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: James Ye <jye836@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-01-26 14:44:04 +10:00
Peter Hutterer
857411f84e Add wheel tilt as axis source
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2017-01-04 15:15:27 +10:00
Peter Hutterer
51e35d72ec tools: reduce some spacing to compress the output a bit
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-01-03 10:32:51 +10:00
Peter Hutterer
589e320df6 tools: align device notify output better
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-01-03 10:14:52 +10:00
Peter Hutterer
c92213e24c tools: size in mm is enough, no need for sub-mm precision here
Also changes from W/H to WxH format

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-01-03 10:14:48 +10:00
Peter Hutterer
cff370fcd0 tools: print pointer axis source in event-debug
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-11-29 12:14:05 +10:00
Eric Engestrom
9f11610eff tools: change pointer to void
This makes it clear that it's not meant to be dereferenced.

CC: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-09-16 08:27:49 +10:00
Peter Hutterer
b3e9303449 tools: prefix debug output with '-' on device changes
We print the sysname, but it's not always obvious when there's an event from
another device within the stream from another device. Prefix it so it's easier
to spot and search for.

See https://bugzilla.redhat.com/show_bug.cgi?id=1364850#c3 for an example of
how such an event can hide.

We only use last_device for comparing pointer values so we don't need a
reference to the device, it doesn't matter if the device itself goes out of
scope.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-09-08 15:56:15 +10:00
Peter Hutterer
3c113111fa Remove LIBINPUT_EVENT_TABLET_PAD_MODE event
Unimplemented and it wasn't supposed to be in the series.

https://lists.freedesktop.org/archives/wayland-devel/2016-June/029376.html

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Carlos Garnacho <carlosg@gnome.org>
2016-07-11 11:00:51 +10:00
Peter Hutterer
6583f4bb53 pad: Add a new API for modes and mode groups
Move mode control to libinput. This reduces some flexibility on what we can do
with modes but makes it a lot easier for anyone to implement modes correctly
and have the LEDs apply appropriately, etc. Let's go with the option to make
the 95% use-case easy. Note: whether the mode is actually used is up to the
caller, e.g.  under Windows and OS X the mode only applies to the
rings/strips, not the buttons.

A tablet pad has 1 or more mode groups, all buttons/ring/strips are assigned
to a mode group. That group has a numeric mode index and is hooked to the
LEDs. libinput will switch the LEDs accordingly.

The mode group is a separate object. This allows for better APIs when it comes
to:
* checking whether a button/ring/strip is part of a mode group
* checking whether a button will trigger a mode transition

and in the future potentially:
* checking which mode transition will happen
* setting which button should change the mode transition
* changing what type of mode transition should happen.
* moving a button from one mode group to the other

This patch adds the basic scaffolding, without any real implementation.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Proofread-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com>
Reviewed-by: Carlos Garnacho <carlosg@gnome.org>
2016-06-22 11:57:07 +10:00
Peter Hutterer
7b73269d74 tools: print the pad capabilities
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-05-26 08:45:29 +10:00
Peter Hutterer
b2a3706948 Add the LIBINPUT_DEVICE_CAP_TABLET_PAD capability and matching interface
This interface handles the buttons on the physical tablet itself, including
the touch ring and the strip.

A notable difference to other libinput interfaces here is that we do not use
linux/input.h event codes for buttons. Instead, the buttons are merely
numbered sequentially, starting at button 1. This means:
* the API is different, instead of get_button() we have get_button_number() to
  drive the point home
* there is no seat button count. pads are inherently different devices and
  compositors should treat them as such. The seat button count makes sense
  when you want to know how many devices have BTN_LEFT down, but it makes no
  sense for buttons where all the semantics are handled by the compositor
  anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com>
Reviewed-by: Carlos Garnacho <carlosg@gnome.org>
2016-04-18 09:12:02 +10:00
Peter Hutterer
ecd6a0803e tools: print the button name for tablet button events
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-04-08 11:11:15 +10:00
Peter Hutterer
cbf775ba3d tools: fix output to say TABLET_TOOL instead of just tablet
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-05 15:34:25 +10:00
Peter Hutterer
91a568d1a1 Merge branch 'master' into tablet-support 2016-01-19 12:02:51 +10:00
Peter Hutterer
fec99a28e3 tools: print the button name too, not just the code
new output:
event4 	POINTER_BUTTON    +0.84s	BTN_RIGHT (273) released, seat count: 0

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-01-11 10:11:54 +10:00
Peter Hutterer
0b124a1a5d tablet: insert "STATE" into proximity/tip states
Makes it even longer, but at least it's consistent with button and key state.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com>
2016-01-06 11:02:40 +10:00
Peter Hutterer
f96ee412df tablet: reduce event deltas to only apply to the wheel
Part of the big revamp to get rid of libinput_tablet_tool_axis and
replace it with a set of axis-specific APIs.

Only the rel wheel has true delta events, everything else is a delta
calculated by libinput based on the previous position. Since we supply that
position to the callers anyway, they can determine that delta themselves
where needed.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Lyude <cpaul@redhat.com>
2015-12-21 07:59:00 +10:00
Peter Hutterer
828ca69c77 tablet: rename libinput_tablet_tool_has_axis into an axis-specific API set
Part of the big revamp to get rid of libinput_tablet_tool_axis and
replace it with a set of axis-specific APIs.

Note that this commit drops the ability to check whether a tablet has an x or
y axis. If it doesn't, libinput won't initialize the tablet anyway so this was
superfluous already.

Likewise with the tilt axes - either we have x and y tilt or we have neither,
so separate checks for tilt_x and tilt_y is unnecessary.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Lyude <cpaul@redhat.com>
2015-12-21 07:59:00 +10:00
Peter Hutterer
e5a33086bc tablet: rename axis_get_value into an axis-specific API set
Second part of the big revamp to get rid of libinput_tablet_tool_axis and
replace it with a set of axis-specific APIs.

Note that this commit drops the ability to get the absolute value from a
relative wheel. The previous API always returned 0 for this case, it is not
needed anymore.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Lyude <cpaul@redhat.com>
2015-12-21 07:59:00 +10:00
Peter Hutterer
5c9c481047 tablet: rename axis_has_changed into an axis-specific API set
First part of the big revamp to get rid of libinput_tablet_tool_axis and
replace it with a set of axis-specific APIs.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Lyude <cpaul@redhat.com>
2015-12-21 07:59:00 +10:00
Peter Hutterer
0c6f505ae6 tools: print the wheel axis delta, not the axis value
The axis value for a rel wheel is always 0

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-12-14 10:29:37 +10:00
Peter Hutterer
eb9b05f407 Merge branch 'master' into tablet-support 2015-12-09 10:19:47 +10:00
Peter Hutterer
3d39dbc3f2 tools: print which scroll axis we have in event-debug
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-12-07 11:57:20 +10:00
Peter Hutterer
8be0813e17 tablet: drop the tool type 'finger' from the tablet interface
If it's a finger, it's a touchscreen or a touchpad, not a tablet.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-12-02 11:06:27 +10:00
Peter Hutterer
5074b59241 Merge branch 'master' into tablet-support 2015-11-24 15:18:47 +10:00
Peter Hutterer
abb98d5738 tablet: rename the libinput_tool calls to libinput_tablet_tool
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-11-18 12:13:54 +10:00
Peter Hutterer
a10e92849c tablet: rename libinput_event_tablet to libinput_event_tablet_tool
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-11-18 12:13:54 +10:00
Peter Hutterer
2cfd52244a tablet: rename LIBINPUT_EVENT_TABLET to LIBINPUT_EVENT_TABLET_TOOL
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-11-18 12:13:54 +10:00
Peter Hutterer
b1b676e24a tablet: rename the tablet capability to a tablet_tool capability
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-11-18 12:13:54 +10:00
Peter Hutterer
759ef04465 tablet: rename TOOL_TIP to TABLET_TOOL_TIP
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-11-18 12:13:54 +10:00
Peter Hutterer
7123c37f1c tablet: rename tool_tip_state to tablet_tool_tip_state
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-11-18 12:13:53 +10:00
Peter Hutterer
cc2b45dd50 tablet: rename TOOL_PROXIMITY_ to TABLET_TOOL_PROXIMITY
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-11-18 12:13:53 +10:00
Peter Hutterer
a22b94a22c tablet: rename tool_proximity_state to tablet_tool_proximity state
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-11-18 12:13:53 +10:00
Peter Hutterer
c7cb77b36f tablet: rename TOOL_TYPE to TABLET_TOOL_TYPE
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-11-18 12:13:53 +10:00
Peter Hutterer
827abfbb56 tablet: rename the tablet axes to "LIBINPUT_TABLET_TOOL_AXIS_..."
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-11-18 12:13:53 +10:00
Peter Hutterer
cd2cd2f112 tablet: rename libinput_tablet_axis to libinput_tablet_tool_axis
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-11-18 12:13:53 +10:00
Peter Hutterer
98df9eb63f tablet: rename libinput_tool to libinput_tablet_tool
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-11-18 12:13:53 +10:00
Peter Hutterer
1318ffadb5 tablet: split out tip handling into a separate event
The tablet tip works like a button in the kernel but is otherwise not really
a button. Split it into an explicit tip up/down event instead.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-11-12 06:52:51 +10:00
Peter Hutterer
acfff361a7 tools: take the start time before initializing the context
Otherwise events that are already queued before the first libinput_dispatch()
have a negative timestamp.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-11-09 16:06:30 +10:00
Peter Hutterer
4ca8f3b699 tools: print the tool ID in event-debug
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-11-09 15:39:20 +10:00
Peter Hutterer
87926e4ab6 tablet: rename all tool types to LIBINPUT_TOOL_TYPE_*
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com>
2015-11-09 15:37:22 +10:00
Peter Hutterer
4edcd79372 tablet: widen the serial type to uint64_t
Internally we still use uint32_t because that's all we get from evdev. But
eventually we'll have 64 bit serials.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com>
2015-11-05 13:18:33 +10:00
Peter Hutterer
a7bd84a7ee Merge branch 'master' into tablet-support 2015-07-24 10:56:05 +10:00