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

safe another space!

3073. By Andreas Pokorny

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
=== modified file 'src/platforms/evdev/platform.cpp'
--- src/platforms/evdev/platform.cpp 2015-09-18 08:31:26 +0000
+++ src/platforms/evdev/platform.cpp 2015-11-03 15:24:07 +0000
@@ -112,17 +112,17 @@
112 return;112 return;
113 if (event == mu::Monitor::ADDED)113 if (event == mu::Monitor::ADDED)
114 {114 {
115 log_info("udev:device added %s", dev.devnode());115 log_debug("udev:device added %s", dev.devnode());
116 device_added(dev);116 device_added(dev);
117 }117 }
118 if (event == mu::Monitor::REMOVED)118 if (event == mu::Monitor::REMOVED)
119 {119 {
120 log_info("udev:device removed %s", dev.devnode());120 log_debug("udev:device removed %s", dev.devnode());
121 device_removed(dev);121 device_removed(dev);
122 }122 }
123 if (event == mu::Monitor::CHANGED)123 if (event == mu::Monitor::CHANGED)
124 {124 {
125 log_info("udev:device changed %s", dev.devnode());125 log_debug("udev:device changed %s", dev.devnode());
126 device_changed(dev);126 device_changed(dev);
127 }127 }
128 });128 });
@@ -138,7 +138,7 @@
138 {138 {
139 if (device.devnode() != nullptr)139 if (device.devnode() != nullptr)
140 {140 {
141 log_info("udev:device added %s", device.devnode());141 log_debug("udev:device added %s", device.devnode());
142 device_added(device);142 device_added(device);
143 }143 }
144 }144 }
@@ -156,7 +156,7 @@
156 if (!device_ptr)156 if (!device_ptr)
157 {157 {
158 report->failed_to_open_input_device(dev.devnode(), "evdev-input");158 report->failed_to_open_input_device(dev.devnode(), "evdev-input");
159 log_info("libinput refused to open device %s", dev.devnode());159 log_debug("libinput refused to open device %s", dev.devnode());
160 return;160 return;
161 }161 }
162162
@@ -177,7 +177,7 @@
177 report->opened_input_device(dev.devnode(), "evdev-input");177 report->opened_input_device(dev.devnode(), "evdev-input");
178 } catch(...)178 } catch(...)
179 {179 {
180 mir::log_error("Failure opening device %s", dev.devnode());180 log_error("Failure opening device %s", dev.devnode());
181 report->failed_to_open_input_device(dev.devnode(), "evdev-input");181 report->failed_to_open_input_device(dev.devnode(), "evdev-input");
182 }182 }
183}183}
184184
=== modified file 'src/server/input/default_input_device_hub.cpp'
--- src/server/input/default_input_device_hub.cpp 2015-10-19 10:00:22 +0000
+++ src/server/input/default_input_device_hub.cpp 2015-11-03 15:24:07 +0000
@@ -35,12 +35,42 @@
35#include "boost/throw_exception.hpp"35#include "boost/throw_exception.hpp"
3636
37#include <algorithm>37#include <algorithm>
38#include <sstream>
38#include <atomic>39#include <atomic>
3940
40namespace mi = mir::input;41namespace mi = mir::input;
41namespace geom = mir::geometry;42namespace geom = mir::geometry;
42namespace mev = mir::events;43namespace mev = mir::events;
4344
45namespace
46{
47std::string to_string(mi::DeviceCapabilities caps)
48{
49 std::stringstream out;
50 if (contains(caps, mi::DeviceCapability::touchpad))
51 out << " touchpad";
52 else if (contains(caps, mi::DeviceCapability::pointer))
53 out << " mouse";
54
55 if (contains(caps, mi::DeviceCapability::multitouch) ||
56 contains(caps, mi::DeviceCapability::touchscreen))
57 out << " touchscreen";
58
59 if (contains(caps, mi::DeviceCapability::joystick))
60 out << " joystick";
61 else if (contains(caps, mi::DeviceCapability::gamepad))
62 out << " gamepad";
63
64 if (contains(caps, mi::DeviceCapability::alpha_numeric))
65 out << " keyboard";
66 else if (contains(caps, mi::DeviceCapability::keyboard))
67 out << " keypad";
68
69 return out.str();
70}
71
72}
73
44mi::DefaultInputDeviceHub::DefaultInputDeviceHub(74mi::DefaultInputDeviceHub::DefaultInputDeviceHub(
45 std::shared_ptr<mi::InputDispatcher> const& input_dispatcher,75 std::shared_ptr<mi::InputDispatcher> const& input_dispatcher,
46 std::shared_ptr<dispatch::MultiplexingDispatchable> const& input_multiplexer,76 std::shared_ptr<dispatch::MultiplexingDispatchable> const& input_multiplexer,
@@ -233,6 +263,7 @@
233{263{
234 handles.push_back(handle);264 handles.push_back(handle);
235265
266 log_info("Input device %d:%s added as%s", handle->id(), handle->name().c_str(), to_string(handle->capabilities()).c_str());
236 for (auto const& observer : observers)267 for (auto const& observer : observers)
237 {268 {
238 observer->device_added(handles.back());269 observer->device_added(handles.back());
@@ -248,6 +279,8 @@
248279
249 if (handle_it == end(handles))280 if (handle_it == end(handles))
250 return;281 return;
282
283 log_info("Input device %d:%s removed", (*handle_it)->id(), (*handle_it)->name().c_str());
251 for (auto const& observer : observers)284 for (auto const& observer : observers)
252 {285 {
253 observer->device_removed(*handle_it);286 observer->device_removed(*handle_it);

Subscribers

People subscribed via source and target branches