[ADD]Added Upstream Patch for hw_proxy module

This commit is contained in:
Riddhi Kansara 2018-07-19 17:04:30 +05:30
parent bbce466361
commit 1260eab566

View File

@ -21,6 +21,8 @@ BANNED_DEVICES = {
"0424:9514", # Standard Microsystem Corp. Builtin Ethernet module "0424:9514", # Standard Microsystem Corp. Builtin Ethernet module
"1d6b:0002", # Linux Foundation 2.0 root hub "1d6b:0002", # Linux Foundation 2.0 root hub
"0424:ec00", # Standard Microsystem Corp. Other Builtin Ethernet module "0424:ec00", # Standard Microsystem Corp. Other Builtin Ethernet module
"0424:2514", # Standard Microsystems Corp. USB 2.0 Hub (rpi3b+)
"0424:7800", # Standard Microsystems Corp. (rpi3b+)
} }
@ -100,15 +102,16 @@ class Proxy(http.Controller):
""" """
if debug is None: if debug is None:
resp += """(<a href="/hw_proxy/status?debug">debug version</a>)""" resp += """(<a href="/hw_proxy/status?debug">debug version</a>)"""
devices = subprocess.check_output("lsusb").split('\n') devices = subprocess.check_output("lsusb").decode('utf-8').split('\n')
count = 0 count = 0
resp += "<div class='devices'>\n" resp += "<div class='devices'>\n"
for device in devices: for device in devices:
device_name = device[device.find('ID')+2:] device_name = device[device.find('ID')+2:]
device_id = device_name.split()[0] if device_name: # to avoid last empty line
if not (device_id in BANNED_DEVICES): device_id = device_name.split()[0]
resp += "<div class='device' data-device='"+device+"'>"+device_name+"</div>\n" if not (device_id in BANNED_DEVICES):
count += 1 resp += "<div class='device' data-device='"+device+"'>"+device_name+"</div>\n"
count += 1
if count == 0: if count == 0:
resp += "<div class='device'>No USB Device Found</div>" resp += "<div class='device'>No USB Device Found</div>"
@ -124,7 +127,7 @@ class Proxy(http.Controller):
%s %s
</pre> </pre>
""" % subprocess.check_output('lsusb -v', shell=True) """ % subprocess.check_output('lsusb -v', shell=True).decode('utf-8')
return request.make_response(resp,{ return request.make_response(resp,{
'Cache-Control': 'no-cache', 'Cache-Control': 'no-cache',