summaryrefslogtreecommitdiff
path: root/recipes/usb-gadget-mode/files
diff options
context:
space:
mode:
authorDenys Dmytriyenko <denis@denix.org>2009-03-17 14:32:59 -0400
committerDenys Dmytriyenko <denis@denix.org>2009-03-17 14:32:59 -0400
commit709c4d66e0b107ca606941b988bad717c0b45d9b (patch)
tree37ee08b1eb308f3b2b6426d5793545c38396b838 /recipes/usb-gadget-mode/files
parentfa6cd5a3b993f16c27de4ff82b42684516d433ba (diff)
rename packages/ to recipes/ per earlier agreement
See links below for more details: http://thread.gmane.org/gmane.comp.handhelds.openembedded/21326 http://thread.gmane.org/gmane.comp.handhelds.openembedded/21816 Signed-off-by: Denys Dmytriyenko <denis@denix.org> Acked-by: Mike Westerhof <mwester@dls.net> Acked-by: Philip Balister <philip@balister.org> Acked-by: Khem Raj <raj.khem@gmail.com> Acked-by: Marcin Juszkiewicz <hrw@openembedded.org> Acked-by: Koen Kooi <koen@openembedded.org> Acked-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
Diffstat (limited to 'recipes/usb-gadget-mode/files')
-rw-r--r--recipes/usb-gadget-mode/files/akita/usb-gadget.conf3
-rw-r--r--recipes/usb-gadget-mode/files/c7x0/usb-gadget.conf3
-rw-r--r--recipes/usb-gadget-mode/files/collie/usb-gadget.conf3
-rw-r--r--recipes/usb-gadget-mode/files/spitz/usb-gadget.conf3
-rw-r--r--recipes/usb-gadget-mode/files/tosa/usb-gadget.conf3
-rwxr-xr-xrecipes/usb-gadget-mode/files/usb-gadget62
-rw-r--r--recipes/usb-gadget-mode/files/usb-gadget.conf3
-rwxr-xr-xrecipes/usb-gadget-mode/files/usb-gadget.init16
8 files changed, 96 insertions, 0 deletions
diff --git a/recipes/usb-gadget-mode/files/akita/usb-gadget.conf b/recipes/usb-gadget-mode/files/akita/usb-gadget.conf
new file mode 100644
index 0000000000..717687d4c3
--- /dev/null
+++ b/recipes/usb-gadget-mode/files/akita/usb-gadget.conf
@@ -0,0 +1,3 @@
+USB_MODE="networking"
+MODULE_OPTIONS=""
+
diff --git a/recipes/usb-gadget-mode/files/c7x0/usb-gadget.conf b/recipes/usb-gadget-mode/files/c7x0/usb-gadget.conf
new file mode 100644
index 0000000000..717687d4c3
--- /dev/null
+++ b/recipes/usb-gadget-mode/files/c7x0/usb-gadget.conf
@@ -0,0 +1,3 @@
+USB_MODE="networking"
+MODULE_OPTIONS=""
+
diff --git a/recipes/usb-gadget-mode/files/collie/usb-gadget.conf b/recipes/usb-gadget-mode/files/collie/usb-gadget.conf
new file mode 100644
index 0000000000..717687d4c3
--- /dev/null
+++ b/recipes/usb-gadget-mode/files/collie/usb-gadget.conf
@@ -0,0 +1,3 @@
+USB_MODE="networking"
+MODULE_OPTIONS=""
+
diff --git a/recipes/usb-gadget-mode/files/spitz/usb-gadget.conf b/recipes/usb-gadget-mode/files/spitz/usb-gadget.conf
new file mode 100644
index 0000000000..717687d4c3
--- /dev/null
+++ b/recipes/usb-gadget-mode/files/spitz/usb-gadget.conf
@@ -0,0 +1,3 @@
+USB_MODE="networking"
+MODULE_OPTIONS=""
+
diff --git a/recipes/usb-gadget-mode/files/tosa/usb-gadget.conf b/recipes/usb-gadget-mode/files/tosa/usb-gadget.conf
new file mode 100644
index 0000000000..717687d4c3
--- /dev/null
+++ b/recipes/usb-gadget-mode/files/tosa/usb-gadget.conf
@@ -0,0 +1,3 @@
+USB_MODE="networking"
+MODULE_OPTIONS=""
+
diff --git a/recipes/usb-gadget-mode/files/usb-gadget b/recipes/usb-gadget-mode/files/usb-gadget
new file mode 100755
index 0000000000..6f957fd263
--- /dev/null
+++ b/recipes/usb-gadget-mode/files/usb-gadget
@@ -0,0 +1,62 @@
+#! /bin/sh
+#
+# Copyright Matthias Hentges <devel@hentges.net> (c) 2007
+# License: GPL (see http://www.gnu.org/licenses/gpl.txt for a copy of the license)
+#
+# Filename: usb-gadget
+# Date: 20070606 (YMD)
+#
+#################################################################################
+#
+# 20070606 - v0.0.1 - Initial release
+# 20070630 - v0.0.2 - Add forgotten host mode
+
+CONF_FILE="/etc/default/usb-gadget"
+
+die() {
+ echo "ERROR: $1"
+ exit 1
+}
+
+go() {
+ test -e "$CONF_FILE" && . "$CONF_FILE"
+
+ case "$USB_MODE" in
+ networking) setup_usb g_ether "$MODULE_OPTIONS" ;;
+ storage) setup_usb g_file_storage "$MODULE_OPTIONS" ;;
+ hostmode) unload_usb_gadgets
+ setup_usb ohci_hcd "$MODULE_OPTIONS" ;;
+ none) unload_usb_gadgets ;;
+ esac
+
+}
+
+setup_usb() {
+
+ if ! ( lsmod | grep -q "$1" )
+ then
+ unload_usb_gadgets
+ echo "Loading [$1]"
+ modprobe "$1" "$MODULE_OPTIONS"
+ else
+ echo "Already loaded: [$1]"
+ fi
+}
+
+unload_usb_gadgets() {
+ KERNEL_VERSION="`uname -r`"
+ GADGET_MODULES="`find /lib/modules/$KERNEL_VERSION/kernel/drivers/usb/gadget -name "*g_*"`"
+
+ for module in $GADGET_MODULES
+ do
+ MODULE_NAME="`basename $module | sed "s/\.ko//"`"
+
+ if ( lsmod | grep -q "$MODULE_NAME" )
+ then
+ echo "Unloading [$MODULE_NAME]"
+ rmmod "$module"
+ fi
+ done
+}
+
+go
diff --git a/recipes/usb-gadget-mode/files/usb-gadget.conf b/recipes/usb-gadget-mode/files/usb-gadget.conf
new file mode 100644
index 0000000000..3b5ebd6433
--- /dev/null
+++ b/recipes/usb-gadget-mode/files/usb-gadget.conf
@@ -0,0 +1,3 @@
+USB_MODE=""
+MODULE_OPTIONS=""
+
diff --git a/recipes/usb-gadget-mode/files/usb-gadget.init b/recipes/usb-gadget-mode/files/usb-gadget.init
new file mode 100755
index 0000000000..7bf456b652
--- /dev/null
+++ b/recipes/usb-gadget-mode/files/usb-gadget.init
@@ -0,0 +1,16 @@
+#! /bin/sh
+#
+# Copyright Matthias Hentges <devel@hentges.net> (c) 2007
+# License: GPL (see http://www.gnu.org/licenses/gpl.txt for a copy of the license)
+#
+# Filename: usb-gadget.init
+# Date: 20070606 (YMD)
+#
+#################################################################################
+#
+# 20070606 - v0.0.1 - Initial release
+
+case "$1" in
+start) usb-gadget ;;
+esac
+