Mir

Merge lp:~andreas-pokorny/mir/better-input-device-related-logs into lp:mir

Proposed by Andreas Pokorny
Status: Work in progress
Proposed branch: lp:~andreas-pokorny/mir/better-input-device-related-logs
Merge into: lp:mir
Diff against target: 115 lines (+39/-6)
2 files modified
src/platforms/evdev/platform.cpp (+6/-6)
src/server/input/default_input_device_hub.cpp (+33/-0)
To merge this branch: bzr merge lp:~andreas-pokorny/mir/better-input-device-related-logs
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Cemil Azizoglu (community) Approve
Alexandros Frantzis (community) Needs Fixing
Alan Griffiths Abstain
Kevin DuBois (community) Approve
Review via email: mp+276549@code.launchpad.net

Commit message

reduce the severity of udev related logs to debug, and provide readable log for new and removed device

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Kevin DuBois (kdub) wrote :

alright

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

Looks good.

review: Approve
Revision history for this message
Alexandros Frantzis (afrantzis) wrote :

... although the device added/removed events are good candidates for a report object.

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 :

> ... although the device added/removed events are good candidates for a report
> object.

+1

review: Abstain
Revision history for this message
Alexandros Frantzis (afrantzis) wrote :

9: [ RUN ] InputDeviceHubTest.observers_receive_devices_on_add
9: ==19961== Invalid read of size 1
9: ==19961== at 0x4842094: strlen (vg_replace_strmem.c:412)
9: ==19961== by 0x4D41B29: vfprintf (vfprintf.c:1642)
9: ==19961== by 0x4DADA39: __vsnprintf_chk (vsnprintf_chk.c:63)
9: ==19961== by 0x10BA39B: vsnprintf (stdio2.h:78)
9: ==19961== by 0x10BA39B: mir::logv(mir::logging::Severity, char const*, char const*, std::__va_list) (log.cpp:30)
9: ==19961== by 0x10BA4C3: mir::log(mir::logging::Severity, char const*, char const*, ...) (log.cpp:44)
9: ==19961== by 0x10F4403: log_info<long long int, char const*, char const*> (log.h:58)
9: ==19961== by 0x10F4403: mir::input::DefaultInputDeviceHub::add_device_handle(std::shared_ptr<mir::input::DefaultDevice> const&) (default_input_device_hub.cpp:266)
9: ==19961== by 0x125A0CD: mir::test::doubles::TriggeredMainLoop::trigger_server_actions() (triggered_main_loop.cpp:85)
9: ==19961== by 0xF3C733: InputDeviceHubTest_observers_receive_devices_on_add_Test::TestBody() (test_default_input_device_hub.cpp:215)
9: ==19961== by 0x1238E89: void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (in /tmp/buildd/mir-0.17.0+15.10.20151008.2bzr3075pkg0wily4790+autopilot0/obj-arm-linux-gnueabihf/bin/mir_unit_tests.bin)
9: ==19961== Address 0x1 is not stack'd, malloc'd or (recently) free'd

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

Looks good to me (module others' comments)

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

> Looks good to me (module others' comments)
modulo*

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

^-- Oops, missed the s in the branch when configuring the build. Re-triggered.

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 :

i will rework that.. and maybe add a report for udev monitoring..

Unmerged revisions

3074. By Andreas Pokorny on 2015-11-03

safe another space!

3073. By Andreas Pokorny on 2015-11-03

reduce the severity of udev related logs to debug, and provide readable log for new and removed device

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/platforms/evdev/platform.cpp'
2--- src/platforms/evdev/platform.cpp 2015-09-18 08:31:26 +0000
3+++ src/platforms/evdev/platform.cpp 2015-11-03 15:24:07 +0000
4@@ -112,17 +112,17 @@
5 return;
6 if (event == mu::Monitor::ADDED)
7 {
8- log_info("udev:device added %s", dev.devnode());
9+ log_debug("udev:device added %s", dev.devnode());
10 device_added(dev);
11 }
12 if (event == mu::Monitor::REMOVED)
13 {
14- log_info("udev:device removed %s", dev.devnode());
15+ log_debug("udev:device removed %s", dev.devnode());
16 device_removed(dev);
17 }
18 if (event == mu::Monitor::CHANGED)
19 {
20- log_info("udev:device changed %s", dev.devnode());
21+ log_debug("udev:device changed %s", dev.devnode());
22 device_changed(dev);
23 }
24 });
25@@ -138,7 +138,7 @@
26 {
27 if (device.devnode() != nullptr)
28 {
29- log_info("udev:device added %s", device.devnode());
30+ log_debug("udev:device added %s", device.devnode());
31 device_added(device);
32 }
33 }
34@@ -156,7 +156,7 @@
35 if (!device_ptr)
36 {
37 report->failed_to_open_input_device(dev.devnode(), "evdev-input");
38- log_info("libinput refused to open device %s", dev.devnode());
39+ log_debug("libinput refused to open device %s", dev.devnode());
40 return;
41 }
42
43@@ -177,7 +177,7 @@
44 report->opened_input_device(dev.devnode(), "evdev-input");
45 } catch(...)
46 {
47- mir::log_error("Failure opening device %s", dev.devnode());
48+ log_error("Failure opening device %s", dev.devnode());
49 report->failed_to_open_input_device(dev.devnode(), "evdev-input");
50 }
51 }
52
53=== modified file 'src/server/input/default_input_device_hub.cpp'
54--- src/server/input/default_input_device_hub.cpp 2015-10-19 10:00:22 +0000
55+++ src/server/input/default_input_device_hub.cpp 2015-11-03 15:24:07 +0000
56@@ -35,12 +35,42 @@
57 #include "boost/throw_exception.hpp"
58
59 #include <algorithm>
60+#include <sstream>
61 #include <atomic>
62
63 namespace mi = mir::input;
64 namespace geom = mir::geometry;
65 namespace mev = mir::events;
66
67+namespace
68+{
69+std::string to_string(mi::DeviceCapabilities caps)
70+{
71+ std::stringstream out;
72+ if (contains(caps, mi::DeviceCapability::touchpad))
73+ out << " touchpad";
74+ else if (contains(caps, mi::DeviceCapability::pointer))
75+ out << " mouse";
76+
77+ if (contains(caps, mi::DeviceCapability::multitouch) ||
78+ contains(caps, mi::DeviceCapability::touchscreen))
79+ out << " touchscreen";
80+
81+ if (contains(caps, mi::DeviceCapability::joystick))
82+ out << " joystick";
83+ else if (contains(caps, mi::DeviceCapability::gamepad))
84+ out << " gamepad";
85+
86+ if (contains(caps, mi::DeviceCapability::alpha_numeric))
87+ out << " keyboard";
88+ else if (contains(caps, mi::DeviceCapability::keyboard))
89+ out << " keypad";
90+
91+ return out.str();
92+}
93+
94+}
95+
96 mi::DefaultInputDeviceHub::DefaultInputDeviceHub(
97 std::shared_ptr<mi::InputDispatcher> const& input_dispatcher,
98 std::shared_ptr<dispatch::MultiplexingDispatchable> const& input_multiplexer,
99@@ -233,6 +263,7 @@
100 {
101 handles.push_back(handle);
102
103+ log_info("Input device %d:%s added as%s", handle->id(), handle->name().c_str(), to_string(handle->capabilities()).c_str());
104 for (auto const& observer : observers)
105 {
106 observer->device_added(handles.back());
107@@ -248,6 +279,8 @@
108
109 if (handle_it == end(handles))
110 return;
111+
112+ log_info("Input device %d:%s removed", (*handle_it)->id(), (*handle_it)->name().c_str());
113 for (auto const& observer : observers)
114 {
115 observer->device_removed(*handle_it);

Subscribers

People subscribed via source and target branches