Re: multitouch support in wsmouse 1/3

2016-03-19 Thread Ulf Brosziewski

It isn't possible to leave all of the existing code intact,
at least not for touchpads, which form the most complex and
critical case here. Either all of them run with the modified
synaptics driver, or they don't. I don't see a reasonable
solution in between (wsconscomm.c might become a little monster
otherwise).

This leaves the option of running mouse and touch panel
drivers with wsmouse_input, as before, and restrict the changes
to the touchpad drivers. This could provide a kind of "fallback"
in case of serious regressions, and the trivial parts of
the "drivers" diff could be removed. If this is what you want,
I could prepare it, but it would take a few days.


On 03/17/2016 01:58 PM, Martin Pieuchot wrote:

On 13/03/16(Sun) 18:37, Ulf Brosziewski wrote:

The diffs below are a rewrite of the input-processing part of wsmouse. It
adds support for multitouch input.

I have split the set of diffs into three parts and I will post part 2 and 3
in separate messages. Part 1 below contains all patches for wscons, part 2
is for the hardware drivers, part 3 is a patch for the synaptics driver in
xenocara (compiling that driver will require the modified version of
wsconsio.h in /usr/include/dev/wscons).


I'm really afraid because this is just a single diff split in 3, they
are not independent.  Plus since your original mails included a broken
diff I doubt anybody tried it.

That said you've done some great work and I like it a lot.

Could you prepare a diff with all the new stuff that does do change
anything in the existing code?  This could go in directly.

Which hardware still need to be tested?






Re: multitouch support in wsmouse 1/3

2016-03-19 Thread Ulf Brosziewski

There are whitespace errors in the diffs. In case anyone
wants to test them, please use the new versions in the
attachment.

On 03/13/2016 06:37 PM, Ulf Brosziewski wrote:

The diffs below are a rewrite of the input-processing part of wsmouse. It
adds support for multitouch input.

[...]


mtsupport.tgz
Description: application/compressed-tar


Re: multitouch support in wsmouse 1/3

2016-03-19 Thread Joerg Jung

> On 17 Mar 2016, at 13:58, Martin Pieuchot  wrote:
> 
> On 13/03/16(Sun) 18:37, Ulf Brosziewski wrote:
>> The diffs below are a rewrite of the input-processing part of wsmouse. It
>> adds support for multitouch input.
>> 
>> I have split the set of diffs into three parts and I will post part 2 and 3
>> in separate messages. Part 1 below contains all patches for wscons, part 2
>> is for the hardware drivers, part 3 is a patch for the synaptics driver in
>> xenocara (compiling that driver will require the modified version of
>> wsconsio.h in /usr/include/dev/wscons).
> 
> I'm really afraid because this is just a single diff split in 3, they
> are not independent.  Plus since your original mails included a broken
> diff I doubt anybody tried it. 
> 
> That said you've done some great work and I like it a lot.
> 
> Could you prepare a diff with all the new stuff that does do change

I guess you wanted to write s/does/doesn’t/ above.
Other than that, yes I agree that would be the right direction.

> anything in the existing code?  This could go in directly.
> 
> Which hardware still need to be tested?
> 



Re: multitouch support in wsmouse 1/3

2016-03-18 Thread Martin Pieuchot
On 13/03/16(Sun) 18:37, Ulf Brosziewski wrote:
> The diffs below are a rewrite of the input-processing part of wsmouse. It
> adds support for multitouch input.
> 
> I have split the set of diffs into three parts and I will post part 2 and 3
> in separate messages. Part 1 below contains all patches for wscons, part 2
> is for the hardware drivers, part 3 is a patch for the synaptics driver in
> xenocara (compiling that driver will require the modified version of
> wsconsio.h in /usr/include/dev/wscons).

I'm really afraid because this is just a single diff split in 3, they
are not independent.  Plus since your original mails included a broken
diff I doubt anybody tried it. 

That said you've done some great work and I like it a lot.

Could you prepare a diff with all the new stuff that does do change
anything in the existing code?  This could go in directly.

Which hardware still need to be tested?



multitouch support in wsmouse 1/3

2016-03-13 Thread Ulf Brosziewski

The diffs below are a rewrite of the input-processing part of wsmouse. It
adds support for multitouch input.

I have split the set of diffs into three parts and I will post part 2 and 3
in separate messages. Part 1 below contains all patches for wscons, part 2
is for the hardware drivers, part 3 is a patch for the synaptics driver in
xenocara (compiling that driver will require the modified version of
wsconsio.h in /usr/include/dev/wscons).

For those who had a look at the test version from December: The code for
the internal touchpad driver ("wstpad") is not included here, I intend
to add and present it again later. Apart from that there are only minor
changes. I have moved the input-processing functions into wsmouse.c,
renamed various things, and improved the tracking functions and the
handling of overflows of the event queue.

The wsmouse_input function has been removed. Hardware drivers make one
or more calls to the new "state-reporting" functions of wsmouse (see
wsmousevar.h), and signal that a frame is complete by calling
wsmouse_input_sync, which generates the wscons events. Roughly, the set
of functions corresponds to the different types of state: button state,
relative motion, absolute positions, single-touch state, and (MT) slot
state. "Standard" combinations of calls are covered by the macros
WSMOUSE_INPUT and WSMOUSE_TOUCH. There is also a more generic function
which can be used for less common inputs or requirements (wsmouse_set).

I assume that support for multi-user touch devices is not required, the
maximal number of MT slots is defined in wsmousevar.h as 10. The technical
limit is sizeof(u_int) * 8.

The MT structures in wsmouse must be initialized with a call to
wsmouse_mt_init.  Drivers for MT devices that associate touches with
"tracking IDs" can use wsmouse_id_to_slot() to assign or to look up slot
numbers, and call wsmouse_mtstate subsequently. hidmt may be a driver that
needs it. Drivers for MT devices that don't provide "MT tracking" - ubcmtp,
for example - must collect the contact points in an array of mtpoint
structures and pass it to wsmouse_mtframe, which computes a matching with
the points of the last frame and calls wsmouse_mtstate internally.

Currently MT state is always converted into a single-touch representation,
and wscons events are generated accordingly. No MT events have been defined
yet. However, minor changes in the set of events are necessary to make the
new code work cleanly with the synaptics driver (see 3/3).

I will comment on some more details in the next messages.

And, yes, this is a request for OKs.


Index: dev/wscons/wsmousevar.h
===
RCS file: /cvs/src/sys/dev/wscons/wsmousevar.h,v
retrieving revision 1.8
diff -u -p -r1.8 wsmousevar.h
--- dev/wscons/wsmousevar.h 21 Dec 2014 18:16:07 -  1.8
+++ dev/wscons/wsmousevar.h 12 Mar 2016 20:42:48 -
@@ -32,6 +32,22 @@
  */

 /*
+ * Copyright (c) 2015, 2016 Ulf Brosziewski
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
  * WSMOUSE interfaces.
  */

@@ -64,14 +80,151 @@ struct wsmousedev_attach_args {
  */
 intwsmousedevprint(void *, const char *);

+
+/* Process standard mouse input. */
+#define WSMOUSE_INPUT(sc_wsmousedev, btns, dx, dy, dz, dw) \
+   do {\
+   wsmouse_buttons((sc_wsmousedev), (btns));   \
+   wsmouse_motion((sc_wsmousedev), (dx), (dy), (dz), (dw));\
+   wsmouse_input_sync(sc_wsmousedev);  \
+   } while (0)
+
+
+/* Process standard touchpad input. */
+#define WSMOUSE_TOUCH(sc_wsmousedev, btns, x, y, pressure, contacts)   \
+   do {\
+   wsmouse_buttons((sc_wsmousedev), (btns));   \
+   wsmouse_position((sc_wsmousedev), (x), (y));\
+   wsmouse_touch((sc_wsmousedev), (pressure), (contacts)); \
+   wsmouse_input_sync(sc_wsmousedev);  \
+   } while (0)
+
+
+/*
+ * Drivers for touchpads that don't report pressure values can pass
+ * WSMOUSE_DEFAULT_PRESSURE to wsmouse_touch or wsmouse_mtstate.
+ *
+ * A pressure value of 0