Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
meta-nemo
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
NemoMobile
meta-nemo
Commits
6d4934e0
Commit
6d4934e0
authored
May 17, 2017
by
Florent Revest
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
usb-moded: Only use a timeout when stopping services
parent
0a2c852b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
83 additions
and
33 deletions
+83
-33
0001-systemd-Use-a-default-timeout-of-2sec-for-StopUnit.patch
...-systemd-Use-a-default-timeout-of-2sec-for-StopUnit.patch
+82
-0
0001-systemd-Use-a-default-timeout-of-2sec-to-StartUnit-a.patch
...ystemd-Use-a-default-timeout-of-2sec-to-StartUnit-a.patch
+0
-32
usb-moded_git.bb
recipes-nemomobile/usb-moded/usb-moded_git.bb
+1
-1
No files found.
recipes-nemomobile/usb-moded/usb-moded/0001-systemd-Use-a-default-timeout-of-2sec-for-StopUnit.patch
0 → 100644
View file @
6d4934e0
From 7fb45319984663efd4412eb6df6dc0c3925b8844 Mon Sep 17 00:00:00 2001
From: Florent Revest <revestflo@gmail.com>
Date: Wed, 17 May 2017 12:39:51 +0200
Subject: [PATCH] [systemd] Use a default timeout of 2sec for StopUnit
On my devices, I noticed that adding udhcpd-developer-mode.ini to
/etc/usb-moded/run/
would totally prevent USB from working. It turned
out that usb-moded was trying to call StopUnit on udhcpd.service and
the blocking call would never stop. I had to introduce this timeout to
make sure usb-moded would start properly.
---
src/usb_moded-appsync.c | 6 +++---
src/usb_moded-systemd.c | 4 ++--
src/usb_moded-systemd.h | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/usb_moded-appsync.c b/src/usb_moded-appsync.c
index bfb10b9..9ca6550 100644
--- a/src/usb_moded-appsync.c
+++ b/src/usb_moded-appsync.c
@@ -258,7 +258,7 @@
int activate_sync(const char *mode)
log_debug("launching pre-enum-app %s\n", data->name);
if(data->systemd)
{
- if(!systemd_control_service(data->name, SYSTEMD_START))
+ if(!systemd_control_service(data->name, SYSTEMD_START, -1))
mark_active(data->name, 0);
else
goto error;
@@ -320,7 +320,7 @@
int activate_sync_post(const char *mode)
log_debug("launching post-enum-app %s\n", data->name);
if(data->systemd)
{
- if(systemd_control_service(data->name, SYSTEMD_START))
+ if(systemd_control_service(data->name, SYSTEMD_START, -1))
goto error;
mark_active(data->name, 1);
}
@@ -442,7 +442,7 @@
static void appsync_stop_apps(int post)
if(data->systemd && data->state == APP_STATE_ACTIVE && data->post == post)
{
log_debug("stopping %s-enum-app %s", post ? "post" : "pre", data->name);
- if(systemd_control_service(data->name, SYSTEMD_STOP))
+ if(systemd_control_service(data->name, SYSTEMD_STOP, 2000))
log_debug("Failed to stop %s\n", data->name);
data->state = APP_STATE_DONTCARE;
}
diff --git a/src/usb_moded-systemd.c b/src/usb_moded-systemd.c
index 4a27cfb..9c1ee29 100644
--- a/src/usb_moded-systemd.c
+++ b/src/usb_moded-systemd.c
@@ -57,7 +57,7 @@
static DBusConnection * get_systemd_dbus_connection(void)
// mode = replace
// method = StartUnit or StopUnit
-int systemd_control_service(const char *name, const char *method)
+int systemd_control_service(const char *name, const char *method, int timeout)
{
DBusConnection *bus;
@@ -84,7 +84,7 @@
int systemd_control_service(const char *name, const char *method)
dbus_message_unref(msg);
goto quit;
}
- reply = dbus_connection_send_with_reply_and_block(bus, msg, -1, &error);
+ reply = dbus_connection_send_with_reply_and_block(bus, msg, timeout, &error);
if(reply)
{
dbus_message_unref(reply);
diff --git a/src/usb_moded-systemd.h b/src/usb_moded-systemd.h
index 495d3bd..3343c37 100644
--- a/src/usb_moded-systemd.h
+++ b/src/usb_moded-systemd.h
@@ -22,4 +22,4 @@
#define SYSTEMD_STOP "StopUnit"
#define SYSTEMD_START "StartUnit"
-int systemd_control_service(const char *name, const char *method);
+int systemd_control_service(const char *name, const char *method, int timeout);
--
2.11.0
recipes-nemomobile/usb-moded/usb-moded/0001-systemd-Use-a-default-timeout-of-2sec-to-StartUnit-a.patch
deleted
100644 → 0
View file @
0a2c852b
From a09feee6d7768d0e91e9359bd73e461ab3b0e8c7 Mon Sep 17 00:00:00 2001
From: Florent Revest <revestflo@gmail.com>
Date: Wed, 10 May 2017 20:26:55 +0200
Subject: [PATCH] [systemd] Use a default timeout of 2sec to StartUnit and
StopUnit
On my devices, I noticed that adding udhcpd-developer-mode.ini to
/etc/usb-moded/run/
would totally prevent USB from working. It turned
out that usb-moded was trying to call StopUnit on udhcpd.service and
the blocking call would never stop. I had to introduce this timeout to
make sure usb-moded would start properly. It may break the starting and
stopping time of other services though.
---
src/usb_moded-systemd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/usb_moded-systemd.c b/src/usb_moded-systemd.c
index 4a27cfb..a59ab69 100644
--- a/src/usb_moded-systemd.c
+++ b/src/usb_moded-systemd.c
@@ -84,7 +84,7 @@
int systemd_control_service(const char *name, const char *method)
dbus_message_unref(msg);
goto quit;
}
- reply = dbus_connection_send_with_reply_and_block(bus, msg, -1, &error);
+ reply = dbus_connection_send_with_reply_and_block(bus, msg, 2000, &error);
if(reply)
{
dbus_message_unref(reply);
--
2.11.0
recipes-nemomobile/usb-moded/usb-moded_git.bb
View file @
6d4934e0
...
@@ -8,7 +8,7 @@ SRC_URI = "git://github.com/philippedeswert/usb-moded.git;protocol=https \
...
@@ -8,7 +8,7 @@ SRC_URI = "git://github.com/philippedeswert/usb-moded.git;protocol=https \
file://usb-moded.ini \
file://usb-moded.ini \
file://com.meego.usb_moded.service \
file://com.meego.usb_moded.service \
file://udhcpd.service \
file://udhcpd.service \
file://0001-systemd-Use-a-default-timeout-of-2sec-
to-StartUnit-a
.patch \
file://0001-systemd-Use-a-default-timeout-of-2sec-
for-StopUnit
.patch \
file://init_ffs"
file://init_ffs"
SRCREV = "b2bcc5ba8d1bf3179c73a916f01ab4e0cf0a3526"
SRCREV = "b2bcc5ba8d1bf3179c73a916f01ab4e0cf0a3526"
PR = "r1"
PR = "r1"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment