[go: nahoru, domu]

Skip to content

Commit

Permalink
Use updated dbus method calls
Browse files Browse the repository at this point in the history
Fixes dnschneid#3375

Due to dbus interface changes in Chrome OS, if one dbus method call fails, then run the other one right after.
  • Loading branch information
farmerbb committed Aug 31, 2017
1 parent 0b3ec2c commit 275395b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/freon.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
system("host-dbus dbus-send --system --dest=org.chromium.LibCrosService " \
"--type=method_call --print-reply /org/chromium/LibCrosService " \
"org.chromium.LibCrosServiceInterface." #function)
#define FREON_DBUS_METHOD_CALL_NEW(function) \
system("host-dbus dbus-send --system --dest=org.chromium.DisplayService " \
"--type=method_call --print-reply /org/chromium/DisplayService " \
"org.chromium.DisplayServiceInterface." #function)

#define TRACE(...) /* fprintf(stderr, __VA_ARGS__) */
#define ERROR(...) fprintf(stderr, __VA_ARGS__)
Expand Down Expand Up @@ -163,6 +167,9 @@ int ioctl(int fd, unsigned long int request, ...) {
if (lockfd != -1) {
TRACE("Telling Chromium OS to regain control\n");
ret = FREON_DBUS_METHOD_CALL(TakeDisplayOwnership);
if (WEXITSTATUS(ret) == 1) {
ret = FREON_DBUS_METHOD_CALL_NEW(TakeOwnership);
}
if (set_display_lock(0) < 0) {
ERROR("Failed to release display lock\n");
}
Expand All @@ -172,6 +179,9 @@ int ioctl(int fd, unsigned long int request, ...) {
if (set_display_lock(getpid()) == 0) {
TRACE("Telling Chromium OS to drop control\n");
ret = FREON_DBUS_METHOD_CALL(ReleaseDisplayOwnership);
if (WEXITSTATUS(ret) == 1) {
ret = FREON_DBUS_METHOD_CALL_NEW(ReleaseOwnership);
}
} else {
ERROR("Unable to claim display lock\n");
ret = -1;
Expand Down

0 comments on commit 275395b

Please sign in to comment.