Mir

Merge lp:~robertcarr/mir/1233944-addendum into lp:~mir-team/mir/trunk

Proposed by kevin gunn
Status: Merged
Approved by: kevin gunn
Approved revision: no longer in the source branch.
Merged at revision: 1089
Proposed branch: lp:~robertcarr/mir/1233944-addendum
Merge into: lp:~mir-team/mir/trunk
Diff against target: 65 lines (+24/-1)
2 files modified
3rd_party/android-input/android/frameworks/base/services/input/EventHub.cpp (+23/-1)
3rd_party/android-input/android/frameworks/base/services/input/EventHub.h (+1/-0)
To merge this branch: bzr merge lp:~robertcarr/mir/1233944-addendum
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Robert Ancell Approve
Review via email: mp+188983@code.launchpad.net

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 when its permissions change as it might be
readable now.

Description of the change

Reproposing from my addendum branch as we want to land this quickly and dandrader is EOD. Thanks dandrader :D

==
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
kevin gunn (kgunn72) wrote :

this change is already approved on lp:~mir-team/mir/development-branch
proposing to trunk to fast track outside of dev branch merger

Revision history for this message
Robert Ancell (robert-ancell) wrote :

As discussed on IRC - this is already merged into the development-branch, so it's OK to merge straight into trunk to save time doing the double merge.

review: Approve
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)
Revision history for this message
Alexandros Frantzis (afrantzis) wrote :

> As discussed on IRC - this is already merged into the development-branch,
> so it's OK to merge straight into trunk to save time doing the double merge.

Although this will probably work fine in most cases, it complicates the history/relationship between lp:mir and the development-branch, making more difficult to figure out what's in each branch that's not in the other. I suggest that we don't make a habit of this, and do the double merge (fix=>devel=>lp:mir) in the future. Doing so keeps things conceptually clean. If we need to fast track we can perform one of the merges manually (i.e. avoiding a second CI run).

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

Agreed. And I gasped for a moment before realizing the same was already in development-branch.

Life should get easier when we abolish development-branch.

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-03 04:45:31 +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@@ -955,6 +955,11 @@
14 char buffer[80];
15
16 ALOGV("Opening device: %s", devicePath);
17+ if (hasDeviceByPathLocked(String8(devicePath)))
18+ {
19+ ALOGV("Not opening device (%s), as it is already opened", devicePath);
20+ return -1;
21+ }
22
23 int fd = open(devicePath, O_RDWR | O_CLOEXEC);
24 if(fd < 0) {
25@@ -1416,6 +1421,14 @@
26 strcpy(filename, event->name);
27 if(event->mask & IN_CREATE) {
28 openDeviceLocked(devname);
29+ } else if (event->mask & IN_ATTRIB) {
30+ Device* device = getDeviceByPathLocked(devname);
31+ if (!device) {
32+ ALOGI("Retry opening device file %s", devname);
33+ // file permissions might have changed, making the device readable now
34+ // let's retry opening it
35+ openDeviceLocked(devname);
36+ }
37 } else {
38 ALOGI("Removing device '%s' due to inotify event\n", devname);
39 closeDeviceByPathLocked(devname);
40@@ -1523,4 +1536,13 @@
41 }
42 }
43
44+bool EventHub::hasDeviceByPathLocked(String8 const& path)
45+{
46+ for (size_t i = 0; i < mDevices.size(); i++) {
47+ auto const& device = mDevices.valueAt(i);
48+ if (device->path == path) return true;
49+ }
50+ return false;
51+}
52+
53 }; // namespace android
54
55=== modified file '3rd_party/android-input/android/frameworks/base/services/input/EventHub.h'
56--- 3rd_party/android-input/android/frameworks/base/services/input/EventHub.h 2013-05-28 17:47:03 +0000
57+++ 3rd_party/android-input/android/frameworks/base/services/input/EventHub.h 2013-10-03 04:45:31 +0000
58@@ -395,6 +395,7 @@
59
60 int32_t mNextDeviceId;
61
62+ bool hasDeviceByPathLocked(String8 const& path);
63 KeyedVector<int32_t, Device*> mDevices;
64
65 Device *mOpeningDevices;

Subscribers

People subscribed via source and target branches