Mir

Merge lp:~dandrader/mir/hack_lp1233944 into lp:mir

Proposed by Daniel d'Andrada
Status: Superseded
Proposed branch: lp:~dandrader/mir/hack_lp1233944
Merge into: lp:mir
Diff against target: 27 lines (+9/-1)
1 file modified
3rd_party/android-input/android/frameworks/base/services/input/EventHub.cpp (+9/-1)
To merge this branch: bzr merge lp:~dandrader/mir/hack_lp1233944
Reviewer Review Type Date Requested Status
Robert Carr (community) Needs Fixing
PS Jenkins bot continuous-integration Pending
Review via email: mp+188889@code.launchpad.net

This proposal has been superseded by a proposal from 2013-10-02.

Commit message

Fix for LP#1233944

Fixes the Mir-side of bug https://bugs.launchpad.net/mir/+bug/1233944

Event files are first created with root:root permissions and only later
udev rules are applied to it, changing its permissions to root:android-input
and therefore making it readable by unity8-mir

in short: Retry opening a file once its permissions changed as it might be
readable now.

The best thing to do is replacing usage of inotify with libudev, but that's a
way bigger change that will left to be done at a later time.

Description of the change

Fixes bug 1233944.

But further work might be required (likely outside mir) due to the following error message when android-input loads the autopilot-finger device file:

"""
[InputReader] Touch device 'autopilot-finger' did not report support for X or Y axis! The device will be inoperable.
"""

To post a comment you must log in.
Revision history for this message
Robert Carr (robertcarr) wrote :

+1

review: Approve
Revision history for this message
Robert Carr (robertcarr) wrote :

I'm worried this may lead to opening devices multiple times. Digging deeper.

review: Needs Information
Revision history for this message
Robert Carr (robertcarr) wrote :

I think this can lead to open devices multiple times (ending with multiple instances in the mDevices member). I think the behavior is a little unclear here...so I've proposed a small fix:

https://code.launchpad.net/~robertcarr/mir/1233944-addendum/+merge/188896

review: Needs Fixing

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '3rd_party/android-input/android/frameworks/base/services/input/EventHub.cpp'
2--- 3rd_party/android-input/android/frameworks/base/services/input/EventHub.cpp 2013-05-28 17:52:18 +0000
3+++ 3rd_party/android-input/android/frameworks/base/services/input/EventHub.cpp 2013-10-02 17:17:25 +0000
4@@ -223,7 +223,7 @@
5 LOG_ALWAYS_FATAL_IF(mEpollFd < 0, "Could not create epoll instance. errno=%d", errno);
6
7 mINotifyFd = inotify_init();
8- int result = inotify_add_watch(mINotifyFd, DEVICE_PATH, IN_DELETE | IN_CREATE);
9+ int result = inotify_add_watch(mINotifyFd, DEVICE_PATH, IN_DELETE | IN_CREATE | IN_ATTRIB);
10 LOG_ALWAYS_FATAL_IF(result < 0, "Could not register INotify for %s. errno=%d",
11 DEVICE_PATH, errno);
12
13@@ -1416,6 +1416,14 @@
14 strcpy(filename, event->name);
15 if(event->mask & IN_CREATE) {
16 openDeviceLocked(devname);
17+ } else if (event->mask & IN_ATTRIB) {
18+ Device* device = getDeviceByPathLocked(devname);
19+ if (!device) {
20+ ALOGI("Retry opening device file %s", devname);
21+ // file permissions might have changed, making the device readable now
22+ // let's retry opening it
23+ openDeviceLocked(devname);
24+ }
25 } else {
26 ALOGI("Removing device '%s' due to inotify event\n", devname);
27 closeDeviceByPathLocked(devname);

Subscribers

People subscribed via source and target branches