package init
This commit is contained in:
commit
d23c1e2c77
@ -0,0 +1,48 @@
|
|||||||
|
From 7f54d304149f405dc70ac924471df0d5e3e5ea09 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Gavin Li <gavinli@thegavinli.com>
|
||||||
|
Date: Sun, 14 Jan 2018 02:10:18 -0800
|
||||||
|
Subject: [PATCH 1/2] udev: ensure that all events relating to device are
|
||||||
|
tagged systemd
|
||||||
|
|
||||||
|
systemd will not restart the usbmuxd service the after the first time it
|
||||||
|
is plugged in if it does not receive the "remove" events, which also
|
||||||
|
happen to lack the idVendor and idProduct attributes, so use
|
||||||
|
ENV{PRODUCT} instead.
|
||||||
|
---
|
||||||
|
configure.ac | 2 +-
|
||||||
|
udev/39-usbmuxd.rules.in | 7 +++++--
|
||||||
|
2 files changed, 6 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/configure.ac b/configure.ac
|
||||||
|
index b836f45..1ce46d8 100644
|
||||||
|
--- a/configure.ac
|
||||||
|
+++ b/configure.ac
|
||||||
|
@@ -74,7 +74,7 @@ fi
|
||||||
|
AM_CONDITIONAL(WANT_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno -a "x$with_systemd" = "xyes" ])
|
||||||
|
|
||||||
|
if test "x$with_systemd" = xyes; then
|
||||||
|
- udev_activation_rule="TAG+=\"systemd\", ENV{SYSTEMD_WANTS}=\"usbmuxd.service\""
|
||||||
|
+ udev_activation_rule="ENV{SYSTEMD_WANTS}=\"usbmuxd.service\""
|
||||||
|
else
|
||||||
|
udev_activation_rule="RUN+=\"@sbindir@/usbmuxd --user usbmux --udev\""
|
||||||
|
fi
|
||||||
|
diff --git a/udev/39-usbmuxd.rules.in b/udev/39-usbmuxd.rules.in
|
||||||
|
index 91b14db..7d14d22 100644
|
||||||
|
--- a/udev/39-usbmuxd.rules.in
|
||||||
|
+++ b/udev/39-usbmuxd.rules.in
|
||||||
|
@@ -1,7 +1,10 @@
|
||||||
|
# usbmuxd (Apple Mobile Device Muxer listening on /var/run/usbmuxd)
|
||||||
|
|
||||||
|
+# systemd should receive all events relating to device
|
||||||
|
+SUBSYSTEM=="usb", ENV{PRODUCT}=="5ac/12[9a][0-9a-f]/*", TAG+="systemd"
|
||||||
|
+
|
||||||
|
# Initialize iOS devices into "deactivated" USB configuration state and activate usbmuxd
|
||||||
|
-ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="05ac", ATTR{idProduct}=="12[9a][0-9a-f]", ENV{USBMUX_SUPPORTED}="1", ATTR{bConfigurationValue}="0", OWNER="usbmux", @udev_activation_rule@
|
||||||
|
+SUBSYSTEM=="usb", ENV{PRODUCT}=="5ac/12[9a][0-9a-f]/*", ACTION=="add", ENV{USBMUX_SUPPORTED}="1", ATTR{bConfigurationValue}="0", OWNER="usbmux", @udev_activation_rule@
|
||||||
|
|
||||||
|
# Exit usbmuxd when the last device is removed
|
||||||
|
-ACTION=="remove", SUBSYSTEM=="usb", ENV{PRODUCT}=="5ac/12[9a][0-9a-f]/*", ENV{INTERFACE}=="255/*", RUN+="@sbindir@/usbmuxd -x"
|
||||||
|
+SUBSYSTEM=="usb", ENV{PRODUCT}=="5ac/12[9a][0-9a-f]/*", ACTION=="remove", RUN+="@sbindir@/usbmuxd -x"
|
||||||
|
--
|
||||||
|
2.17.0
|
||||||
|
|
||||||
33
0001-udev-Handle-all-events-only-once.patch
Normal file
33
0001-udev-Handle-all-events-only-once.patch
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
From b888970f68fb16961a7cc3a526065fab7a5d96ca Mon Sep 17 00:00:00 2001
|
||||||
|
From: Rudolf Tammekivi <rtammekivi@gmail.com>
|
||||||
|
Date: Wed, 31 Jan 2018 01:10:54 +0100
|
||||||
|
Subject: [PATCH 2/2] udev: Handle all events only once
|
||||||
|
|
||||||
|
This fixes spontaneous USB reconfiguration causing "remove" event to be sent to
|
||||||
|
the daemon, which causes it to close itself if it did not have enough time to
|
||||||
|
connect to phone.
|
||||||
|
---
|
||||||
|
udev/39-usbmuxd.rules.in | 6 +++---
|
||||||
|
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/udev/39-usbmuxd.rules.in b/udev/39-usbmuxd.rules.in
|
||||||
|
index 7d14d22..140869e 100644
|
||||||
|
--- a/udev/39-usbmuxd.rules.in
|
||||||
|
+++ b/udev/39-usbmuxd.rules.in
|
||||||
|
@@ -1,10 +1,10 @@
|
||||||
|
# usbmuxd (Apple Mobile Device Muxer listening on /var/run/usbmuxd)
|
||||||
|
|
||||||
|
# systemd should receive all events relating to device
|
||||||
|
-SUBSYSTEM=="usb", ENV{PRODUCT}=="5ac/12[9a][0-9a-f]/*", TAG+="systemd"
|
||||||
|
+SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{PRODUCT}=="5ac/12[9a][0-9a-f]/*", TAG+="systemd"
|
||||||
|
|
||||||
|
# Initialize iOS devices into "deactivated" USB configuration state and activate usbmuxd
|
||||||
|
-SUBSYSTEM=="usb", ENV{PRODUCT}=="5ac/12[9a][0-9a-f]/*", ACTION=="add", ENV{USBMUX_SUPPORTED}="1", ATTR{bConfigurationValue}="0", OWNER="usbmux", @udev_activation_rule@
|
||||||
|
+SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{PRODUCT}=="5ac/12[9a][0-9a-f]/*", ACTION=="add", ENV{USBMUX_SUPPORTED}="1", ATTR{bConfigurationValue}="0", OWNER="usbmux", @udev_activation_rule@
|
||||||
|
|
||||||
|
# Exit usbmuxd when the last device is removed
|
||||||
|
-SUBSYSTEM=="usb", ENV{PRODUCT}=="5ac/12[9a][0-9a-f]/*", ACTION=="remove", RUN+="@sbindir@/usbmuxd -x"
|
||||||
|
+SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{PRODUCT}=="5ac/12[9a][0-9a-f]/*", ACTION=="remove", RUN+="@sbindir@/usbmuxd -x"
|
||||||
|
--
|
||||||
|
2.17.0
|
||||||
|
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
From a4c34c493e5d40395b55871b52b75f33550b9590 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Bastien Nocera <hadess@hadess.net>
|
||||||
|
Date: Wed, 18 Apr 2018 15:00:25 +0200
|
||||||
|
Subject: [PATCH] udev: Work around systemd bug related to bind events
|
||||||
|
|
||||||
|
Make sure that udev doesn't lose our properties when bind events come
|
||||||
|
in, as implemented in kernels 4.12+.
|
||||||
|
|
||||||
|
See https://github.com/systemd/systemd/issues/8221
|
||||||
|
and https://github.com/systemd/systemd/issues/7109
|
||||||
|
---
|
||||||
|
udev/39-usbmuxd.rules.in | 3 +++
|
||||||
|
1 file changed, 3 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/udev/39-usbmuxd.rules.in b/udev/39-usbmuxd.rules.in
|
||||||
|
index 140869e..4e84755 100644
|
||||||
|
--- a/udev/39-usbmuxd.rules.in
|
||||||
|
+++ b/udev/39-usbmuxd.rules.in
|
||||||
|
@@ -6,5 +6,8 @@ SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{PRODUCT}=="5ac/12[9a][0-9a-f]/
|
||||||
|
# Initialize iOS devices into "deactivated" USB configuration state and activate usbmuxd
|
||||||
|
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{PRODUCT}=="5ac/12[9a][0-9a-f]/*", ACTION=="add", ENV{USBMUX_SUPPORTED}="1", ATTR{bConfigurationValue}="0", OWNER="usbmux", @udev_activation_rule@
|
||||||
|
|
||||||
|
+# Make sure properties don't get lost when bind action is called
|
||||||
|
+SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{PRODUCT}=="5ac/12[9a][0-9a-f]/*", ACTION=="bind", ENV{USBMUX_SUPPORTED}="1", OWNER="usbmux", @udev_activation_rule@
|
||||||
|
+
|
||||||
|
# Exit usbmuxd when the last device is removed
|
||||||
|
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{PRODUCT}=="5ac/12[9a][0-9a-f]/*", ACTION=="remove", RUN+="@sbindir@/usbmuxd -x"
|
||||||
|
--
|
||||||
|
2.17.0
|
||||||
|
|
||||||
BIN
usbmuxd-1.1.0.tar.bz2
Normal file
BIN
usbmuxd-1.1.0.tar.bz2
Normal file
Binary file not shown.
67
usbmuxd.spec
Normal file
67
usbmuxd.spec
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
Name: usbmuxd
|
||||||
|
Version: 1.1.0
|
||||||
|
Release: 16
|
||||||
|
Summary: Daemon for communicating with Apple's iOS devices
|
||||||
|
License: GPLv3+ or GPLv2+
|
||||||
|
URL: http://www.libimobiledevice.org/
|
||||||
|
Source0: http://www.libimobiledevice.org/downloads/%{name}-%{version}.tar.bz2
|
||||||
|
|
||||||
|
Patch0000: 0000-udev-ensure-that-all-events-relating-to-device-are-t.patch
|
||||||
|
Patch0001: 0001-udev-Handle-all-events-only-once.patch
|
||||||
|
Patch0002: 0002-udev-Work-around-systemd-bug-related-to-bind-events.patch
|
||||||
|
|
||||||
|
BuildRequires: gcc libimobiledevice-devel libplist-devel libusbx-devel systemd autoconf libtool automake
|
||||||
|
Requires(pre): shadow-utils
|
||||||
|
Requires(post): systemd
|
||||||
|
Requires(preun): systemd
|
||||||
|
Requires(postun): systemd
|
||||||
|
|
||||||
|
%description
|
||||||
|
usbmuxd is a socket daemon to multiplex connections from and to iOS devices.It allows multiple
|
||||||
|
services on the device to be accessed simultaneously.
|
||||||
|
|
||||||
|
%package help
|
||||||
|
Summary: Help package for %{name}
|
||||||
|
|
||||||
|
%description help
|
||||||
|
This package contains some man help files for %{name}.
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%autosetup -n %{name}-%{version} -p1
|
||||||
|
autoreconf -f -i
|
||||||
|
sed -i 's/OWNER="usbmux"/OWNER="usbmuxd"/' udev/39-usbmuxd.rules.in
|
||||||
|
sed -i 's/--user usbmux/--user usbmuxd/' systemd/usbmuxd.service.in
|
||||||
|
|
||||||
|
%build
|
||||||
|
%configure
|
||||||
|
%make_build V=1
|
||||||
|
|
||||||
|
%install
|
||||||
|
%make_install
|
||||||
|
|
||||||
|
%pre
|
||||||
|
getent group usbmuxd >/dev/null || groupadd -r usbmuxd -g 113
|
||||||
|
getent passwd usbmuxd >/dev/null || useradd -r -g usbmuxd -d / -s /sbin/nologin -c "usbmuxd user" -u 113 usbmuxd
|
||||||
|
exit 0
|
||||||
|
|
||||||
|
%post
|
||||||
|
%systemd_post usbmuxd.service
|
||||||
|
|
||||||
|
%preun
|
||||||
|
%systemd_preun usbmuxd.service
|
||||||
|
|
||||||
|
%postun
|
||||||
|
%systemd_postun_with_restart usbmuxd.service
|
||||||
|
|
||||||
|
%files
|
||||||
|
%doc AUTHORS README COPYING.GPLv2 COPYING.GPLv3
|
||||||
|
%{_unitdir}/usbmuxd.service
|
||||||
|
%{_udevrulesdir}/39-usbmuxd.rules
|
||||||
|
%{_sbindir}/usbmuxd
|
||||||
|
|
||||||
|
%files help
|
||||||
|
%{_datadir}/man/man1/usbmuxd.1.gz
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
* Fri Nov 29 2019 lingsheng <lingsheng@huawei.com> - 1.1.0-16
|
||||||
|
- Package init
|
||||||
Loading…
x
Reference in New Issue
Block a user