[25439] in Source-Commits
/svn/athena r24984 - trunk/debathena/config/athinfod-cluster-config/debian
daemon@ATHENA.MIT.EDU (Jonathan D Reed)
Mon Feb 28 09:33:00 2011
Date: Mon, 28 Feb 2011 09:32:54 -0500
From: Jonathan D Reed <jdreed@MIT.EDU>
Message-Id: <201102281432.p1SEWsEe007892@drugstore.mit.edu>
To: source-commits@mit.edu
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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)
+