usbmode: add an init script to switch devices that show up too early for the hotplug...
authorFelix Fietkau <nbd@openwrt.org>
Fri, 13 Dec 2013 16:43:15 +0000 (16:43 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Fri, 13 Dec 2013 16:43:15 +0000 (16:43 +0000)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
SVN-Revision: 39047

package/utils/usbmode/Makefile
package/utils/usbmode/files/usbmode.hotplug
package/utils/usbmode/files/usbmode.init [new file with mode: 0755]

index f88b48c06097e3399d41b1889df6f6c4b39b5040..536f4b11d563b2b36d1ae00966eb69a044d6de4b 100644 (file)
@@ -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
 
index 4ef2bd8daaff75397c6e17198b244febabdd1f21..b238894b1dc2974187ebc797527717e7e94ce0ba 100644 (file)
@@ -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 (executable)
index 0000000..43e8ec5
--- /dev/null
@@ -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
+}