2013-05-31 15:41:17 +00:00
|
|
|
include $(TOPDIR)/rules.mk
|
|
|
|
|
|
|
|
PKG_NAME:=usbmode
|
2018-09-19 01:32:19 +00:00
|
|
|
PKG_RELEASE:=2
|
2013-05-31 15:41:17 +00:00
|
|
|
|
|
|
|
PKG_SOURCE_PROTO:=git
|
2018-09-19 01:32:19 +00:00
|
|
|
PKG_SOURCE_URL:=$(PROJECT_GIT)/project/usbmode.git
|
2017-12-19 19:49:06 +00:00
|
|
|
PKG_SOURCE_DATE:=2017-12-19
|
|
|
|
PKG_SOURCE_VERSION:=f40f84c27534159066c94dadc0c08e0b255c3e26
|
|
|
|
PKG_MIRROR_HASH:=840c7ee2843102b09d8943a20820025251cc259385e2b0bde6b7c8cce8190f83
|
2013-05-31 15:41:17 +00:00
|
|
|
CMAKE_INSTALL:=1
|
|
|
|
|
2014-11-02 12:20:54 +00:00
|
|
|
PKG_LICENSE:=GPL-2.0
|
2013-05-31 15:41:17 +00:00
|
|
|
PKG_LICENSE_FILES:=
|
|
|
|
|
2016-06-07 06:58:31 +00:00
|
|
|
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
|
2013-05-31 15:41:17 +00:00
|
|
|
|
2018-09-19 01:32:19 +00:00
|
|
|
PKG_DATA_VERSION:=20170806
|
2013-05-31 15:41:17 +00:00
|
|
|
PKG_DATA_URL:=http://www.draisberghof.de/usb_modeswitch
|
|
|
|
PKG_DATA_PATH:=usb-modeswitch-data-$(PKG_DATA_VERSION)
|
|
|
|
PKG_DATA_FILENAME:=$(PKG_DATA_PATH).tar.bz2
|
|
|
|
|
|
|
|
include $(INCLUDE_DIR)/package.mk
|
|
|
|
include $(INCLUDE_DIR)/cmake.mk
|
|
|
|
|
|
|
|
define Download/data
|
|
|
|
FILE:=$(PKG_DATA_FILENAME)
|
|
|
|
URL:=$(PKG_DATA_URL)
|
2018-09-19 01:32:19 +00:00
|
|
|
HASH:=ce413ef2a50e648e9c81bc3ea6110e7324a8bf981034fc9ec4467d3562563c2c
|
2013-05-31 15:41:17 +00:00
|
|
|
endef
|
|
|
|
$(eval $(call Download,data))
|
|
|
|
|
|
|
|
define Package/usb-modeswitch
|
|
|
|
SECTION:=utils
|
|
|
|
CATEGORY:=Utilities
|
|
|
|
DEPENDS:=+libubox +libblobmsg-json +libusb-1.0
|
|
|
|
TITLE:=USB mode switching utility
|
|
|
|
endef
|
|
|
|
|
|
|
|
define Build/Prepare
|
|
|
|
$(Build/Prepare/Default)
|
|
|
|
tar xvfj $(DL_DIR)/$(PKG_DATA_FILENAME) -C $(PKG_BUILD_DIR)
|
2017-05-24 14:32:18 +00:00
|
|
|
#remove devices with unsupported modes
|
|
|
|
for filevar in $(PKG_BUILD_DIR)/$(PKG_DATA_PATH)/usb_modeswitch.d/* ; \
|
|
|
|
do \
|
|
|
|
if grep -q -E '(Quanta|Option|Blackberry|Pantech)Mode' "$$$$filevar" ; then \
|
|
|
|
rm "$$$$filevar" ; \
|
|
|
|
fi \
|
|
|
|
done
|
2014-08-26 08:39:55 +00:00
|
|
|
cp ./data/* $(PKG_BUILD_DIR)/$(PKG_DATA_PATH)/usb_modeswitch.d/
|
2016-10-11 18:01:21 +00:00
|
|
|
#in order to keep the Lede GIT repo free of filenames with colons,
|
|
|
|
#we name the files xxxx-yyyy
|
|
|
|
# and rename here after copying to the build directory
|
|
|
|
for filevar in $(PKG_BUILD_DIR)/$(PKG_DATA_PATH)/usb_modeswitch.d/*-* ; \
|
|
|
|
do \
|
|
|
|
[ -f "$$$$filevar" ] || continue ; \
|
|
|
|
FILENAME=$$$$(basename $$$$filevar) ; \
|
|
|
|
NEWNAME=$$$${FILENAME//-/:} ; \
|
|
|
|
rm "$(PKG_BUILD_DIR)/$(PKG_DATA_PATH)/usb_modeswitch.d/$$$$NEWNAME" ; \
|
|
|
|
mv "$(PKG_BUILD_DIR)/$(PKG_DATA_PATH)/usb_modeswitch.d/$$$$FILENAME" "$(PKG_BUILD_DIR)/$(PKG_DATA_PATH)/usb_modeswitch.d/$$$$NEWNAME" ; \
|
|
|
|
done
|
2013-05-31 15:41:17 +00:00
|
|
|
endef
|
|
|
|
|
|
|
|
define Package/usb-modeswitch/install
|
2013-12-13 16:43:15 +00:00
|
|
|
$(INSTALL_DIR) $(1)/etc/hotplug.d/usb $(1)/etc/init.d $(1)/sbin
|
2013-05-31 15:41:17 +00:00
|
|
|
perl $(PKG_BUILD_DIR)/convert-modeswitch.pl \
|
|
|
|
$(PKG_BUILD_DIR)/$(PKG_DATA_PATH)/usb_modeswitch.d/* \
|
|
|
|
> $(1)/etc/usb-mode.json
|
2018-09-19 01:32:19 +00:00
|
|
|
$(INSTALL_CONF) ./files/usbmode.hotplug $(1)/etc/hotplug.d/usb/20-usb_mode
|
2013-12-13 16:43:15 +00:00
|
|
|
$(INSTALL_BIN) ./files/usbmode.init $(1)/etc/init.d/usbmode
|
2013-05-31 15:41:17 +00:00
|
|
|
$(CP) $(PKG_INSTALL_DIR)/usr/sbin/usbmode $(1)/sbin/
|
|
|
|
endef
|
|
|
|
|
|
|
|
$(eval $(call BuildPackage,usb-modeswitch))
|