Mir

Merge lp:~andreas-pokorny/mir/load-all-supported-input-platforms into lp:mir

Proposed by Andreas Pokorny
Status: Merged
Approved by: Andreas Pokorny
Approved revision: no longer in the source branch.
Merged at revision: 3126
Proposed branch: lp:~andreas-pokorny/mir/load-all-supported-input-platforms
Merge into: lp:mir
Prerequisite: lp:~andreas-pokorny/mir/combine-modifier-state-accross-devices
Diff against target: 774 lines (+366/-77)
22 files modified
benchmarks/frame-uniformity/touch_producing_server.cpp (+0/-1)
include/platform/mir/input/platform.h (+2/-2)
include/test/mir_test_framework/executable_path.h (+1/-0)
src/include/server/mir/default_server_configuration.h (+1/-11)
src/include/server/mir/input/input_probe.h (+48/-0)
src/platform/graphics/platform_probe.cpp (+5/-1)
src/platforms/evdev/platform_factory.cpp (+1/-1)
src/platforms/mesa/server/x11/input/input.cpp (+1/-1)
src/server/input/CMakeLists.txt (+1/-0)
src/server/input/default_configuration.cpp (+16/-39)
src/server/input/input_probe.cpp (+104/-0)
src/server/symbols.map (+1/-1)
tests/mir_test_framework/CMakeLists.txt (+1/-0)
tests/mir_test_framework/executable_path.cpp (+10/-0)
tests/mir_test_framework/fake_input_device_impl.cpp (+1/-1)
tests/mir_test_framework/fake_input_server_configuration.cpp (+0/-1)
tests/mir_test_framework/input_testing_server_options.cpp (+0/-1)
tests/mir_test_framework/stub_input.cpp (+2/-2)
tests/mir_test_framework/stub_input_platform.cpp (+1/-1)
tests/umock-acceptance-tests/test_libinput.cpp (+8/-14)
tests/unit-tests/input/CMakeLists.txt (+1/-0)
tests/unit-tests/input/test_input_platform_probing.cpp (+161/-0)
To merge this branch: bzr merge lp:~andreas-pokorny/mir/load-all-supported-input-platforms
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Cemil Azizoglu (community) Approve
Alan Griffiths Abstain
Daniel van Vugt Needs Fixing
Chris Halse Rogers Approve
Review via email: mp+274421@code.launchpad.net

This proposal supersedes a proposal from 2015-10-05.

Commit message

Add automatic searching and probing for input platforms

With this specifying the input platform via --platform-input-lib is no longer necessary, unless the stub input platform that supports attaching fake devices is required

Description of the change

The most notable change of this MP will make the libinput and x11 platform work without additional command line parameter.

This MP adds probing for input platforms. mirserver will now search inside the default platform-path for loadable modules that fulfil the input platform ABI. Then only those modules that claim to be better than 'dummy' will be used. Hence input-stub.so will not be loaded by default, but requires loading through the platform-input-lib parameter.

Next step: remove input reader and event hub..

WRT to testing this MP - or the evdev input platform in general: pick silo-56 for phone images. This will still have problems with the clock (which is fixed by lp:~andreas-pokorny/mir/use-realtime-clock-for-input-events). Xenial already has the right libinput package.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Chris Halse Rogers (raof) wrote : Posted in a previous version of this proposal

+ mir::log_info("Found input driver: %s", desc->name);

Could you also log driver version please?

+ return std::move(platforms);

Pessimisation: this breaks return value optimisation. When the Wily clang builds work again this will be an error.

+ EXPECT_THAT(platforms.size(), Eq(2)); // we cannot disable the default evdev platform with only umock dev is in place
+ EXPECT_THAT(platforms[0].get(), AnyOf(OfType<mi::evdev::Platform>(), OfType<mi::X::XInputPlatform>()));
+ EXPECT_THAT(platforms[1].get(), AnyOf(OfType<mi::evdev::Platform>(), OfType<mi::X::XInputPlatform>()));

Seems like you could replace OfType with OfPointerType and then use

EXPECT_THAT(platforms, UnorderedElementsAre(OfPointerType<mi::evdev::Platform>(), OfPointerType<mi::X::XInputPlatform>());

Which I think is both more natural and also is a slightly stronger test.

========================
Non-review comment:
+ mtf::UdevEnvironment env; // TODO replace with mock_libevdev und mock_libudev when the new input reading stack is the only in use.

Heads up: I think that doing this will provide negative value. Also, und→and :)

review: Needs Fixing
Revision history for this message
Andreas Pokorny (andreas-pokorny) wrote : Posted in a previous version of this proposal

Fixed all of the above.

> ========================
> Non-review comment:
> + mtf::UdevEnvironment env; // TODO replace with mock_libevdev und
> mock_libudev when the new input reading stack is the only in use.
>
> Heads up: I think that doing this will provide negative value. Also, und→and
> :)

I want to simulate the cases no devices found, devices found and some or all can be opened, devices found and none can be opened. I cannot do that with umockdev...

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Chris Halse Rogers (raof) wrote : Posted in a previous version of this proposal

On Thu, Oct 8, 2015 at 5:56 PM, Andreas Pokorny
<email address hidden> wrote:
> Fixed all of the above.
>
>> ========================
>> Non-review comment:
>> + mtf::UdevEnvironment env; // TODO replace with mock_libevdev
>> und
>> mock_libudev when the new input reading stack is the only in use.
>>
>> Heads up: I think that doing this will provide negative value.
>> Also, und→and
>> :)
>
> I want to simulate the cases no devices found, devices found and some
> or all can be opened, devices found and none can be opened. I cannot
> do that with umockdev...

You can do all except the last, and the last would be a simple patch to
umockdev.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Chris Halse Rogers (raof) wrote : Posted in a previous version of this proposal

LGTM

review: Approve
Revision history for this message
Alan Griffiths (alan-griffiths) wrote : Posted in a previous version of this proposal

Looks like infrastructure glitch:

  inflating: package_archive/archive/work/output/libmirclient-debug-extension1_0.17.0bzr2998pkg0wily4303+autopilot0_armhf.deb
error: closed
[timestamp] Start PPAs and local Archive : 2015-10-08T10:09:40+0000
rm: cannot remove 'ppa_sources': No such file or directory

~~~~

(Non blocking) looks like we need to bump the server ABI

Revision history for this message
Alan Griffiths (alan-griffiths) wrote : Posted in a previous version of this proposal

"The most notable change of this MP will make the libinput and x11 platform work without additional command line parameter."

Am I expecting too much?

$ sudo DISPLAY= bin/mir_demo_server --vt 1 --arw-file&
$ bin/mir_demo_server --file mir-socket --host-socket /tmp/mir_socket
[Switch to vt 1]
[Switch to vt 7]

ERROR: /home/alan/display_server/mir/src/platforms/mesa/server/common/display_helpers.cpp(256): Throw in function int mir::graphics::mesa::helpers::DRMHelper::open_drm_device(const std::shared_ptr<mir::udev::Context>&)
Dynamic exception type: boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<std::runtime_error> >
std::exception::what: Error opening DRM device
13, "Permission denied"

It looks as though the nested server is selecting the wrong drivers. (It should "agree" with the host.)

NB I can workaround like this:

$ DISPLAY= bin/mir_demo_server --file mir-socket --host-socket /tmp/mir_socket --launch bin/mir_demo_client_animated_cursor

review: Needs Information
Revision history for this message
Alan Griffiths (alan-griffiths) wrote : Posted in a previous version of this proposal

OK, I don't think the auto-configuration is quite there yet. But this is a step forwards.

I guess there will be an ABI break needed for 0.18.

review: Approve
Revision history for this message
Andreas Pokorny (andreas-pokorny) wrote : Posted in a previous version of this proposal

Oh .. I wasnt aware there is a mismatch between the x11 graphics and input probing.
Soooo.. a host-socket setting should win over a DISPLAY env, shouidnt it?

That should be a simple fix in graphics.cpp.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Approve (continuous-integration)
Revision history for this message
Andreas Pokorny (andreas-pokorny) wrote : Posted in a previous version of this proposal

> Oh .. I wasnt aware there is a mismatch between the x11 graphics and input
> probing.
> Soooo.. a host-socket setting should win over a DISPLAY env, shouidnt it?
>
> That should be a simple fix in graphics.cpp.

Nested.. not as simple as I thought..

Revision history for this message
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal

Landed and then reverted:
* Modifiers don't work any more (can't move/resize windows using Alt)
* Default mouse speed too high
* A little too many log messages come from this.

Only the first issue is a blocker.

review: Needs Fixing
Revision history for this message
Andreas Pokorny (andreas-pokorny) wrote : Posted in a previous version of this proposal

> Landed and then reverted:
> * Modifiers don't work any more (can't move/resize windows using Alt)

Yes modifiers are per device right now .. which isnt what we want within the dispatcher. Working on a proper abstraction/fix for that.

> * Default mouse speed too high

Yay! So mouse acceleration is working. Configuration branches are on the way..

> * A little too many log messages come from this.
>
> Only the first issue is a blocker.

Revision history for this message
Andreas Pokorny (andreas-pokorny) wrote : Posted in a previous version of this proposal

> Landed and then reverted:
> * Modifiers don't work any more (can't move/resize windows using Alt)
> * Default mouse speed too high
> * A little too many log messages come from this.
>
> Only the first issue is a blocker.

This should fix the issue..
https://code.launchpad.net/~andreas-pokorny/mir/combine-modifier-state-accross-devices/+merge/274372

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Chris Halse Rogers (raof) wrote :

I'm still happy with this.

review: Approve
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

Nits:

+#include "mir/module_deleter.h"

 #include <memory>
 #include <string>
+#include <vector>

The other changes to src/include/server/mir/default_server_configuration.h don't justify these additions.

~~~~

- virtual std::shared_ptr<input::Platform> the_input_platform();
     virtual std::shared_ptr<dispatch::MultiplexingDispatchable> the_input_reading_multiplexer();
     virtual std::shared_ptr<input::InputDeviceRegistry> the_input_device_registry();
     virtual std::shared_ptr<input::InputDeviceHub> the_input_device_hub();
@@ -384,8 +385,7 @@
     CachedPtr<input::CompositeEventFilter> composite_event_filter;
     CachedPtr<input::InputManager> input_manager;
     CachedPtr<input::SurfaceInputDispatcher> surface_input_dispatcher;
- CachedPtr<input::DefaultInputDeviceHub> default_input_device_hub; // currently not used by default
- CachedPtr<input::Platform> input_platform; // currently not used by default
+ CachedPtr<input::DefaultInputDeviceHub> default_input_device_hub;

You can also lose the declaration of Platform on line 135.

~~~~~

Probably not something to address in this MP but...

+#ifdef MIR_BUILD_PLATFORM_MESA_X11
+ ON_CALL(mock_x11, XOpenDisplay(_)).WillByDefault(Return(nullptr));
+#endif

Should the test setup really depend on the *build* platform?

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Andreas Pokorny (andreas-pokorny) wrote :
Revision history for this message
Andreas Pokorny (andreas-pokorny) wrote :

^ No longer blocking.. brandon made a similar MP and that landed today.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Andreas Pokorny (andreas-pokorny) wrote :

^
demo server and acceptances tests crash...

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

OK, I've invested time in testing and lots needs fixing unfortunately. At least three are show-stoppers...

(1) Mouse now moves too fast. Even my slowest mouse.

(2) "evdev-input" log messages on startup report nothing useful. Can we remove or change them to report actual device descriptions?

(3) Input resampling has been lost (can only verify on desktop due to #5). It was introduced on 2014-08-29 but we only just fixed Unity8 this week to utilize it and achieve halved latency. It's taken 14 months to come to fruition this week, so please try to avoid regressing on it.
 Test: env MIR_CLIENT_INPUT_RATE=59 mir_demo_client_fingerpaint
           Verify only one square painted per frame.

(4) Input events are strangely erratic and no longer smooth (even when not resampled), compared to lp:mir. Compare 'mir_demo_client_fingerpaint' using this branch with lp:mir and you will see a lot of jitter when using this branch. Weirdly, MIR_CLIENT_INPUT_RATE=59 does affect the result but only in that it makes things even more erratic, and not limited to 59Hz either (#3).

(5) Servers crash on startup on mako (vivid rc-proposed):
[1446022093.989552] <WARNING> mircommon: Failed to load module: bin/../lib/server-modules/input-evdev.so.4 (error was:libinput.so.10: cannot open shared object file: No such file or directory)
[1446022093.989948] mircommon: Loading module: bin/../lib/server-modules/graphics-dummy.so
[1446022094.000600] mircommon: Loading module: bin/../lib/server-modules/input-stub.so
ERROR: /home/dan/bzr/mir/tmp.all/src/server/input/default_configuration.cpp(328): Throw in function mir::DefaultServerConfiguration::the_input_manager()::<lambda()>
Dynamic exception type: N5boost16exception_detail10clone_implINS0_19error_info_injectorISt13runtime_errorEEEE
std::exception::what: No input platforms found

review: Needs Fixing
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

(5) Fixed by installing package 'libinput10' but ...

(6) mir_demo_client_fingerpaint on mako paints very small, indicating the touch_major/touch_minor values are wrong using this branch.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

(7) Multi-touch gestures no longer work (on mako). Try moving a window in mir_proving_server using three fingers and it mostly does nothing, or has a mind of its own. If you run 'mir_demo_client_target' you can see what the problem is with multiple touches: some go missing mid-gesture (flickering targets).

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Although (1) sounds unimportant and not like a blocker, if you fix (1) and remove the default acceleration that libinput introduces, then that might actually fix (4) as well.

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

My issue above fixed. Looks like enough issues remain to be dealt with for me to wait before looking again.

review: Abstain
Revision history for this message
Andreas Pokorny (andreas-pokorny) wrote :

(1) This is the default setting of libinput - 1.1.0 will change that i.e use differnt profiles depending on the mouse or device type. I found the default setting just good..

(2)

(3) There is a known problem with libinput-0.21 in the overlay ppas. Patches are w

(4)

(5) better than hanging the system

(6) they are reported like that from the kernel.. in general to small.. but d

Revision history for this message
Andreas Pokorny (andreas-pokorny) wrote :

oops hit reply to soon..

(3) (4) require a libinput patch that has not yet landed in archive or those ppas. This might be the reason for (7) too.

(6) proper touch screen drivers should report resolution values to allow scaling values to actual units. All touch screen drives that we use only report a resolution of zero. That invalid setting is handled inside libinput and it returns the plain value reported by the kernel. Those values as you have noticed are too small. To come up with proper values we need to have a device dependent scaling. I dont see

Revision history for this message
Andreas Pokorny (andreas-pokorny) wrote :

.. any other client than finger paint use those values at the moment. I do hope that since they are now exposed via libinput that the other display servers and toolkits start to use those. Within the Qt event feeder they are mapped to a rectangular region.. which isnt really accurate either.

Revision history for this message
Andreas Pokorny (andreas-pokorny) wrote :

just checked mako again: (3) (4) and (7) is the same cause - and needs the current libinput patch-set as in:

https://bugs.launchpad.net/ubuntu/+source/libinput/+bug/1504168

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

(3) and (4) were discovered with a mouse on desktop. So any touchscreen fixes will not help (3) and (4). It appears likely that fixing (1), while not a major issue itself, will probably fix (3) and (4). Because (1) is the only reason I can think of for libinput to tinker with the mouse event stream.

Revision history for this message
Andreas Pokorny (andreas-pokorny) wrote :

(2) I just improved logs with lp:~andreas-pokorny/mir/better-input-device-related-logs
We should really consider having something like a severity filter..

Ok I misunderstood (3) and (4) so what I just tried on lp:mir was:

A: Resampling with input-evdev:
export MIR_CLIENT_INPUT_RATE=59
mir_demo_server --platform-input-lib ../lib/server-modules/input-evdev.so.4 --launch-client=./mir_demo_client_fingerpaint

B: Resampling with android input
export MIR_CLIENT_INPUT_RATE=59
mir_demo_server --launch-client=./mir_demo_client_fingerpaint

C: No resampling with input-evdev
export MIR_CLIENT_INPUT_RATE=0
mir_demo_server --platform-input-lib ../lib/server-modules/input-evdev.so.4 --launch-client=./mir_demo_client_fingerpaint

D: No resampling with android input
export MIR_CLIENT_INPUT_RATE=0
mir_demo_server --launch-client=./mir_demo_client_fingerpaint

using a cheap USB MS mouse on top of libinput-1.1.0 with my patches

A and B look nearly identical - mouse moves slightly faster than with android input but there are ugly gaps/jumps .. in both cases every 5 or 10 seconds in the trace drawn by fingerpaint.

C and D look nearly identical - mouse moves slightly faster than with android input but there in both cases the trace displayed is smooth and sticks close to the cursor. Additionally there is no odd jump in both the data sets. As opposed to the resampled cases the plotted squares have a similar distance and give a good indication of mouse movement.

I repeated A and B a few times and I was able to reproduce the odd jumps for A and B sometimes. It seems that the resampling is very sensitive to scheduling. My conclusion from that:
we should make sure that we only use resampling when we have a horrible input device (driver) or when the client is unable to process the user input fast enough. Additionally we should spend the next 14 month with verifying that the algorithm yields proper results.

PS: I did mess with android input in the past and found the bug that disabled the pointer acceleration:
https://code.launchpad.net/~andreas-pokorny/mir/activate-pointer-acceleration
Not sure if it still works..

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

AFAIK, resampling uses the original event timestamps which in android-input are accurate because they come directly from the kernel. So if those timestamps are being faked in libinput then that might explain the irregularity and sensitivity to scheduling. Better check that libinput (and Mir itself) is not inserting new timestamps. Our input reports also rely on those timestamps being the original event time from the kernel.

It's also worth noting my mouse setting is 1000Hz (kernel param usbhid.mousepoll=1). You might need that to notice some issues.

Revision history for this message
Andreas Pokorny (andreas-pokorny) wrote :

> AFAIK, resampling uses the original event timestamps which in android-input
> are accurate because they come directly from the kernel. So if those
> timestamps are being faked in libinput then that might explain the
> irregularity and sensitivity to scheduling. Better check that libinput (and
> Mir itself) is not inserting new timestamps. Our input reports also rely on
> those timestamps being the original event time from the kernel.
>
> It's also worth noting my mouse setting is 1000Hz (kernel param
> usbhid.mousepoll=1). You might need that to notice some issues.

Well whatever you observe I cannot observe that. I see negative effects of resampling with and without libinput involved.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Andreas Pokorny (andreas-pokorny) wrote :

There is now a silo for vivid overlay and this newer libinput package is about to land in xenial:
https://launchpad.net/~ci-train-ppa-service/+archive/ubuntu/landing-056/+packages

With that the known touchscreen troubles are gone - mouse is still fast though (as actually requested by many people)

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

-if(MIR_TEST_PLATFORM STREQUAL "mesa-kms" OR MIR_TEST_PLATFORM STREQUAL "mesa-x11")
+if(MIR_BUILD_PLATFORM_MESA_KMS OR MIR_BUILD_PLATFORM_MESA_X11)
...
+#ifdef MIR_BUILD_PLATFORM_MESA_X11
+ ON_CALL(mock_x11, XOpenDisplay(_)).WillByDefault(Return(nullptr));
+#endif

Should the test setup really depend on the *build* platform? (Or is this poor naming - should MIR_BUILD_PLATFORM_* really be MIR_TARGET_PLATFORM_*)

review: Needs Information
Revision history for this message
Andreas Pokorny (andreas-pokorny) wrote :

> -if(MIR_TEST_PLATFORM STREQUAL "mesa-kms" OR MIR_TEST_PLATFORM STREQUAL
> "mesa-x11")
> +if(MIR_BUILD_PLATFORM_MESA_KMS OR MIR_BUILD_PLATFORM_MESA_X11)
> ...
> +#ifdef MIR_BUILD_PLATFORM_MESA_X11
> + ON_CALL(mock_x11, XOpenDisplay(_)).WillByDefault(Return(nullptr));
> +#endif
>
> Should the test setup really depend on the *build* platform? (Or is this poor
> naming - should MIR_BUILD_PLATFORM_* really be MIR_TARGET_PLATFORM_*)

Yeah rather poor naming. MIR_BUILD_PLATFORM indicates that we build for platform X11 .. to be honest the way autoconf names target, host and build still confuses me regularly.

Good that you mention this. This is one of the things I wanted to have another look.

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

Right. I'll consider it preexisting.

review: Approve
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

Nit:

+struct StubEmergencyCleanupRegistry : mir::EmergencyCleanupRegistry
+{
+ void add(mir::EmergencyCleanupHandler const&) override {}
+};

This needs to implement the other overload.

review: Needs Fixing
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

Also, in the following scenario:

$ sudo bin/mir_demo_server --window-manager system-compositor --display-config sidebyside --vt 1 --arw-file
$ bin/mir_demo_server --host /tmp/mir_socket --display-config clone --window-manager tiling
$ bin/mir_demo_client_egltriangle

I find that Alt+middle-button+drag seems intermittently to not work (neither resizing nor moving the cursor).

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

A bit more detail on the problems I see:

I'm using a lenovo with a trackpoint.

The trackpoint controls the cursor unless the middle "mouse" button is pressed. E.g. Alt+left button drags the triangle, With Alt on its own or with Alt+right it just move the cursor.

Just pressing the middle button (with or without Alt) and the cursor no longer responds to the trackpoint.

It might be diagnostic that the left and right buttons do work, but the middle button doesn't - is something misidentifying it as a two button mouse?

Plugging in a spare 3-button mouse does work.

Revision history for this message
Cemil Azizoglu (cemil-azizoglu) wrote :

613 -if(MIR_TEST_PLATFORM STREQUAL "mesa-kms" OR MIR_TEST_PLATFORM STREQUAL "mesa-x11")
614 +if(MIR_BUILD_PLATFORM_MESA_KMS OR MIR_BUILD_PLATFORM_MESA_X11)

Why is this needed? If the test is being built for Android only why should mesa related stuff be linked in?

review: Needs Information
Revision history for this message
Andreas Pokorny (andreas-pokorny) wrote :

> A bit more detail on the problems I see:
>
> I'm using a lenovo with a trackpoint.
>
> The trackpoint controls the cursor unless the middle "mouse" button is
> pressed. E.g. Alt+left button drags the triangle, With Alt on its own or with
> Alt+right it just move the cursor.
>
> Just pressing the middle button (with or without Alt) and the cursor no longer
> responds to the trackpoint.
>
> It might be diagnostic that the left and right buttons do work, but the middle
> button doesn't - is something misidentifying it as a two button mouse?
>
> Plugging in a spare 3-button mouse does work.

Not quite. I diagnosed that with your evemu record and libinput-debug-events - which is a tool provided by libinput but is not part of the ubuntu libinput package so far.

So by default - it configures your device to use the middle button as scroll-button - so trackpoint motion is converted to scroll axis events while middle button is pressed. You should be able to deactivate that behaviour with the lp:~andreas-pokorny/mir/example-configure-input-devices MP - since it overwrite those settings.

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

> So by default - it configures your device to use the middle button as scroll-
> button - so trackpoint motion is converted to scroll axis events while middle
> button is pressed. You should be able to deactivate that behaviour with the lp
> :~andreas-pokorny/mir/example-configure-input-devices MP - since it overwrite
> those settings.

I tried adding that, but (after a few merge conflicts - I'm a little way off trunk because of the landings backlog) the server exited because if couldn't find an input platform.

I'll try again later. Meanwhile I won't block on a problem that's being worked on elsewhere.

review: Abstain
Revision history for this message
Andreas Pokorny (andreas-pokorny) wrote :

I thought we do not build the unit tests for

> 613 -if(MIR_TEST_PLATFORM STREQUAL "mesa-kms" OR MIR_TEST_PLATFORM
> STREQUAL "mesa-x11")
> 614 +if(MIR_BUILD_PLATFORM_MESA_KMS OR MIR_BUILD_PLATFORM_MESA_X11)
>
> Why is this needed? If the test is being built for Android only why should
> mesa related stuff be linked in?

Back then I got linker errors whithout that depending on the ordering of the MIR_PLATFORM variable. This is no longer the case..

In general we should find a way to avoid the machinery of MIR_TEST_PLATFORM as far as possible.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Cemil Azizoglu (cemil-azizoglu) wrote :

ok

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'benchmarks/frame-uniformity/touch_producing_server.cpp'
--- benchmarks/frame-uniformity/touch_producing_server.cpp 2015-10-05 02:18:18 +0000
+++ benchmarks/frame-uniformity/touch_producing_server.cpp 2015-11-20 15:25:54 +0000
@@ -26,7 +26,6 @@
26#include <functional>26#include <functional>
2727
28namespace mi = mir::input;28namespace mi = mir::input;
29namespace mia = mi::android;
30namespace mg = mir::graphics;29namespace mg = mir::graphics;
31namespace mis = mi::synthesis;30namespace mis = mi::synthesis;
32namespace geom = mir::geometry;31namespace geom = mir::geometry;
3332
=== modified file 'include/platform/mir/input/platform.h'
--- include/platform/mir/input/platform.h 2015-10-12 08:08:58 +0000
+++ include/platform/mir/input/platform.h 2015-11-20 15:25:54 +0000
@@ -91,7 +91,7 @@
91};91};
9292
93typedef mir::UniqueModulePtr<Platform>(*CreatePlatform)(93typedef mir::UniqueModulePtr<Platform>(*CreatePlatform)(
94 std::shared_ptr<options::Option> const& options,94 options::Option const& options,
95 std::shared_ptr<EmergencyCleanupRegistry> const& emergency_cleanup_registry,95 std::shared_ptr<EmergencyCleanupRegistry> const& emergency_cleanup_registry,
96 std::shared_ptr<InputDeviceRegistry> const& input_device_registry,96 std::shared_ptr<InputDeviceRegistry> const& input_device_registry,
97 std::shared_ptr<InputReport> const& report);97 std::shared_ptr<InputReport> const& report);
@@ -123,7 +123,7 @@
123 * \ingroup platform_enablement123 * \ingroup platform_enablement
124 */124 */
125mir::UniqueModulePtr<mir::input::Platform> create_input_platform(125mir::UniqueModulePtr<mir::input::Platform> create_input_platform(
126 std::shared_ptr<mir::options::Option> const& options,126 mir::options::Option const& options,
127 std::shared_ptr<mir::EmergencyCleanupRegistry> const& emergency_cleanup_registry,127 std::shared_ptr<mir::EmergencyCleanupRegistry> const& emergency_cleanup_registry,
128 std::shared_ptr<mir::input::InputDeviceRegistry> const& input_device_registry,128 std::shared_ptr<mir::input::InputDeviceRegistry> const& input_device_registry,
129 std::shared_ptr<mir::input::InputReport> const& report);129 std::shared_ptr<mir::input::InputReport> const& report);
130130
=== modified file 'include/test/mir_test_framework/executable_path.h'
--- include/test/mir_test_framework/executable_path.h 2015-10-20 12:46:15 +0000
+++ include/test/mir_test_framework/executable_path.h 2015-11-20 15:25:54 +0000
@@ -26,6 +26,7 @@
26std::string executable_path();26std::string executable_path();
2727
28std::string library_path();28std::string library_path();
29std::string server_platform_path();
29std::string udev_recordings_path();30std::string udev_recordings_path();
30std::string server_platform(std::string const& name);31std::string server_platform(std::string const& name);
31std::string server_input_platform(std::string const& name);32std::string server_input_platform(std::string const& name);
3233
=== modified file 'src/include/server/mir/default_server_configuration.h'
--- src/include/server/mir/default_server_configuration.h 2015-11-19 04:54:42 +0000
+++ src/include/server/mir/default_server_configuration.h 2015-11-20 15:25:54 +0000
@@ -132,7 +132,6 @@
132class Scene;132class Scene;
133class InputManager;133class InputManager;
134class SurfaceInputDispatcher;134class SurfaceInputDispatcher;
135class Platform;
136class InputDeviceRegistry;135class InputDeviceRegistry;
137class InputDeviceHub;136class InputDeviceHub;
138class DefaultInputDeviceHub;137class DefaultInputDeviceHub;
@@ -144,15 +143,8 @@
144class InputRegion;143class InputRegion;
145class InputSender;144class InputSender;
146class InputSendObserver;145class InputSendObserver;
147class NestedInputRelay;
148class EventHandler;
149class CursorImages;146class CursorImages;
150class LegacyInputDispatchable;147class LegacyInputDispatchable;
151namespace android
152{
153class InputRegistrar;
154class InputThread;
155}
156}148}
157149
158namespace logging150namespace logging
@@ -331,7 +323,6 @@
331 virtual std::shared_ptr<droidinput::InputListenerInterface> the_input_translator();323 virtual std::shared_ptr<droidinput::InputListenerInterface> the_input_translator();
332324
333 // new input reading related parts:325 // new input reading related parts:
334 virtual std::shared_ptr<input::Platform> the_input_platform();
335 virtual std::shared_ptr<dispatch::MultiplexingDispatchable> the_input_reading_multiplexer();326 virtual std::shared_ptr<dispatch::MultiplexingDispatchable> the_input_reading_multiplexer();
336 virtual std::shared_ptr<input::InputDeviceRegistry> the_input_device_registry();327 virtual std::shared_ptr<input::InputDeviceRegistry> the_input_device_registry();
337 virtual std::shared_ptr<input::InputDeviceHub> the_input_device_hub();328 virtual std::shared_ptr<input::InputDeviceHub> the_input_device_hub();
@@ -390,8 +381,7 @@
390 CachedPtr<input::CompositeEventFilter> composite_event_filter;381 CachedPtr<input::CompositeEventFilter> composite_event_filter;
391 CachedPtr<input::InputManager> input_manager;382 CachedPtr<input::InputManager> input_manager;
392 CachedPtr<input::SurfaceInputDispatcher> surface_input_dispatcher;383 CachedPtr<input::SurfaceInputDispatcher> surface_input_dispatcher;
393 CachedPtr<input::DefaultInputDeviceHub> default_input_device_hub; // currently not used by default384 CachedPtr<input::DefaultInputDeviceHub> default_input_device_hub;
394 CachedPtr<input::Platform> input_platform; // currently not used by default
395 CachedPtr<dispatch::MultiplexingDispatchable> input_reading_multiplexer;385 CachedPtr<dispatch::MultiplexingDispatchable> input_reading_multiplexer;
396 CachedPtr<input::InputDispatcher> input_dispatcher;386 CachedPtr<input::InputDispatcher> input_dispatcher;
397 CachedPtr<input::InputSender> input_sender;387 CachedPtr<input::InputSender> input_sender;
398388
=== added file 'src/include/server/mir/input/input_probe.h'
--- src/include/server/mir/input/input_probe.h 1970-01-01 00:00:00 +0000
+++ src/include/server/mir/input/input_probe.h 2015-11-20 15:25:54 +0000
@@ -0,0 +1,48 @@
1/*
2 * Copyright © 2015 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Andreas Pokorny <andreas.pokorny@canonical.com>
17 */
18
19#ifndef MIR_INPUT_PROBE_H_
20#define MIR_INPUT_PROBE_H_
21
22#include <vector>
23#include "mir/module_deleter.h"
24
25namespace mir
26{
27namespace options
28{
29class Option;
30}
31class EmergencyCleanupRegistry;
32class SharedLibraryProberReport;
33
34namespace input
35{
36class InputReport;
37class Platform;
38class InputDeviceRegistry;
39
40std::vector<mir::UniqueModulePtr<Platform>> probe_input_platforms(
41 options::Option const& options, std::shared_ptr<EmergencyCleanupRegistry> const& emergency_cleanup,
42 std::shared_ptr<InputDeviceRegistry> const& device_registry, std::shared_ptr<InputReport> const& input_report,
43 SharedLibraryProberReport & prober_report);
44
45}
46}
47
48#endif
049
=== modified file 'src/platform/graphics/platform_probe.cpp'
--- src/platform/graphics/platform_probe.cpp 2015-10-12 08:08:58 +0000
+++ src/platform/graphics/platform_probe.cpp 2015-11-20 15:25:54 +0000
@@ -46,7 +46,11 @@
46 "describe_graphics_module",46 "describe_graphics_module",
47 MIR_SERVER_GRAPHICS_PLATFORM_VERSION);47 MIR_SERVER_GRAPHICS_PLATFORM_VERSION);
48 auto desc = describe();48 auto desc = describe();
49 mir::log_info("Found graphics driver: %s", desc->name);49 mir::log_info("Found graphics driver: %s, (version: %d.%d.%d)",
50 desc->name,
51 desc->major_version,
52 desc->minor_version,
53 desc->micro_version);
50 }54 }
51 catch (std::runtime_error const&)55 catch (std::runtime_error const&)
52 {56 {
5357
=== modified file 'src/platforms/evdev/platform_factory.cpp'
--- src/platforms/evdev/platform_factory.cpp 2015-10-20 12:46:15 +0000
+++ src/platforms/evdev/platform_factory.cpp 2015-11-20 15:25:54 +0000
@@ -67,7 +67,7 @@
67}67}
6868
69mir::UniqueModulePtr<mi::Platform> create_input_platform(69mir::UniqueModulePtr<mi::Platform> create_input_platform(
70 std::shared_ptr<mo::Option> const& /*options*/,70 mo::Option const& /*options*/,
71 std::shared_ptr<mir::EmergencyCleanupRegistry> const& /*emergency_cleanup_registry*/,71 std::shared_ptr<mir::EmergencyCleanupRegistry> const& /*emergency_cleanup_registry*/,
72 std::shared_ptr<mi::InputDeviceRegistry> const& input_device_registry,72 std::shared_ptr<mi::InputDeviceRegistry> const& input_device_registry,
73 std::shared_ptr<mi::InputReport> const& report)73 std::shared_ptr<mi::InputReport> const& report)
7474
=== modified file 'src/platforms/mesa/server/x11/input/input.cpp'
--- src/platforms/mesa/server/x11/input/input.cpp 2015-10-12 08:08:58 +0000
+++ src/platforms/mesa/server/x11/input/input.cpp 2015-11-20 15:25:54 +0000
@@ -28,7 +28,7 @@
28extern mx::X11Resources x11_resources;28extern mx::X11Resources x11_resources;
2929
30mir::UniqueModulePtr<mi::Platform> create_input_platform(30mir::UniqueModulePtr<mi::Platform> create_input_platform(
31 std::shared_ptr<mo::Option> const& /*options*/,31 mo::Option const& /*options*/,
32 std::shared_ptr<mir::EmergencyCleanupRegistry> const& /*emergency_cleanup_registry*/,32 std::shared_ptr<mir::EmergencyCleanupRegistry> const& /*emergency_cleanup_registry*/,
33 std::shared_ptr<mi::InputDeviceRegistry> const& input_device_registry,33 std::shared_ptr<mi::InputDeviceRegistry> const& input_device_registry,
34 std::shared_ptr<mi::InputReport> const& /*report*/)34 std::shared_ptr<mi::InputReport> const& /*report*/)
3535
=== modified file 'src/server/input/CMakeLists.txt'
--- src/server/input/CMakeLists.txt 2015-11-04 16:30:42 +0000
+++ src/server/input/CMakeLists.txt 2015-11-20 15:25:54 +0000
@@ -14,6 +14,7 @@
14 display_input_region.cpp14 display_input_region.cpp
15 event_filter_chain_dispatcher.cpp15 event_filter_chain_dispatcher.cpp
16 input_modifier_utils.cpp16 input_modifier_utils.cpp
17 input_probe.cpp
17 key_repeat_dispatcher.cpp18 key_repeat_dispatcher.cpp
18 null_input_channel_factory.cpp19 null_input_channel_factory.cpp
19 null_input_dispatcher.cpp20 null_input_dispatcher.cpp
2021
=== modified file 'src/server/input/default_configuration.cpp'
--- src/server/input/default_configuration.cpp 2015-10-13 17:42:07 +0000
+++ src/server/input/default_configuration.cpp 2015-11-20 15:25:54 +0000
@@ -39,16 +39,16 @@
39#include "surface_input_dispatcher.h"39#include "surface_input_dispatcher.h"
4040
41#include "mir/input/touch_visualizer.h"41#include "mir/input/touch_visualizer.h"
42#include "mir/input/input_probe.h"
42#include "mir/input/platform.h"43#include "mir/input/platform.h"
43#include "mir/options/configuration.h"44#include "mir/options/configuration.h"
44#include "mir/options/option.h"45#include "mir/options/option.h"
45#include "mir/dispatch/multiplexing_dispatchable.h"46#include "mir/dispatch/multiplexing_dispatchable.h"
46#include "mir/compositor/scene.h"47#include "mir/compositor/scene.h"
47#include "mir/emergency_cleanup.h"48#include "mir/emergency_cleanup.h"
48#include "mir/report/legacy_input_report.h"
49#include "mir/main_loop.h"49#include "mir/main_loop.h"
50#include "mir/shared_library.h"
51#include "mir/glib_main_loop.h"50#include "mir/glib_main_loop.h"
51#include "mir/log.h"
52#include "mir/dispatch/action_queue.h"52#include "mir/dispatch/action_queue.h"
5353
54#include "mir_toolkit/cursors.h"54#include "mir_toolkit/cursors.h"
@@ -290,26 +290,6 @@
290 });290 });
291}291}
292292
293std::shared_ptr<mi::Platform>
294mir::DefaultServerConfiguration::the_input_platform()
295{
296 return input_platform(
297 [this]() -> std::shared_ptr<mi::Platform>
298 {
299 auto options = the_options();
300
301 if (!options->is_set(options::platform_input_lib))
302 return nullptr;
303
304 auto lib = std::make_shared<mir::SharedLibrary>(
305 options->get<std::string>(options::platform_input_lib));
306 auto create = lib->load_function<mi::CreatePlatform>(
307 "create_input_platform",
308 MIR_SERVER_INPUT_PLATFORM_VERSION);
309 return create(the_options(), the_emergency_cleanup(), the_input_device_registry(), the_input_report());
310 });
311}
312
313namespace293namespace
314{294{
315class NullLegacyInputDispatchable : public mi::LegacyInputDispatchable295class NullLegacyInputDispatchable : public mi::LegacyInputDispatchable
@@ -341,23 +321,20 @@
341 }321 }
342 else322 else
343 {323 {
344 if (options->get<std::string>(options::legacy_input_report_opt) == options::log_opt_value)324 auto platforms = probe_input_platforms(*options, the_emergency_cleanup(), the_input_device_registry(),
345 mr::legacy_input::initialize(the_logger());325 the_input_report(), *the_shared_library_prober_report());
346326
347 if (auto platform = the_input_platform())327 if (platforms.empty())
348 {328 BOOST_THROW_EXCEPTION(std::runtime_error("No input platforms found"));
349 auto const ret = std::make_shared<mi::DefaultInputManager>(329
350 the_input_reading_multiplexer(),330 auto const ret = std::make_shared<mi::DefaultInputManager>(
351 std::make_shared<NullLegacyInputDispatchable>());331 the_input_reading_multiplexer(),
352332 std::make_shared<NullLegacyInputDispatchable>());
353 ret->add_platform(platform);333
354 return ret;334 for (auto & platform : platforms)
355 }335 ret->add_platform(std::move(platform));
356 else336
357 {337 return ret;
358 return std::make_shared<mi::DefaultInputManager>(
359 the_input_reading_multiplexer(), the_legacy_input_dispatchable());
360 }
361 }338 }
362 }339 }
363 );340 );
364341
=== added file 'src/server/input/input_probe.cpp'
--- src/server/input/input_probe.cpp 1970-01-01 00:00:00 +0000
+++ src/server/input/input_probe.cpp 2015-11-20 15:25:54 +0000
@@ -0,0 +1,104 @@
1/*
2 * Copyright © 2015 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Andreas Pokorny <andreas.pokorny@canonical.com>
17 */
18
19#include "mir/input/input_probe.h"
20#include "mir/input/platform.h"
21
22#include "mir/options/configuration.h"
23#include "mir/options/option.h"
24
25#include "mir/shared_library_prober.h"
26#include "mir/shared_library.h"
27#include "mir/log.h"
28#include "mir/module_deleter.h"
29
30#include <stdexcept>
31
32namespace mi = mir::input;
33namespace mo = mir::options;
34
35namespace
36{
37auto probe_input_platform(mir::SharedLibrary const& lib, mir::options::Option const& options)
38{
39 auto probe = lib.load_function<mi::ProbePlatform>("probe_input_platform", MIR_SERVER_INPUT_PLATFORM_VERSION);
40
41 return probe(options);
42}
43
44void describe_input_platform(mir::SharedLibrary const& lib)
45{
46 auto describe =
47 lib.load_function<mi::DescribeModule>("describe_input_module", MIR_SERVER_INPUT_PLATFORM_VERSION);
48 auto desc = describe();
49 mir::log_info("Selected input driver: %s (version: %d.%d.%d)", desc->name, desc->major_version, desc->minor_version,
50 desc->micro_version);
51}
52
53mir::UniqueModulePtr<mi::Platform> create_input_platform(
54 mir::SharedLibrary const& lib, mir::options::Option const& options,
55 std::shared_ptr<mir::EmergencyCleanupRegistry> const& cleanup_registry,
56 std::shared_ptr<mi::InputDeviceRegistry> const& registry, std::shared_ptr<mi::InputReport> const& report)
57{
58
59 auto create = lib.load_function<mi::CreatePlatform>("create_input_platform", MIR_SERVER_INPUT_PLATFORM_VERSION);
60
61 return create(options, cleanup_registry, registry, report);
62}
63}
64
65std::vector<mir::UniqueModulePtr<mi::Platform>> mi::probe_input_platforms(
66 mo::Option const& options, std::shared_ptr<EmergencyCleanupRegistry> const& emergency_cleanup,
67 std::shared_ptr<mi::InputDeviceRegistry> const& device_registry, std::shared_ptr<mi::InputReport> const& input_report,
68 mir::SharedLibraryProberReport& prober_report)
69{
70 std::vector<UniqueModulePtr<Platform>> platforms;
71
72 if (options.is_set(mo::platform_input_lib))
73 {
74 mir::SharedLibrary lib(options.get<std::string>(mo::platform_input_lib));
75
76 platforms.emplace_back(create_input_platform(lib, options, emergency_cleanup, device_registry, input_report));
77
78 describe_input_platform(lib);
79 }
80 else
81 {
82 auto const& path = options.get<std::string>(mo::platform_path);
83 auto platforms_libs = mir::libraries_for_path(path, prober_report);
84
85 for (auto const& platform_lib : platforms_libs)
86 {
87 try
88 {
89 if (probe_input_platform(*platform_lib, options) > mi::PlatformPriority::dummy)
90 {
91 platforms.emplace_back(
92 create_input_platform(*platform_lib, options, emergency_cleanup, device_registry, input_report));
93
94 describe_input_platform(*platform_lib);
95 }
96 }
97 catch (std::runtime_error const&)
98 {
99 }
100 }
101 }
102
103 return platforms;
104}
0105
=== modified file 'src/server/symbols.map'
--- src/server/symbols.map 2015-11-19 06:43:10 +0000
+++ src/server/symbols.map 2015-11-20 15:25:54 +0000
@@ -83,6 +83,7 @@
83 mir::input::TouchVisualizer::operator*;83 mir::input::TouchVisualizer::operator*;
84 mir::input::TouchVisualizer::?TouchVisualizer*;84 mir::input::TouchVisualizer::?TouchVisualizer*;
85 mir::input::TouchVisualizer::TouchVisualizer*;85 mir::input::TouchVisualizer::TouchVisualizer*;
86 mir::input::probe_input_platforms*;
86 mir::LockableCallback::?LockableCallback*;87 mir::LockableCallback::?LockableCallback*;
87 mir::LockableCallback::LockableCallback*;88 mir::LockableCallback::LockableCallback*;
88 mir::LockableCallback::operator*;89 mir::LockableCallback::operator*;
@@ -687,7 +688,6 @@
687 mir::DefaultServerConfiguration::the_input_dispatcher*;688 mir::DefaultServerConfiguration::the_input_dispatcher*;
688 mir::DefaultServerConfiguration::the_new_input_dispatcher*;689 mir::DefaultServerConfiguration::the_new_input_dispatcher*;
689 mir::DefaultServerConfiguration::the_input_manager*;690 mir::DefaultServerConfiguration::the_input_manager*;
690 mir::DefaultServerConfiguration::the_input_platform*;
691 mir::DefaultServerConfiguration::the_input_reader*;691 mir::DefaultServerConfiguration::the_input_reader*;
692 mir::DefaultServerConfiguration::the_input_reader_policy*;692 mir::DefaultServerConfiguration::the_input_reader_policy*;
693 mir::DefaultServerConfiguration::the_input_reading_multiplexer*;693 mir::DefaultServerConfiguration::the_input_reading_multiplexer*;
694694
=== renamed file 'tests/mir_test_framework/stub_input_platform.h' => 'tests/include/mir_test_framework/stub_input_platform.h'
=== modified file 'tests/mir_test_framework/CMakeLists.txt'
--- tests/mir_test_framework/CMakeLists.txt 2015-11-04 15:42:43 +0000
+++ tests/mir_test_framework/CMakeLists.txt 2015-11-20 15:25:54 +0000
@@ -38,6 +38,7 @@
38 process.cpp38 process.cpp
39 server_runner.cpp39 server_runner.cpp
40 socket_detect_server.cpp40 socket_detect_server.cpp
41 stub_input_platform.cpp
41 stub_client_platform_factory.cpp42 stub_client_platform_factory.cpp
42 stub_server_platform_factory.cpp43 stub_server_platform_factory.cpp
43 stub_session.cpp44 stub_session.cpp
4445
=== modified file 'tests/mir_test_framework/executable_path.cpp'
--- tests/mir_test_framework/executable_path.cpp 2015-10-20 12:46:15 +0000
+++ tests/mir_test_framework/executable_path.cpp 2015-11-20 15:25:54 +0000
@@ -45,6 +45,16 @@
45 return executable_path() + "/../lib";45 return executable_path() + "/../lib";
46}46}
4747
48std::string mir_test_framework::server_platform_path()
49{
50 for (auto const& option : {library_path() + "/server-modules/",
51 library_path() + "/server-platform/",
52 std::string(MIR_SERVER_PLATFORM_PATH) + '/'})
53 if (boost::filesystem::exists(option))
54 return option;
55 BOOST_THROW_EXCEPTION(std::runtime_error("Failed to find server platform in standard search locations"));
56}
57
48std::string mir_test_framework::udev_recordings_path()58std::string mir_test_framework::udev_recordings_path()
49{59{
50 std::string run_path = executable_path() + "/udev_recordings";60 std::string run_path = executable_path() + "/udev_recordings";
5161
=== modified file 'tests/mir_test_framework/fake_input_device_impl.cpp'
--- tests/mir_test_framework/fake_input_device_impl.cpp 2015-11-19 04:54:42 +0000
+++ tests/mir_test_framework/fake_input_device_impl.cpp 2015-11-20 15:25:54 +0000
@@ -17,7 +17,7 @@
17 */17 */
1818
19#include "fake_input_device_impl.h"19#include "fake_input_device_impl.h"
20#include "stub_input_platform.h"20#include "mir_test_framework/stub_input_platform.h"
2121
22#include "mir/input/input_device.h"22#include "mir/input/input_device.h"
23#include "mir/input/input_device_info.h"23#include "mir/input/input_device_info.h"
2424
=== modified file 'tests/mir_test_framework/fake_input_server_configuration.cpp'
--- tests/mir_test_framework/fake_input_server_configuration.cpp 2015-08-26 08:44:24 +0000
+++ tests/mir_test_framework/fake_input_server_configuration.cpp 2015-11-20 15:25:54 +0000
@@ -23,7 +23,6 @@
23namespace mi = mir::input;23namespace mi = mir::input;
24namespace ms = mir::scene;24namespace ms = mir::scene;
25namespace msh = mir::shell;25namespace msh = mir::shell;
26namespace mia = mir::input::android;
2726
28mtf::FakeInputServerConfiguration::FakeInputServerConfiguration()27mtf::FakeInputServerConfiguration::FakeInputServerConfiguration()
29{28{
3029
=== modified file 'tests/mir_test_framework/input_testing_server_options.cpp'
--- tests/mir_test_framework/input_testing_server_options.cpp 2015-06-25 03:00:08 +0000
+++ tests/mir_test_framework/input_testing_server_options.cpp 2015-11-20 15:25:54 +0000
@@ -38,7 +38,6 @@
38namespace mg = mir::graphics;38namespace mg = mir::graphics;
39namespace mi = mir::input;39namespace mi = mir::input;
40namespace ms = mir::shell;40namespace ms = mir::shell;
41namespace mia = mi::android;
42namespace geom = mir::geometry;41namespace geom = mir::geometry;
4342
44mtf::InputTestingServerConfiguration::InputTestingServerConfiguration()43mtf::InputTestingServerConfiguration::InputTestingServerConfiguration()
4544
=== modified file 'tests/mir_test_framework/stub_input.cpp'
--- tests/mir_test_framework/stub_input.cpp 2015-10-12 08:08:58 +0000
+++ tests/mir_test_framework/stub_input.cpp 2015-11-20 15:25:54 +0000
@@ -16,7 +16,7 @@
16 * Authored by: Andreas Pokorny <andreas.pokorny@canonical.com>16 * Authored by: Andreas Pokorny <andreas.pokorny@canonical.com>
17 */17 */
1818
19#include "stub_input_platform.h"19#include "mir_test_framework/stub_input_platform.h"
20#include "fake_input_device_impl.h"20#include "fake_input_device_impl.h"
21#include "mir/module_properties.h"21#include "mir/module_properties.h"
2222
@@ -25,7 +25,7 @@
25namespace mi = mir::input;25namespace mi = mir::input;
2626
27mir::UniqueModulePtr<mi::Platform> create_input_platform(27mir::UniqueModulePtr<mi::Platform> create_input_platform(
28 std::shared_ptr<mo::Option> const& /*options*/,28 mo::Option const& /*options*/,
29 std::shared_ptr<mir::EmergencyCleanupRegistry> const& /*emergency_cleanup_registry*/,29 std::shared_ptr<mir::EmergencyCleanupRegistry> const& /*emergency_cleanup_registry*/,
30 std::shared_ptr<mi::InputDeviceRegistry> const& input_device_registry,30 std::shared_ptr<mi::InputDeviceRegistry> const& input_device_registry,
31 std::shared_ptr<mi::InputReport> const& /*report*/)31 std::shared_ptr<mi::InputReport> const& /*report*/)
3232
=== modified file 'tests/mir_test_framework/stub_input_platform.cpp'
--- tests/mir_test_framework/stub_input_platform.cpp 2015-10-12 08:08:58 +0000
+++ tests/mir_test_framework/stub_input_platform.cpp 2015-11-20 15:25:54 +0000
@@ -16,7 +16,7 @@
16 * Authored by: Andreas Pokorny <andreas.pokorny@canonical.com>16 * Authored by: Andreas Pokorny <andreas.pokorny@canonical.com>
17 */17 */
1818
19#include "stub_input_platform.h"19#include "mir_test_framework/stub_input_platform.h"
2020
21#include "mir/input/input_device_registry.h"21#include "mir/input/input_device_registry.h"
22#include "mir/dispatch/action_queue.h"22#include "mir/dispatch/action_queue.h"
2323
=== modified file 'tests/umock-acceptance-tests/test_libinput.cpp'
--- tests/umock-acceptance-tests/test_libinput.cpp 2015-10-12 08:08:58 +0000
+++ tests/umock-acceptance-tests/test_libinput.cpp 2015-11-20 15:25:54 +0000
@@ -17,8 +17,8 @@
17 */17 */
1818
19#include "mir/input/platform.h"19#include "mir/input/platform.h"
20#include "mir/test/doubles/mock_option.h"
20#include "mir/shared_library.h"21#include "mir/shared_library.h"
21#include "mir/options/option.h"
2222
23#include "mir_test_framework/udev_environment.h"23#include "mir_test_framework/udev_environment.h"
24#include "mir_test_framework/executable_path.h"24#include "mir_test_framework/executable_path.h"
@@ -27,20 +27,13 @@
27#include <gtest/gtest.h>27#include <gtest/gtest.h>
2828
29namespace mtf = mir_test_framework;29namespace mtf = mir_test_framework;
30namespace mtd = mir::test::doubles;
30namespace mo = mir::options;31namespace mo = mir::options;
32
31using namespace ::testing;33using namespace ::testing;
32namespace34namespace
33{35{
3436
35struct MockOption : mo::Option
36{
37 MOCK_CONST_METHOD1(is_set, bool(char const*));
38 MOCK_CONST_METHOD2(get, bool(char const*, bool));
39 MOCK_CONST_METHOD2(get, int(char const*, int));
40 MOCK_CONST_METHOD2(get, std::string(char const* name, char const*));
41 MOCK_CONST_METHOD1(get, boost::any const&(char const*));
42};
43
44auto get_libinput_platform()37auto get_libinput_platform()
45{38{
46 auto path = mtf::server_input_platform("input-evdev");39 auto path = mtf::server_input_platform("input-evdev");
@@ -54,7 +47,7 @@
5447
55TEST(LibInput, DISABLED_probes_as_unsupported_without_device_access)48TEST(LibInput, DISABLED_probes_as_unsupported_without_device_access)
56{49{
57 NiceMock<MockOption> options;50 NiceMock<mtd::MockOption> options;
5851
59 // dumb assumption - nobody runs this test cases as root..52 // dumb assumption - nobody runs this test cases as root..
60 // or allows accessing evdev input devices from non privileged users.53 // or allows accessing evdev input devices from non privileged users.
@@ -67,7 +60,7 @@
67{60{
68 mtf::UdevEnvironment env;61 mtf::UdevEnvironment env;
69 env.add_standard_device("laptop-keyboard");62 env.add_standard_device("laptop-keyboard");
70 NiceMock<MockOption> options;63 NiceMock<mtd::MockOption> options;
7164
72 auto library = get_libinput_platform();65 auto library = get_libinput_platform();
73 auto probe_fun = library->load_function<mir::input::ProbePlatform>(probe_input_platform_symbol);66 auto probe_fun = library->load_function<mir::input::ProbePlatform>(probe_input_platform_symbol);
@@ -78,7 +71,8 @@
78{71{
79 mtf::UdevEnvironment env;72 mtf::UdevEnvironment env;
80 env.add_standard_device("laptop-keyboard");73 env.add_standard_device("laptop-keyboard");
81 NiceMock<MockOption> options;74 NiceMock<mtd::MockOption> options;
75
82 ON_CALL(options,is_set(StrEq(host_socket_opt)))76 ON_CALL(options,is_set(StrEq(host_socket_opt)))
83 .WillByDefault(Return(true));77 .WillByDefault(Return(true));
84 ON_CALL(options,get(StrEq(host_socket_opt), Matcher<char const*>(_)))78 ON_CALL(options,get(StrEq(host_socket_opt), Matcher<char const*>(_)))
@@ -92,7 +86,7 @@
92TEST(LibInput, probes_as_supported_when_umock_dev_available_or_before_input_devices_are_available)86TEST(LibInput, probes_as_supported_when_umock_dev_available_or_before_input_devices_are_available)
93{87{
94 mtf::UdevEnvironment env;88 mtf::UdevEnvironment env;
95 NiceMock<MockOption> options;89 NiceMock<mtd::MockOption> options;
9690
97 auto library = get_libinput_platform();91 auto library = get_libinput_platform();
98 auto probe_fun = library->load_function<mir::input::ProbePlatform>(probe_input_platform_symbol);92 auto probe_fun = library->load_function<mir::input::ProbePlatform>(probe_input_platform_symbol);
9993
=== modified file 'tests/unit-tests/input/CMakeLists.txt'
--- tests/unit-tests/input/CMakeLists.txt 2015-11-04 19:47:19 +0000
+++ tests/unit-tests/input/CMakeLists.txt 2015-11-20 15:25:54 +0000
@@ -8,6 +8,7 @@
8 ${CMAKE_CURRENT_SOURCE_DIR}/test_xcursor_loader.cpp8 ${CMAKE_CURRENT_SOURCE_DIR}/test_xcursor_loader.cpp
9 ${CMAKE_CURRENT_SOURCE_DIR}/test_touchspot_controller.cpp9 ${CMAKE_CURRENT_SOURCE_DIR}/test_touchspot_controller.cpp
10 ${CMAKE_CURRENT_SOURCE_DIR}/test_input_event.cpp10 ${CMAKE_CURRENT_SOURCE_DIR}/test_input_event.cpp
11 ${CMAKE_CURRENT_SOURCE_DIR}/test_input_platform_probing.cpp
11 ${CMAKE_CURRENT_SOURCE_DIR}/test_event_builders.cpp12 ${CMAKE_CURRENT_SOURCE_DIR}/test_event_builders.cpp
12 ${CMAKE_CURRENT_SOURCE_DIR}/test_default_device.cpp13 ${CMAKE_CURRENT_SOURCE_DIR}/test_default_device.cpp
13 ${CMAKE_CURRENT_SOURCE_DIR}/test_default_input_device_hub.cpp14 ${CMAKE_CURRENT_SOURCE_DIR}/test_default_input_device_hub.cpp
1415
=== added file 'tests/unit-tests/input/test_input_platform_probing.cpp'
--- tests/unit-tests/input/test_input_platform_probing.cpp 1970-01-01 00:00:00 +0000
+++ tests/unit-tests/input/test_input_platform_probing.cpp 2015-11-20 15:25:54 +0000
@@ -0,0 +1,161 @@
1/*
2 * Copyright © 2015 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 3 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Andreas Pokorny <andreas.pokorny@canonical.com>
17 */
18
19#include <gtest/gtest.h>
20
21#include "mir/input/input_probe.h"
22
23#include "mir/input/platform.h"
24#include "src/server/report/null_report_factory.h"
25
26#include "mir/options/option.h"
27#include "mir/emergency_cleanup_registry.h"
28
29#include "mir_test_framework/udev_environment.h"
30#include "mir_test_framework/executable_path.h"
31#include "mir_test_framework/stub_input_platform.h"
32#include "mir/test/doubles/mock_x11.h"
33#include "mir/test/doubles/mock_libinput.h"
34#include "mir/test/doubles/mock_option.h"
35#include "mir/test/doubles/mock_input_device_registry.h"
36#include "src/platforms/evdev/platform.h"
37#include "src/platforms/mesa/server/x11/input/input_platform.h"
38#include "mir/test/fake_shared.h"
39
40namespace mt = mir::test;
41namespace mtd = mt::doubles;
42namespace mi = mir::input;
43namespace mr = mir::report;
44namespace mtf = mir_test_framework;
45
46using namespace ::testing;
47
48namespace
49{
50struct StubEmergencyCleanupRegistry : mir::EmergencyCleanupRegistry
51{
52 void add(mir::EmergencyCleanupHandler const&) override {}
53 void add(mir::ModuleEmergencyCleanupHandler) override {}
54};
55char const platform_input_lib[] = "platform-input-lib";
56char const platform_path[] = "platform-path";
57
58struct InputPlatformProbe : ::testing::Test
59{
60 InputPlatformProbe()
61 {
62 ON_CALL(mock_options, is_set(StrEq(platform_input_lib))).WillByDefault(Return(false));
63 ON_CALL(mock_options, is_set(StrEq(platform_path))).WillByDefault(Return(true));
64 ON_CALL(mock_options, get(StrEq(platform_path),Matcher<char const*>(_)))
65 .WillByDefault(Return(platform_path_value));
66 ON_CALL(mock_options, get(StrEq(platform_path)))
67 .WillByDefault(Invoke(
68 [this](char const*) -> boost::any const&
69 {
70 return platform_path_value_as_any;
71 }));
72 ON_CALL(mock_options, get(StrEq(platform_input_lib)))
73 .WillByDefault(Invoke(
74 [this](char const*) -> boost::any const&
75 {
76 return platform_input_lib_value_as_any;
77 }));
78 }
79
80 void disable_x11()
81 {
82#ifdef MIR_BUILD_PLATFORM_MESA_X11
83 ON_CALL(mock_x11, XOpenDisplay(_)).WillByDefault(Return(nullptr));
84#endif
85 }
86
87 // replace with with mocks for udev and evdev to simulate root or non-root
88 // access on evdev devices, and enable the disabled test case(s) below.
89 mtf::UdevEnvironment env;
90
91#ifdef MIR_BUILD_PLATFORM_MESA_X11
92 NiceMock<mtd::MockX11> mock_x11;
93#endif
94 NiceMock<mtd::MockLibInput> mock_libinput;
95 NiceMock<mtd::MockOption> mock_options;
96 mtd::MockInputDeviceRegistry mock_registry;
97 StubEmergencyCleanupRegistry stub_emergency;
98 std::shared_ptr<mir::SharedLibraryProberReport> stub_prober_report{mr::null_shared_library_prober_report()};
99 std::string platform_path_value{mtf::server_platform_path()};
100 boost::any platform_path_value_as_any{platform_path_value};
101 std::string platform_input_lib_value;
102 boost::any platform_input_lib_value_as_any;
103};
104
105template <typename Expected>
106struct OfPtrTypeMatcher
107{
108 template <typename T>
109 bool MatchAndExplain(T&& p, MatchResultListener* /* listener */) const
110 {
111 return dynamic_cast<Expected*>(&*p) != nullptr;
112 }
113 void DescribeTo(::std::ostream* os) const
114 {
115 *os << "is a or derived from a " << typeid(Expected).name();
116 }
117 void DescribeNegationTo(::std::ostream* os) const
118 {
119 *os << "is not or not derived from " << typeid(Expected).name();
120 }
121};
122
123template<typename Dest>
124inline auto OfPtrType()
125{
126 return MakePolymorphicMatcher(OfPtrTypeMatcher<Dest>());
127}
128}
129
130
131TEST_F(InputPlatformProbe, stub_platform_not_picked_up_by_default)
132{
133 disable_x11();
134 auto platforms =
135 mi::probe_input_platforms(mock_options, mt::fake_shared(stub_emergency), mt::fake_shared(mock_registry),
136 mr::null_input_report(), *stub_prober_report);
137
138 EXPECT_THAT(platforms, ElementsAre(OfPtrType<mi::evdev::Platform>()));
139}
140
141#ifdef MIR_BUILD_PLATFORM_MESA_X11
142TEST_F(InputPlatformProbe, x11_platform_found_and_used_when_display_connection_works)
143{
144 auto platforms =
145 mi::probe_input_platforms(mock_options, mt::fake_shared(stub_emergency), mt::fake_shared(mock_registry),
146 mr::null_input_report(), *stub_prober_report);
147
148 EXPECT_THAT(platforms, UnorderedElementsAre(OfPtrType<mi::evdev::Platform>(), OfPtrType<mi::X::XInputPlatform>()));
149}
150#endif
151
152TEST_F(InputPlatformProbe, allows_forcing_stub_input_platform)
153{
154 ON_CALL(mock_options, is_set(StrEq(platform_input_lib))).WillByDefault(Return(true));
155 platform_input_lib_value = mtf::server_input_platform("input-stub.so");
156 platform_input_lib_value_as_any = platform_input_lib_value;
157 auto platforms =
158 mi::probe_input_platforms(mock_options, mt::fake_shared(stub_emergency), mt::fake_shared(mock_registry),
159 mr::null_input_report(), *stub_prober_report);
160 EXPECT_THAT(platforms, ElementsAre(OfPtrType<mtf::StubInputPlatform>()));
161}

Subscribers

People subscribed via source and target branches