[IMP] hw_proxy: add lsusb full output to hw status page

This commit is contained in:
Olivier Dony 2016-11-08 17:49:35 +01:00
parent d1b0b9e656
commit 265c9f7b06
No known key found for this signature in database
GPG Key ID: CD556E25E8A6D0D4
1 changed files with 14 additions and 1 deletions

View File

@ -54,7 +54,7 @@ class Proxy(http.Controller):
return True
@http.route('/hw_proxy/status', type='http', auth='none', cors='*')
def status_http(self):
def status_http(self, debug=None, **kwargs):
resp = """
<!DOCTYPE HTML>
<html>
@ -102,6 +102,8 @@ class Proxy(http.Controller):
<h2>Connected Devices</h2>
<p>The list of connected USB devices as seen by the posbox</p>
"""
if debug is None:
resp += """(<a href="/hw_proxy/status?debug">debug version</a>)"""
devices = commands.getoutput("lsusb").split('\n')
count = 0
resp += "<div class='devices'>\n"
@ -117,6 +119,17 @@ class Proxy(http.Controller):
resp += "</div>\n</body>\n</html>\n\n"
if debug is not None:
resp += """
<h3>Debug version</h3>
<p><tt>lsusb -v</tt> output:</p>
<pre>
%s
</pre>
""" % subprocess.check_output('lsusb -v', shell=True)
return request.make_response(resp,{
'Cache-Control': 'no-cache',
'Content-Type': 'text/html; charset=utf-8',