conf: add N-Trig DuoSense to our matched devices

That device has a pen and an eraser tool, as well as a touch device. Handle it
with the wacom driver by default, the evdev driver isn't quite up to scratch
here.

This also fixes a missing match in the .fdi file for the base N-Trig devices -
just in case.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Have Lenovo "ISD-V4" (0x6004) sensor use wacom driver

https://bugs.freedesktop.org/show_bug.cgi?id=66891

Signed-off-by: Jason Gerecke <killertofu@gmail.com>
Fix type mismatch in test suite

Add CONST which expands to either 'const' or nothing depending
on ABI version.
This eliminates a compiler error.

Signed-off-by: Egbert Eich <eich@suse.com>
Reviewed-by: Jason Gerecke <killertofu@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Fix loads of 'redundand declaration' warnings in test suite

Most symbols in fake-symbols.h were already declared in the
Xserver header files from the SDK which are also included.
These produce loads of compiler warnings.
The few remaining ones can be added by including xf86_OSproc.h
and exevents.h.
Then then all function declarations for the stub functions
can be deleted.
Relying on SDK provided headers makes providing stub functions
cumbersome due to frequent non-atomic API/ABI changes.
To work around this one would have to avoid SDK headers completely,
though.

Signed-off-by: Egbert Eich <eich@suse.com>
Reviewed-by: Jason Gerecke <killertofu@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Add missing symbol xf86PrintChipsets() for test suite

Signed-off-by: Egbert Eich <eich@suse.com>
Reviewed-by: Jason Gerecke <killertofu@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Make tested static functions non-static for test suite

This gets rid of the hack which redefines 'static' to make
every static function in the driver non-static for the test
suite.
Instead we use a macro instead of 'static' in the function definition
of each function used in the test suite which we can set to empty
when compiling the test suite.
At the same time we create a declaration for each of those functions
which gets us rind of about a bazillion compiler warnings.

Signed-off-by: Egbert Eich <eich@suse.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Fix warning about discarding 'const' qualifier

Signed-off-by: Egbert Eich <eich@suse.com>
Reviewed-by: Jason Gerecke <killertofu@gmail.com>
Fix '-Wuninitialized' warnings

Pinning variables to some value to fix warning about uninitialized
variable.

Signed-off-by: Egbert Eich <eich@suse.com>
Reviewed-by: Jason Gerecke <killertofu@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Fix spurious '-Wshadow' warning

Signed-off-by: Egbert Eich <eich@suse.com>
Reviewed-by: Jason Gerecke <killertofu@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Get rid of spurious 'format not a string literal' warnings

With '-Wformat-nonliteral' gcc kindly warns us that it cannot check the
arguments of a scanf statement as the format string is not literal.
This happens if the format string itself is pointer.
Since the list of format strings only has two elements the same thing
can be achieved in code directly.

Signed-off-by: Egbert Eich <eich@suse.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jason Gerecke <killertofu@gmail.com>
Remove test if pressure falls below the minPressure

This code is entirely irrelevant as it is called immediately after
rebasePressure() which already ensures that minPressure is the
minimum of minPressure and current pressure unless one mistrusts
the implementation of min().

Signed-off-by: Egbert Eich <eich@suse.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Avoid 'division by zero' in xf86ScaleAxis()

If minPressure == wcmMaxZ then the range left to scale is 0. Catch
this condition and act appropriately.

Signed-off-by: Egbert Eich <eich@suse.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jason Gerecke <killertofu@gmail.com>
Add more detailed messaging in code that handles abnormal situations

Log which serial numbers have been force-proxied out.

Signed-off-by: Egbert Eich <eich@suse.com>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
Log when the pen device appears to be too worn out

Worn out pens have an initial pressure != 0. If this pressure
persists while the pen is in proximity and still exists when
going out of proximity, warn about worn out tool.
Some devices seem to send a zero pressure when going out of
proximity. Thus we record the last pressure when still in
proximity.
Also we count the number of events we have received while in
proximity so the risk of false reports on 'quick taps' is lower.

This condition may also occur intermittently on abusive operation.

Signed-off-by: Egbert Eich <eich@suse.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Free (WacomToolPtr)->name when freeing the tool list

Currently the name member is set in wcmParseSerials() only, however
it is dynamically allocated. thus free it when destroying the structure
which contains it.

Signed-off-by: Egbert Eich <eich@suse.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
configure: both clients and drivers need the protocol headers

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Jason Gerecke <killertofu@gmail.com>
Add includes to isdv4.h

The header should include what it needs, not rely on other files to include
the required bits.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Jason Gerecke <killertofu@gmail.com>
isdv4: inline all isdv4 parsing functions

Stops compiler warning if any of them aren't used.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Jason Gerecke <killertofu@gmail.com>
tools: rearrange serial settings

If the device was't properly closed/reset after a crash, tcgetattr() will
fail. Ignore that error and apply the settings we want nonetheless, in most
cases the device will just come back normally.

And to do so, merge setting the baud rate together with the rest so we only
have one call. Otherwise we can't apply the baud rate settings without
potentially submitting garbage to the driver.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Jason Gerecke <killertofu@gmail.com>
tools: open serial devices with O_NOCTTY

Probably doesn't make much difference, but won't hurt if we ever send the
wrong path name.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Jason Gerecke <killertofu@gmail.com>