mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Ladislav Michl <ladis@linux-mips.org>
To: ptxdist@pengutronix.de
Subject: [ptxdist] [PATCH v2] usb_modeswitch: udev helper
Date: Fri, 22 Jan 2016 17:27:58 +0100	[thread overview]
Message-ID: <20160122162758.GA22222@localhost.localdomain> (raw)
In-Reply-To: <20160122151032.GC6233@pengutronix.de>

Install also udev helper and systemd service file

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
---
Changelog:
 - select TCL also depends on RUNTIME
 - simplify 'or' in makefile's ifdef
 - targetinstall file from pkgdir, not srcdir
 (all above pointed by Michael Olbrich, thanks!)

 rules/usb-modeswitch.in   | 20 +++++++++++++++++---
 rules/usb-modeswitch.make | 24 ++++++++++++++++++++++++
 2 files changed, 41 insertions(+), 3 deletions(-)

diff --git a/rules/usb-modeswitch.in b/rules/usb-modeswitch.in
index aaefd86..3ccf31f 100644
--- a/rules/usb-modeswitch.in
+++ b/rules/usb-modeswitch.in
@@ -1,11 +1,25 @@
 ## SECTION=shell_and_console
 
-config USB_MODESWITCH
-	tristate
-	prompt "usb-modeswitch"
+menuconfig USB_MODESWITCH
+	tristate "usb-modeswitch                "
 	select LIBUSB
+	select TCL if (USB_MODESWITCH_UDEV_HELPER || USB_MODESWITCH_SYSTEMD_UNIT) && RUNTIME
 	help
 	  USB_ModeSwitch is (surprise!) a mode switching tool
 	  for controlling 'multi-mode' USB devices.
 
+if USB_MODESWITCH
+
+config USB_MODESWITCH_UDEV_HELPER
+	bool "install udev helper"
+	default y
+	depends on UDEV
+
+config USB_MODESWITCH_SYSTEMD_UNIT
+	bool "install systemd unit file"
+	default y
+	depends on SYSTEMD
+
+endif
+
 # vim: set sw=8 ts=8 noet ft=kconfig:
diff --git a/rules/usb-modeswitch.make b/rules/usb-modeswitch.make
index 4ebf0e8..95149a3 100644
--- a/rules/usb-modeswitch.make
+++ b/rules/usb-modeswitch.make
@@ -37,6 +37,18 @@ USB_MODESWITCH_MAKE_ENV		:= $(CROSS_ENV)
 USB_MODESWITCH_MAKE_OPT		:= $(CROSS_ENV_PROGS)
 
 # ----------------------------------------------------------------------------
+# Install
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/usb-modeswitch.install:
+	@$(call targetinfo)
+	@$(call world/install, USB_MODESWITCH)
+	@mkdir -p $(USB_MODESWITCH_PKGDIR)/lib/systemd/system
+	@install -m 0644 $(USB_MODESWITCH_DIR)/usb_modeswitch@.service \
+		$(USB_MODESWITCH_PKGDIR)/lib/systemd/system/usb_modeswitch@.service
+	@$(call touch)
+
+# ----------------------------------------------------------------------------
 # Target-Install
 # ----------------------------------------------------------------------------
 
@@ -51,6 +63,18 @@ $(STATEDIR)/usb-modeswitch.targetinstall:
 
 	@$(call install_copy, usb-modeswitch, 0, 0, 0755, -, \
 		/usr/sbin/usb_modeswitch)
+ifneq ($(PTXCONF_USB_MODESWITCH_UDEV_HELPER)$(PTXCONF_USB_MODESWITCH_SYSTEMD_UNIT),)
+	@$(call install_copy, usb-modeswitch, 0, 0, 0755, -, \
+		/usr/sbin/usb_modeswitch_dispatcher)
+endif
+ifdef PTXCONF_USB_MODESWITCH_UDEV_HELPER
+	@$(call install_copy, usb-modeswitch, 0, 0, 0755, -, \
+		/lib/udev/usb_modeswitch)
+endif
+ifdef PTXCONF_USB_MODESWITCH_SYSTEMD_UNIT
+	@$(call install_copy, usb-modeswitch, 0, 0, 0644, -, \
+		/lib/systemd/system/usb_modeswitch@.service)
+endif
 
 	@$(call install_finish, usb-modeswitch)
 
-- 
2.1.4


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

  reply	other threads:[~2016-01-22 16:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-22  0:24 [ptxdist] [PATCH] usb_modeswitch: version bump 2.2.1 -> 2.3.0 Ladislav Michl
2016-01-22 13:38 ` [ptxdist] [PATCH] usb_modeswitch: udev helper Ladislav Michl
2016-01-22 15:10   ` Michael Olbrich
2016-01-22 16:27     ` Ladislav Michl [this message]
2016-02-11 11:25       ` [ptxdist] [PATCH v2] " Michael Olbrich
2016-02-11 11:24 ` [ptxdist] [PATCH] usb_modeswitch: version bump 2.2.1 -> 2.3.0 Michael Olbrich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160122162758.GA22222@localhost.localdomain \
    --to=ladis@linux-mips.org \
    --cc=ptxdist@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox