Add an hotplug script for usb-modeswitch. The script runs usb_modeswitch
without
parameter is a storage class device is plugged.
Signed-off-by: Roberto Riggio <roberto.rig...@create-net.org>
--
Index: utils/usb-modeswitch/files/usb-modeswitch.hotplug
===================================================================
--- utils/usb-modeswitch/files/usb-modeswitch.hotplug (revision 0)
+++ utils/usb-modeswitch/files/usb-modeswitch.hotplug (revision 0)
@@ -0,0 +1,10 @@
+case "$ACTION" in
+ add)
+ # start process
+ # only storage devices are handled
+ if [ "$(echo $INTERFACE | cut -d/ -f1)" = "8" ]; then
+ echo sh -c "sleep 4; /usr/bin/usb_modeswitch"
+ fi
+ ;;
+esac
+
Index: utils/usb-modeswitch/Makefile
===================================================================
--- utils/usb-modeswitch/Makefile (revision 18258)
+++ utils/usb-modeswitch/Makefile (working copy)
@@ -9,7 +9,7 @@
PKG_NAME:=usb_modeswitch
PKG_VERSION:=1.0.5
-PKG_RELEASE:=2
+PKG_RELEASE:=3
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=http://www.draisberghof.de/usb_modeswitch
@@ -31,7 +31,7 @@
endef
define Build/Compile
- $(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_CPPFLAGS) $(TARGET_LDFLAGS) \
+ "$(TARGET_CC)" $(TARGET_CFLAGS) $(TARGET_CPPFLAGS) $(TARGET_LDFLAGS) \
-lusb \
-o $(PKG_BUILD_DIR)/usb_modeswitch-OpenWrt \
$(PKG_BUILD_DIR)/usb_modeswitch.c
@@ -40,6 +40,8 @@
define Package/usb-modeswitch/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/usb_modeswitch-OpenWrt
$(1)/usr/bin/usb_modeswitch
+ $(INSTALL_DIR) $(1)/etc/hotplug.d/usb
+ $(INSTALL_DATA) ./files/usb-modeswitch.hotplug
$(1)/etc/hotplug.d/usb/80-usb-modeswitch
endef
$(eval $(call BuildPackage,usb-modeswitch))
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel