diff options
author | Mike Frysinger <vapier@gentoo.org> | 2008-02-04 22:35:00 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2008-02-04 22:35:00 +0000 |
commit | bed95b6e93fc14b8237c9e396fc12ebecb419f39 (patch) | |
tree | aff776965a385efd1f397500d03d22fef7ad375c /sys-apps/usbutils | |
parent | Stable for HPPA too. (diff) | |
download | historical-bed95b6e93fc14b8237c9e396fc12ebecb419f39.tar.gz historical-bed95b6e93fc14b8237c9e396fc12ebecb419f39.tar.bz2 historical-bed95b6e93fc14b8237c9e396fc12ebecb419f39.zip |
Add helper script "usbmodules" like "pcimodules".
Package-Manager: portage-2.1.4.1
Diffstat (limited to 'sys-apps/usbutils')
-rw-r--r-- | sys-apps/usbutils/ChangeLog | 8 | ||||
-rwxr-xr-x | sys-apps/usbutils/files/usbmodules.sh | 55 | ||||
-rw-r--r-- | sys-apps/usbutils/usbutils-0.73.ebuild | 5 |
3 files changed, 64 insertions, 4 deletions
diff --git a/sys-apps/usbutils/ChangeLog b/sys-apps/usbutils/ChangeLog index 02965c69ba96..f4cfb04df679 100644 --- a/sys-apps/usbutils/ChangeLog +++ b/sys-apps/usbutils/ChangeLog @@ -1,6 +1,10 @@ # ChangeLog for sys-apps/usbutils -# Copyright 1999-2007 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-apps/usbutils/ChangeLog,v 1.63 2007/11/19 07:16:31 kumba Exp $ +# Copyright 1999-2008 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/sys-apps/usbutils/ChangeLog,v 1.64 2008/02/04 22:34:59 vapier Exp $ + + 04 Feb 2008; Mike Frysinger <vapier@gentoo.org> +files/usbmodules.sh, + usbutils-0.73.ebuild: + Add helper script "usbmodules" like "pcimodules". 19 Nov 2007; Joshua Kinard <kumba@gentoo.org> usbutils-0.72-r4.ebuild: Stable on mips, per #195242. diff --git a/sys-apps/usbutils/files/usbmodules.sh b/sys-apps/usbutils/files/usbmodules.sh new file mode 100755 index 000000000000..dfd89b7f307b --- /dev/null +++ b/sys-apps/usbutils/files/usbmodules.sh @@ -0,0 +1,55 @@ +#!/bin/sh + +usage() { + cat <<-EOF + List relevant kernel modules for USB devices currently plugged in. The + module list is taken from the modules installed in /lib/modules/<ver>/. + + Usage: usbmodules [options] [kernel version] + + Options: + -m, --map <map> Specify usbmap (default: /lib/modules/<ver>/modules.usbmap) + -h, --help This help screen + EOF + if [ -n "$*" ] ; then + echo + echo "Error: $*" 1>&2 + exit 1 + else + exit 0 + fi +} + +map="" + +while [ -n "$1" ] ; do + case $1 in + -m|--map) map=$2; shift;; + -h|--help) usage;; + --) break;; + -*) usage "unknown option '$1'";; + *) break;; + esac + shift +done + +ver=${1:-$(uname -r)} +map=${map:-/lib/modules/${ver}/modules.usbmap} + +for dev in $(lsusb | awk '{print $6}') ; do + [ "${dev}" = "0000:0000" ] && continue + + IFS=: + set -- ${dev} + vendor=$1 + product=$2 + unset IFS + + awk \ + -v vendor="0x${vendor}" \ + -v product="0x${product}" \ + 'vendor == $3 && product == $4 {print $1}' \ + ${map} +done + +exit 0 diff --git a/sys-apps/usbutils/usbutils-0.73.ebuild b/sys-apps/usbutils/usbutils-0.73.ebuild index ad47b551ef7e..48cbd33ffb65 100644 --- a/sys-apps/usbutils/usbutils-0.73.ebuild +++ b/sys-apps/usbutils/usbutils-0.73.ebuild @@ -1,6 +1,6 @@ -# Copyright 1999-2007 Gentoo Foundation +# Copyright 1999-2008 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/sys-apps/usbutils/usbutils-0.73.ebuild,v 1.2 2007/11/14 16:46:21 lavajoe Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-apps/usbutils/usbutils-0.73.ebuild,v 1.3 2008/02/04 22:34:59 vapier Exp $ inherit eutils autotools @@ -47,6 +47,7 @@ src_compile() { src_install() { emake DESTDIR="${D}" install || die "install failed" + newbin "${FILESDIR}"/usbmodules.sh usbmodules || die dosbin update-usbids || die "update-usbids failed" dodoc AUTHORS ChangeLog NEWS README |