summaryrefslogtreecommitdiff
path: root/addons/hw_proxy/controllers/main.py
diff options
context:
space:
mode:
authorJosse Colpaert <jco@odoo.com>2018-07-06 12:37:55 +0200
committerJosse Colpaert <jco@odoo.com>2018-07-13 15:10:12 +0200
commit7d34f0218bf4ee04939e30c6101fb85323fccb71 (patch)
treef90efefd436631daac531b08129941cde8b35412 /addons/hw_proxy/controllers/main.py
parente8821f0519873713ba477b2c013cb0a645e6e559 (diff)
[IMP] point_of_sale: posbox upgrade to stretch / python3
- transform odoo.py -> odoo-bin / recent branches + pip3 packages - deactivate wpa_supplicant when starting dhcpcd automatically - postgresql create clusters manually - latest stretch raspbian image / add versatile-db.ptb for kernel-qemu - ifconfig output change - upgrade hw_-modules: hw_escpos: to python3 hw_posbox_homepage: to v11: csrf does not work as it needs a database hw_posbox_upgrade: to python3 decode utf-8 hw_scale: to python3 hw_proxy: to python3 With the commit, the posbox will also work on the new Raspberry Pi 3b+
Diffstat (limited to 'addons/hw_proxy/controllers/main.py')
-rw-r--r--addons/hw_proxy/controllers/main.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/addons/hw_proxy/controllers/main.py b/addons/hw_proxy/controllers/main.py
index 3d42918c2ad..31d718616e4 100644
--- a/addons/hw_proxy/controllers/main.py
+++ b/addons/hw_proxy/controllers/main.py
@@ -21,6 +21,8 @@ BANNED_DEVICES = {
"0424:9514", # Standard Microsystem Corp. Builtin Ethernet module
"1d6b:0002", # Linux Foundation 2.0 root hub
"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:
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
resp += "<div class='devices'>\n"
for device in devices:
device_name = device[device.find('ID')+2:]
- device_id = device_name.split()[0]
- if not (device_id in BANNED_DEVICES):
- resp += "<div class='device' data-device='"+device+"'>"+device_name+"</div>\n"
- count += 1
+ if device_name: # to avoid last empty line
+ device_id = device_name.split()[0]
+ if not (device_id in BANNED_DEVICES):
+ resp += "<div class='device' data-device='"+device+"'>"+device_name+"</div>\n"
+ count += 1
if count == 0:
resp += "<div class='device'>No USB Device Found</div>"
@@ -124,7 +127,7 @@ class Proxy(http.Controller):
%s
</pre>
- """ % subprocess.check_output('lsusb -v', shell=True)
+ """ % subprocess.check_output('lsusb -v', shell=True).decode('utf-8')
return request.make_response(resp,{
'Cache-Control': 'no-cache',