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
=== modified file '3rd_party/android-input/android/frameworks/base/services/input/EventHub.cpp'
--- 3rd_party/android-input/android/frameworks/base/services/input/EventHub.cpp 2013-05-28 17:52:18 +0000
+++ 3rd_party/android-input/android/frameworks/base/services/input/EventHub.cpp 2013-10-03 04:45:31 +0000
@@ -223,7 +223,7 @@
223 LOG_ALWAYS_FATAL_IF(mEpollFd < 0, "Could not create epoll instance. errno=%d", errno);223 LOG_ALWAYS_FATAL_IF(mEpollFd < 0, "Could not create epoll instance. errno=%d", errno);
224224
225 mINotifyFd = inotify_init();225 mINotifyFd = inotify_init();
226 int result = inotify_add_watch(mINotifyFd, DEVICE_PATH, IN_DELETE | IN_CREATE);226 int result = inotify_add_watch(mINotifyFd, DEVICE_PATH, IN_DELETE | IN_CREATE | IN_ATTRIB);
227 LOG_ALWAYS_FATAL_IF(result < 0, "Could not register INotify for %s. errno=%d",227 LOG_ALWAYS_FATAL_IF(result < 0, "Could not register INotify for %s. errno=%d",
228 DEVICE_PATH, errno);228 DEVICE_PATH, errno);
229229
@@ -955,6 +955,11 @@
955 char buffer[80];955 char buffer[80];
956956
957 ALOGV("Opening device: %s", devicePath);957 ALOGV("Opening device: %s", devicePath);
958 if (hasDeviceByPathLocked(String8(devicePath)))
959 {
960 ALOGV("Not opening device (%s), as it is already opened", devicePath);
961 return -1;
962 }
958963
959 int fd = open(devicePath, O_RDWR | O_CLOEXEC);964 int fd = open(devicePath, O_RDWR | O_CLOEXEC);
960 if(fd < 0) {965 if(fd < 0) {
@@ -1416,6 +1421,14 @@
1416 strcpy(filename, event->name);1421 strcpy(filename, event->name);
1417 if(event->mask & IN_CREATE) {1422 if(event->mask & IN_CREATE) {
1418 openDeviceLocked(devname);1423 openDeviceLocked(devname);
1424 } else if (event->mask & IN_ATTRIB) {
1425 Device* device = getDeviceByPathLocked(devname);
1426 if (!device) {
1427 ALOGI("Retry opening device file %s", devname);
1428 // file permissions might have changed, making the device readable now
1429 // let's retry opening it
1430 openDeviceLocked(devname);
1431 }
1419 } else {1432 } else {
1420 ALOGI("Removing device '%s' due to inotify event\n", devname);1433 ALOGI("Removing device '%s' due to inotify event\n", devname);
1421 closeDeviceByPathLocked(devname);1434 closeDeviceByPathLocked(devname);
@@ -1523,4 +1536,13 @@
1523 }1536 }
1524}1537}
15251538
1539bool EventHub::hasDeviceByPathLocked(String8 const& path)
1540{
1541 for (size_t i = 0; i < mDevices.size(); i++) {
1542 auto const& device = mDevices.valueAt(i);
1543 if (device->path == path) return true;
1544 }
1545 return false;
1546}
1547
1526}; // namespace android1548}; // namespace android
15271549
=== modified file '3rd_party/android-input/android/frameworks/base/services/input/EventHub.h'
--- 3rd_party/android-input/android/frameworks/base/services/input/EventHub.h 2013-05-28 17:47:03 +0000
+++ 3rd_party/android-input/android/frameworks/base/services/input/EventHub.h 2013-10-03 04:45:31 +0000
@@ -395,6 +395,7 @@
395395
396 int32_t mNextDeviceId;396 int32_t mNextDeviceId;
397397
398 bool hasDeviceByPathLocked(String8 const& path);
398 KeyedVector<int32_t, Device*> mDevices;399 KeyedVector<int32_t, Device*> mDevices;
399400
400 Device *mOpeningDevices;401 Device *mOpeningDevices;

Subscribers

People subscribed via source and target branches