[25440] in Source-Commits
Re: /svn/athena r24984 -
daemon@ATHENA.MIT.EDU (Geoffrey Thomas)
Mon Feb 28 09:38:42 2011
Date: Mon, 28 Feb 2011 09:38:35 -0500 (EST)
From: Geoffrey Thomas <geofft@MIT.EDU>
To: Jonathan D Reed <jdreed@mit.edu>
cc: source-commits@mit.edu
In-Reply-To: <201102281432.p1SEWsEe007892@drugstore.mit.edu>
Message-ID: <alpine.DEB.1.10.1102280937540.10776@lunatique.mit.edu>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
You want a comma after python-usb in the deps list, but otherwise ACK.
--
Geoffrey Thomas
geofft@mit.edu
On Mon, 28 Feb 2011, Jonathan D Reed wrote:
> Author: jdreed
> Date: 2011-02-28 09:32:54 -0500 (Mon, 28 Feb 2011)
> New Revision: 24984
>
> Added:
> trunk/debathena/config/athinfod-cluster-config/debian/debathena-athinfod-cluster-config.install
> trunk/debathena/config/athinfod-cluster-config/debian/usb-hid.py
> Modified:
> trunk/debathena/config/athinfod-cluster-config/debian/changelog
> trunk/debathena/config/athinfod-cluster-config/debian/control.in
> trunk/debathena/config/athinfod-cluster-config/debian/transform_athinfo.defs.debathena
> Log:
> In athinfod-cluster-config:
> * Add lsusb and usb-hid queries, and Python support for the latter
>
>
> Modified: trunk/debathena/config/athinfod-cluster-config/debian/changelog
> ===================================================================
> --- trunk/debathena/config/athinfod-cluster-config/debian/changelog 2011-02-25 19:56:38 UTC (rev 24983)
> +++ trunk/debathena/config/athinfod-cluster-config/debian/changelog 2011-02-28 14:32:54 UTC (rev 24984)
> @@ -1,3 +1,9 @@
> +debathena-athinfod-cluster-config (1.1) unstable; urgency=low
> +
> + * Add lsusb and usb-hid queries, and Python support for the latter
> +
> + -- Jonathan Reed <jdreed@mit.edu> Mon, 28 Feb 2011 09:32:13 -0500
> +
> debathena-athinfod-cluster-config (1.0.1) unstable; urgency=low
>
> * Depend on debathena-machtype, not machtype
>
> Modified: trunk/debathena/config/athinfod-cluster-config/debian/control.in
> ===================================================================
> --- trunk/debathena/config/athinfod-cluster-config/debian/control.in 2011-02-25 19:56:38 UTC (rev 24983)
> +++ trunk/debathena/config/athinfod-cluster-config/debian/control.in 2011-02-28 14:32:54 UTC (rev 24984)
> @@ -7,7 +7,7 @@
>
> Package: debathena-athinfod-cluster-config
> Architecture: all
> -Depends: debathena-athinfod, debathena-machtype, ${misc:Depends}
> +Depends: debathena-athinfod, debathena-machtype, python-usb ${misc:Depends}
> Provides: ${diverted-files}
> Conflicts: ${diverted-files}
> Description: Athinfod configuration for Debathena
>
> Added: trunk/debathena/config/athinfod-cluster-config/debian/debathena-athinfod-cluster-config.install
> ===================================================================
> --- trunk/debathena/config/athinfod-cluster-config/debian/debathena-athinfod-cluster-config.install (rev 0)
> +++ trunk/debathena/config/athinfod-cluster-config/debian/debathena-athinfod-cluster-config.install 2011-02-28 14:32:54 UTC (rev 24984)
> @@ -0,0 +1 @@
> +debian/usb-hid.py usr/share/debathena-athinfod-cluster-config
>
> Modified: trunk/debathena/config/athinfod-cluster-config/debian/transform_athinfo.defs.debathena
> ===================================================================
> --- trunk/debathena/config/athinfod-cluster-config/debian/transform_athinfo.defs.debathena 2011-02-25 19:56:38 UTC (rev 24983)
> +++ trunk/debathena/config/athinfod-cluster-config/debian/transform_athinfo.defs.debathena 2011-02-28 14:32:54 UTC (rev 24984)
> @@ -1,4 +1,5 @@
> #!/usr/bin/perl -p0
> +# For emacs: -*- mode: fundamental; -*-
> print;
> print <<EOF;
>
> @@ -9,5 +10,7 @@
> in-use machtype -L | grep -q "debathena-cluster" && (test `pgrep -c larvnet-wrapper` -gt 0 && echo "yes" || echo "no") || echo "n/a"
> update-schedule machtype -v -L | grep -q "debathena-cluster" && test -r /etc/cron.d/debathena-auto-update && cat /etc/cron.d/debathena-auto-update
> install.log machtype -v -L | grep -q "debathena-cluster" && test -r /var/log/athena-install.log && cat /var/log/athena-install.log
> +usb-hid /usr/share/debathena-athinfod-cluster-config/usb-hid.py
> +lsusb machtype -v -L | grep -q "debathena-cluster" && lsusb
> EOF
> exit 0;
>
> Added: trunk/debathena/config/athinfod-cluster-config/debian/usb-hid.py
> ===================================================================
> --- trunk/debathena/config/athinfod-cluster-config/debian/usb-hid.py (rev 0)
> +++ trunk/debathena/config/athinfod-cluster-config/debian/usb-hid.py 2011-02-28 14:32:54 UTC (rev 24984)
> @@ -0,0 +1,37 @@
> +#!/usr/bin/python
> +#
> +# HID interface class = 3
> +# Interface Protocols:
> +# 0 - None
> +# 1 - KB
> +# 2 - Mouse
> +# 3-255 Reserved
> +
> +import usb
> +
> +protocols = { 1: 'keyboard',
> + 2: 'mouse'}
> +
> +found = { 'keyboard' : 'no',
> + 'mouse' : 'no' }
> +
> +for b in usb.busses():
> + if 'no' not in found.values():
> + break
> + for d in b.devices:
> + if 'no' not in found.values():
> + break
> + i = d.configurations[0].interfaces[0][0]
> + if i.interfaceClass == 3 and \
> + i.interfaceProtocol in protocols.keys():
> + found[protocols[i.interfaceProtocol]] = 'yes'
> +
> +if 'no' not in found.values():
> + print "OK - keyboard and mouse present"
> +else:
> + errs = []
> + for k,v in found.items():
> + if v == 'no':
> + errs.append(k + " missing")
> + print "ERROR - " + ', '.join(errs)
> +
>
>