aboutsummaryrefslogtreecommitdiffstats
path: root/package
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2013-12-13 16:43:15 +0000
committerFelix Fietkau <nbd@openwrt.org>2013-12-13 16:43:15 +0000
commit6a75a79a668b7d8121031bbdcb51df4d276e8f33 (patch)
treed3a5d6e0864a603dcfd5c6e87872155781671439 /package
parent68daab992f20ffcf5e312d562868f6903c9e3d63 (diff)
downloadupstream-6a75a79a668b7d8121031bbdcb51df4d276e8f33.tar.gz
upstream-6a75a79a668b7d8121031bbdcb51df4d276e8f33.tar.bz2
upstream-6a75a79a668b7d8121031bbdcb51df4d276e8f33.zip
usbmode: add an init script to switch devices that show up too early for the hotplug script
Signed-off-by: Felix Fietkau <nbd@openwrt.org> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@39047 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package')
-rw-r--r--package/utils/usbmode/Makefile5
-rw-r--r--package/utils/usbmode/files/usbmode.hotplug8
-rwxr-xr-xpackage/utils/usbmode/files/usbmode.init12
3 files changed, 16 insertions, 9 deletions
diff --git a/package/utils/usbmode/Makefile b/package/utils/usbmode/Makefile
index f88b48c060..536f4b11d5 100644
--- a/package/utils/usbmode/Makefile
+++ b/package/utils/usbmode/Makefile
@@ -46,11 +46,12 @@ define Build/Prepare
endef
define Package/usb-modeswitch/install
- $(INSTALL_DIR) $(1)/etc/hotplug.d/usb $(1)/sbin
+ $(INSTALL_DIR) $(1)/etc/hotplug.d/usb $(1)/etc/init.d $(1)/sbin
perl $(PKG_BUILD_DIR)/convert-modeswitch.pl \
$(PKG_BUILD_DIR)/$(PKG_DATA_PATH)/usb_modeswitch.d/* \
> $(1)/etc/usb-mode.json
- $(CP) ./files/usbmode.hotplug $(1)/etc/hotplug.d/usb/20-usb_mode
+ $(INSTALL_DATA) ./files/usbmode.hotplug $(1)/etc/hotplug.d/usb/20-usb_mode
+ $(INSTALL_BIN) ./files/usbmode.init $(1)/etc/init.d/usbmode
$(CP) $(PKG_INSTALL_DIR)/usr/sbin/usbmode $(1)/sbin/
endef
diff --git a/package/utils/usbmode/files/usbmode.hotplug b/package/utils/usbmode/files/usbmode.hotplug
index 4ef2bd8daa..b238894b1d 100644
--- a/package/utils/usbmode/files/usbmode.hotplug
+++ b/package/utils/usbmode/files/usbmode.hotplug
@@ -1,7 +1 @@
-. /lib/functions/procd.sh
-
-procd_open_service "usbmode"
-procd_open_instance
-procd_set_param command "/sbin/usbmode" -s
-procd_close_instance
-procd_close_service
+/etc/init.d/usbmode start
diff --git a/package/utils/usbmode/files/usbmode.init b/package/utils/usbmode/files/usbmode.init
new file mode 100755
index 0000000000..43e8ec564d
--- /dev/null
+++ b/package/utils/usbmode/files/usbmode.init
@@ -0,0 +1,12 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2013 OpenWrt.org
+
+START=20
+USE_PROCD=1
+
+start_service()
+{
+ procd_open_instance
+ procd_set_param command "/sbin/usbmode" -s
+ procd_close_instance
+}