Skip to contentSkip to conversation

usb_modeswitch update and add data

PATCH Superseded J.C. Woltz 1 participant 3 messages Feb 19, 2012

lore
Share & tools
lore

J.C. Woltz

author
#0 lore raw

v5 cover usb_modeswitch update and add data

These two patches update usb_modeswitch to the latest version and add the data files in a separate package.

The first patch updates usb_modeswitch to version 1.2.3. usb_modeswitch itself includes bug fixes and a few new device additions.

The second patch is an addition for buildroot. It adds the usb_modeswicth_data which is very helpful. It contains rules for many devices. On most systems, these two programs are installed together. This data package contains udev rules to automatically switch the device on detection.

The second patch also depends on the tcl patch sent in. This way usb_modeswitch_data can select tclsh in order to get tcl.

J.C. Woltz (2):
usb_modeswitch: update to 1.2.3
new program: usb_modeswitch_data

 package/Config.in                                  |    1 +
 .../usb_modeswitch/usb_modeswitch-makefile.patch   |   43 ++++++++++----------
 package/usb_modeswitch/usb_modeswitch.mk           |   20 ++++++---
 package/usb_modeswitch_data/Config.in              |   11 +++++
 .../usb_modeswitch_data-makefile.patch             |   27 ++++++++++++
 package/usb_modeswitch_data/usb_modeswitch_data.mk |   26 ++++++++++++
 6 files changed, 100 insertions(+), 28 deletions(-)
 create mode 100644 package/usb_modeswitch_data/Config.in
 create mode 100644 package/usb_modeswitch_data/usb_modeswitch_data-makefile.patch
 create mode 100644 package/usb_modeswitch_data/usb_modeswitch_data.mk
Signature · 1 line
1.7.5.4
author
#1 lore raw

PATCH v5 1/2 usb_modeswitch: update to 1.2.3

This patch updates usb_modeswitch to version 1.2.3.
The usb_modeswitch.mk needed to be modified for usb_modeswitch to compile. Also added extra remove section for the added help scripts and files.

---
replace TARGET_MAKE_ENV and add USB_MODESWITCH_UNINSTALL_CMDS as recommended by Arnout Vandecappelle

Other version information has been lost

version 5:
added explanation to patch

 .../usb_modeswitch/usb_modeswitch-makefile.patch   |   43 ++++++++++----------
 package/usb_modeswitch/usb_modeswitch.mk           |   20 ++++++---
 2 files changed, 35 insertions(+), 28 deletions(-)
package/usb_modeswitch/usb_modeswitch-makefile.patch +22 -21
index 918200b..55b0b3d 100644
@@ -1,23 +1,24 @@
-diff -Nura usb-modeswitch-1.1.2.orig/Makefile usb-modeswitch-1.1.2/Makefile
---- usb-modeswitch-1.1.2.orig/Makefile	2010-04-17 15:27:11.000000000 -0300
-+++ usb-modeswitch-1.1.2/Makefile	2010-04-22 15:05:32.363471807 -0300
-@@ -1,6 +1,6 @@
- PROG        = usb_modeswitch
- VERS        = 1.1.2
--CC          = gcc
-+CC          ?= gcc
- CFLAGS      += -Wall -l usb
- RM          = /bin/rm -f
- OBJS        = usb_modeswitch.c
-@@ -23,8 +23,9 @@
- install: all
- 	install -d $(SBINDIR)
- 	install --mode=755 usb_modeswitch $(SBINDIR)/usb_modeswitch
--	install --mode=755 usb_modeswitch.tcl $(UDEVDIR)/usb_modeswitch
--	install --mode=644 usb_modeswitch.conf $(ETCDIR)/usb_modeswitch.conf
-+	#install --mode=755 usb_modeswitch.tcl $(UDEVDIR)/usb_modeswitch
-+	#install --mode=644 usb_modeswitch.conf $(ETCDIR)/usb_modeswitch.conf
-+	install -d $(MANDIR)
- 	install --mode=644 usb_modeswitch.1 $(MANDIR)/usb_modeswitch.1
+Removed the -s from the install command. Without this, usb_modeswitch woulc
+fail to install. 
+
+Signed-off-by: J.C. Woltz <[email protected]>
+--- usb_modeswitch-1.2.3.orig/Makefile.orig	2012-02-06 14:00:15.000000000 -0500
++++ usb_modeswitch-1.2.3/Makefile	2012-02-06 14:01:13.000000000 -0500
+@@ -46,7 +46,7 @@
+ 	cd jim && $(MAKE) distclean
  
+ install-common:
+-	install -D -s --mode=755 usb_modeswitch $(SBINDIR)/usb_modeswitch
++	install -D --mode=755 usb_modeswitch $(SBINDIR)/usb_modeswitch
+ 	install -D --mode=755 usb_modeswitch.sh $(UDEVDIR)/usb_modeswitch
+ 	install -D --mode=644 usb_modeswitch.conf $(ETCDIR)/usb_modeswitch.conf
+ 	install -D --mode=644 usb_modeswitch.1 $(MANDIR)/usb_modeswitch.1
+@@ -65,7 +65,7 @@
+ 	install -D --mode=755 usb_modeswitch_dispatcher $(SBINDIR)/usb_modeswitch_dispatcher
+ 
+ install-binary:
+-	install -D -s --mode=755 usb_modeswitch_dispatcher $(SBINDIR)/usb_modeswitch_dispatcher
++	install -D --mode=755 usb_modeswitch_dispatcher $(SBINDIR)/usb_modeswitch_dispatcher
+ 
+ install: all install-common install-script
  
package/usb_modeswitch/usb_modeswitch.mk +13 -7
index 7b982d8..c8b24db 100644
@@ -4,25 +4,31 @@
 #
 #############################################################
 
-USB_MODESWITCH_VERSION = 1.1.2
+USB_MODESWITCH_VERSION = 1.2.3
 USB_MODESWITCH_SOURCE = usb-modeswitch-$(USB_MODESWITCH_VERSION).tar.bz2
 USB_MODESWITCH_SITE = http://www.draisberghof.de/usb_modeswitch
 USB_MODESWITCH_DEPENDENCIES = libusb-compat
 
 define USB_MODESWITCH_BUILD_CMDS
-	$(TARGET_CONFIGURE_OPTS) $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)
+	$(TARGET_MAKE_ENV) $(MAKE) CC="$(TARGET_CC)" LD="$(TARGET_LD)" -C $(@D)
 endef
 
 define USB_MODESWITCH_INSTALL_TARGET_CMDS
 	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) DESTDIR=$(TARGET_DIR) install
-	$(INSTALL) -D $(@D)/usb_modeswitch.setup -m 0644 \
-		$(TARGET_DIR)/etc/usb_modeswitch.setup
 endef
 
+
 define USB_MODESWITCH_CLEAN_CMDS
-	rm -f $(TARGET_DIR)/usr/sbin/usb_modeswitch
-	rm -f $(TARGET_DIR)/etc/usb_modeswitch.setup
-	rm -f $(TARGET_DIR)/usr/share/man/man1/usb_modeswitch.1
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) DESTDIR=$(TARGET_DIR) clean
+endef
+
+define USB_MODESWITCH_UNINSTALL_CMDS
+	$(RM) -f $(TARGET_DIR)/usr/sbin/usb_modeswitch
+	$(RM) -f $(TARGET_DIR)/lib/udev/usb_modeswitch
+	$(RM) -f $(TARGET_DIR)/etc/usb_modeswitch.setup
+	$(RM) -f $(TARGET_DIR)/usr/share/man/man1/usb_modeswitch.1
+	$(RM) -rf $(TARGET_DIR)/var/lib/usb_modeswitch
+	$(RM) -f $(TARGET_DIR)/usr/sbin/usb_modeswitch_dispatcher
 endef
 
 $(eval $(call GENTARGETS))
Signature · 1 line
1.7.5.4
author
#2 lore raw

PATCH v5 2/2 new program: usb_modeswitch_data

In reply to J.C. Woltz

usb_modeswitch_data provides udev rules for usb VID/PID combinations to switch usb deices from their default mode into a more useable mode. The default mode usually is a cdrom with installation software that is of little use in an embedded linux situation

---
version 3:
Fix usb_modeswitch_data to depend usb_modeswitch
add $(TARGET_CONFIGURE_OPTS) to be consistent with usb_modeswitch

version 4:
fix error. change to $(TARGET_MAKE_ENV) from $(TARGET_CONFIGURE_OPTS)

updated to use "select" instead of "depends on" as recommended by Arnout Vandecappelle
Added a select for TCL and BR2_PACKAGE_TCL_TCLSH
This depends on the patch submitted by:
Arnout Vandecappelle

version 5:
Added explanation to patch and a signoff line
This should be final. This includes all changes mentioned by others on the mailing list.

 package/Config.in                                  |    1 +
 package/usb_modeswitch_data/Config.in              |   11 ++++++++
 .../usb_modeswitch_data-makefile.patch             |   27 ++++++++++++++++++++
 package/usb_modeswitch_data/usb_modeswitch_data.mk |   26 +++++++++++++++++++
 4 files changed, 65 insertions(+), 0 deletions(-)
 create mode 100644 package/usb_modeswitch_data/Config.in
 create mode 100644 package/usb_modeswitch_data/usb_modeswitch_data-makefile.patch
 create mode 100644 package/usb_modeswitch_data/usb_modeswitch_data.mk
package/Config.in +1 -0
index 8a7c9c4..172f7ab 100644
@@ -220,6 +220,7 @@ source "package/uboot-tools/Config.in"
 source "package/udev/Config.in"
 source "package/unionfs/Config.in"
 source "package/usb_modeswitch/Config.in"
+source "package/usb_modeswitch_data/Config.in"
 source "package/usbmount/Config.in"
 source "package/usbutils/Config.in"
 source "package/wipe/Config.in"
package/usb_modeswitch_data/Config.in new file +11 -0
new file mode 100644
index 0000000..d15e6e7
@@ -0,0 +1,11 @@
+config BR2_PACKAGE_USB_MODESWITCH_DATA
+	select BR2_PACKAGE_USB_MODESWITCH
+	select BR2_PACKAGE_TCL
+	select BR2_PACKAGE_TCL_TCLSH
+	bool "usb_modeswitch_data"
+	help
+	  USB mode switch data
+	  Contains udev rules and events to allow usb_modeswitch to
+	  function automatically
+	  
+	  http://www.draisberghof.de/usb_modeswitch/
package/usb_modeswitch_data/usb_modeswitch_data-makefile.patch new file +27 -0
new file mode 100644
index 0000000..769e514
@@ -0,0 +1,27 @@
+Fixed Makefile install sections to not reload udev rules. In a 
+cross-compiler environment, it is not wanted to reload the host udev rules.
+
+Signed-off-by: J.C. Woltz <[email protected]>
+--- usb_modeswitch_data-20120120.orig/Makefile	2012-01-20 17:25:32.000000000 -0500
++++ usb_modeswitch_data-20120120/Makefile	2012-02-06 14:20:47.000000000 -0500
+@@ -12,9 +12,9 @@
+ 
+ clean:
+ 
+-install: files-install db-install rules-reload
++install: files-install db-install
+ 
+-install-packed: files-install db-install-packed rules-reload
++install-packed: files-install db-install-packed
+ 
+ files-install:
+ 	install -d $(PREFIX)/share/usb_modeswitch
+@@ -50,7 +50,7 @@
+ 		fi \
+ 	fi
+ 
+-uninstall: files-uninstall rules-reload
++uninstall: files-uninstall
+ 
+ files-uninstall:
+ 	$(RM) $(RULESDIR)/40-usb_modeswitch.rules
package/usb_modeswitch_data/usb_modeswitch_data.mk new file +26 -0
new file mode 100644
index 0000000..46f5b45
@@ -0,0 +1,26 @@
+#############################################################
+#
+# usb_modeswitch_data
+#
+#############################################################
+
+USB_MODESWITCH_DATA_VERSION = 20120120
+USB_MODESWITCH_DATA_SOURCE = usb-modeswitch-data-$(USB_MODESWITCH_DATA_VERSION).tar.bz2
+USB_MODESWITCH_DATA_SITE = http://www.draisberghof.de/usb_modeswitch
+USB_MODESWITCH_DATA_DEPENDENCIES = usb_modeswitch
+
+define USB_MODESWITCH_DATA_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) CC="$(TARGET_CC)" LD="$(TARGET_LD)" -C $(@D)
+endef
+
+define USB_MODESWITCH_DATA_INSTALL_TARGET_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) DESTDIR=$(TARGET_DIR) install
+endef
+
+
+define USB_MODESWITCH_DATA_CLEAN_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) DESTDIR=$(TARGET_DIR) clean
+endef
+
+$(eval $(call GENTARGETS))
+
Signature · 1 line
1.7.5.4