diff options
Diffstat (limited to 'packages/usb-gadget-mode')
-rw-r--r-- | packages/usb-gadget-mode/.mtn2git_empty | 0 | ||||
-rw-r--r-- | packages/usb-gadget-mode/files/.mtn2git_empty | 0 | ||||
-rw-r--r-- | packages/usb-gadget-mode/files/akita/.mtn2git_empty | 0 | ||||
-rw-r--r-- | packages/usb-gadget-mode/files/akita/usb-gadget.conf | 3 | ||||
-rw-r--r-- | packages/usb-gadget-mode/files/c7x0/.mtn2git_empty | 0 | ||||
-rw-r--r-- | packages/usb-gadget-mode/files/c7x0/usb-gadget.conf | 3 | ||||
-rw-r--r-- | packages/usb-gadget-mode/files/collie/.mtn2git_empty | 0 | ||||
-rw-r--r-- | packages/usb-gadget-mode/files/collie/usb-gadget.conf | 3 | ||||
-rw-r--r-- | packages/usb-gadget-mode/files/spitz/.mtn2git_empty | 0 | ||||
-rw-r--r-- | packages/usb-gadget-mode/files/spitz/usb-gadget.conf | 3 | ||||
-rw-r--r-- | packages/usb-gadget-mode/files/tosa/.mtn2git_empty | 0 | ||||
-rw-r--r-- | packages/usb-gadget-mode/files/tosa/usb-gadget.conf | 3 | ||||
-rwxr-xr-x | packages/usb-gadget-mode/files/usb-gadget | 62 | ||||
-rw-r--r-- | packages/usb-gadget-mode/files/usb-gadget.conf | 3 | ||||
-rwxr-xr-x | packages/usb-gadget-mode/files/usb-gadget.init | 16 | ||||
-rw-r--r-- | packages/usb-gadget-mode/usb-gadget-mode.bb | 50 |
16 files changed, 146 insertions, 0 deletions
diff --git a/packages/usb-gadget-mode/.mtn2git_empty b/packages/usb-gadget-mode/.mtn2git_empty new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/packages/usb-gadget-mode/.mtn2git_empty diff --git a/packages/usb-gadget-mode/files/.mtn2git_empty b/packages/usb-gadget-mode/files/.mtn2git_empty new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/packages/usb-gadget-mode/files/.mtn2git_empty diff --git a/packages/usb-gadget-mode/files/akita/.mtn2git_empty b/packages/usb-gadget-mode/files/akita/.mtn2git_empty new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/packages/usb-gadget-mode/files/akita/.mtn2git_empty diff --git a/packages/usb-gadget-mode/files/akita/usb-gadget.conf b/packages/usb-gadget-mode/files/akita/usb-gadget.conf new file mode 100644 index 0000000000..717687d4c3 --- /dev/null +++ b/packages/usb-gadget-mode/files/akita/usb-gadget.conf @@ -0,0 +1,3 @@ +USB_MODE="networking" +MODULE_OPTIONS="" + diff --git a/packages/usb-gadget-mode/files/c7x0/.mtn2git_empty b/packages/usb-gadget-mode/files/c7x0/.mtn2git_empty new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/packages/usb-gadget-mode/files/c7x0/.mtn2git_empty diff --git a/packages/usb-gadget-mode/files/c7x0/usb-gadget.conf b/packages/usb-gadget-mode/files/c7x0/usb-gadget.conf new file mode 100644 index 0000000000..717687d4c3 --- /dev/null +++ b/packages/usb-gadget-mode/files/c7x0/usb-gadget.conf @@ -0,0 +1,3 @@ +USB_MODE="networking" +MODULE_OPTIONS="" + diff --git a/packages/usb-gadget-mode/files/collie/.mtn2git_empty b/packages/usb-gadget-mode/files/collie/.mtn2git_empty new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/packages/usb-gadget-mode/files/collie/.mtn2git_empty diff --git a/packages/usb-gadget-mode/files/collie/usb-gadget.conf b/packages/usb-gadget-mode/files/collie/usb-gadget.conf new file mode 100644 index 0000000000..717687d4c3 --- /dev/null +++ b/packages/usb-gadget-mode/files/collie/usb-gadget.conf @@ -0,0 +1,3 @@ +USB_MODE="networking" +MODULE_OPTIONS="" + diff --git a/packages/usb-gadget-mode/files/spitz/.mtn2git_empty b/packages/usb-gadget-mode/files/spitz/.mtn2git_empty new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/packages/usb-gadget-mode/files/spitz/.mtn2git_empty diff --git a/packages/usb-gadget-mode/files/spitz/usb-gadget.conf b/packages/usb-gadget-mode/files/spitz/usb-gadget.conf new file mode 100644 index 0000000000..717687d4c3 --- /dev/null +++ b/packages/usb-gadget-mode/files/spitz/usb-gadget.conf @@ -0,0 +1,3 @@ +USB_MODE="networking" +MODULE_OPTIONS="" + diff --git a/packages/usb-gadget-mode/files/tosa/.mtn2git_empty b/packages/usb-gadget-mode/files/tosa/.mtn2git_empty new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/packages/usb-gadget-mode/files/tosa/.mtn2git_empty diff --git a/packages/usb-gadget-mode/files/tosa/usb-gadget.conf b/packages/usb-gadget-mode/files/tosa/usb-gadget.conf new file mode 100644 index 0000000000..717687d4c3 --- /dev/null +++ b/packages/usb-gadget-mode/files/tosa/usb-gadget.conf @@ -0,0 +1,3 @@ +USB_MODE="networking" +MODULE_OPTIONS="" + diff --git a/packages/usb-gadget-mode/files/usb-gadget b/packages/usb-gadget-mode/files/usb-gadget new file mode 100755 index 0000000000..6f957fd263 --- /dev/null +++ b/packages/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/packages/usb-gadget-mode/files/usb-gadget.conf b/packages/usb-gadget-mode/files/usb-gadget.conf new file mode 100644 index 0000000000..3b5ebd6433 --- /dev/null +++ b/packages/usb-gadget-mode/files/usb-gadget.conf @@ -0,0 +1,3 @@ +USB_MODE="" +MODULE_OPTIONS="" + diff --git a/packages/usb-gadget-mode/files/usb-gadget.init b/packages/usb-gadget-mode/files/usb-gadget.init new file mode 100755 index 0000000000..7bf456b652 --- /dev/null +++ b/packages/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 + diff --git a/packages/usb-gadget-mode/usb-gadget-mode.bb b/packages/usb-gadget-mode/usb-gadget-mode.bb new file mode 100644 index 0000000000..d1fab638f2 --- /dev/null +++ b/packages/usb-gadget-mode/usb-gadget-mode.bb @@ -0,0 +1,50 @@ +#! /bin/sh +# +# Copyright Matthias Hentges <devel@hentges.net> (c) 2007 +# License: MIT (see http://www.opensource.org/licenses/mit-license.php +# for a copy of the license) +# +# Filename: usb-gadget-mode.bb +# Date: 20070606 (YMD) + +DESCRIPTION = "Manage the default USB gadget mode" +SECTION = "console/network" +LICENSE = "GPL" + +###################################################################################### + +PV = "0.0.2" +PR = "r0" + +###################################################################################### + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +###################################################################################### + +SRC_URI = "file://usb-gadget.conf \ + file://usb-gadget \ + file://usb-gadget.init" + +###################################################################################### + +do_install() { + install -d ${D}${sysconfdir} + install -d ${D}${sysconfdir}/init.d + install -d ${D}${bindir} + install -d ${D}${sysconfdir}/default + + install -m 0644 ${WORKDIR}/usb-gadget.conf ${D}${sysconfdir}/default/usb-gadget + install -m 0755 ${WORKDIR}/usb-gadget.init ${D}${sysconfdir}/init.d/usb-gadget + install -m 0755 ${WORKDIR}/usb-gadget ${D}${bindir} +} + +pkg_postinst() { + + test -n "$D" && opt="-r $D" + update-rc.d $opt usb-gadget defaults 50 +} + +pkg_postrm() { + update-rc.d -f usb-gadget remove +} |