summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaweł Szewczyk <p.szewczyk@samsung.com>2016-09-26 18:45:47 +0200
committerKarol Lewandowski <k.lewandowsk@samsung.com>2017-03-24 12:55:56 +0100
commitc9ff4d95ea74a5934c4ad31249702e18222ef6ac (patch)
tree80fd99c8ce4b073b7336510a9dc36b3260c57956
parentfbcd7981d4517a600ba4040f402397e0ed984ab5 (diff)
downloadsystemd-c9ff4d95ea74a5934c4ad31249702e18222ef6ac.tar.gz
systemd-c9ff4d95ea74a5934c4ad31249702e18222ef6ac.tar.bz2
systemd-c9ff4d95ea74a5934c4ad31249702e18222ef6ac.zip
core: Fix USB functionfs activation and clarify its documentation (#4188)
There was no certainty about how the path in service file should look like for usb functionfs activation. Because of this it was treated differently in different places, which made this feature unusable. This patch fixes the path to be the *mount directory* of functionfs, not ep0 file path and clarifies in the documentation that ListenUSBFunction should be the location of functionfs mount point, not ep0 file itself. Change-Id: I320c34c0037f2bd6a6f6cf09a90eba632a54e9e9
-rw-r--r--man/systemd.socket.xml6
-rw-r--r--src/core/socket.c7
2 files changed, 4 insertions, 9 deletions
diff --git a/man/systemd.socket.xml b/man/systemd.socket.xml
index 5bf54d8ef3..af002c7c9e 100644
--- a/man/systemd.socket.xml
+++ b/man/systemd.socket.xml
@@ -294,10 +294,10 @@
<term><varname>ListenUSBFunction=</varname></term>
<listitem><para>Specifies a <ulink
url="https://www.kernel.org/doc/Documentation/usb/functionfs.txt">USB
- FunctionFS</ulink> endpoint location to listen on, for
+ FunctionFS</ulink> endpoints location to listen on, for
implementation of USB gadget functions. This expects an
- absolute file system path as the argument. Behavior otherwise
- is very similar to the <varname>ListenFIFO=</varname>
+ absolute file system path of functionfs mount point as the argument.
+ Behavior otherwise is very similar to the <varname>ListenFIFO=</varname>
directive above. Use this to open the FunctionFS endpoint
<filename>ep0</filename>. When using this option, the
activated service has to have the
diff --git a/src/core/socket.c b/src/core/socket.c
index 5824e8db46..4ddee5456e 100644
--- a/src/core/socket.c
+++ b/src/core/socket.c
@@ -1199,14 +1199,9 @@ static int usbffs_select_ep(const struct dirent *d) {
static int usbffs_dispatch_eps(SocketPort *p) {
_cleanup_free_ struct dirent **ent = NULL;
- _cleanup_free_ char *path = NULL;
int r, i, n, k;
- path = dirname_malloc(p->path);
- if (!path)
- return -ENOMEM;
-
- r = scandir(path, &ent, usbffs_select_ep, alphasort);
+ r = scandir(p->path, &ent, usbffs_select_ep, alphasort);
if (r < 0)
return -errno;