summaryrefslogtreecommitdiff
path: root/addons/hw_proxy/controllers/main.py
diff options
context:
space:
mode:
authorXavier Morel <xmo@odoo.com>2017-05-09 13:11:29 +0200
committerXavier Morel <xmo@odoo.com>2017-05-15 12:26:16 +0200
commit3833c8997d43b2cc51a30a30a136e345cffb6b6b (patch)
tree8ae922263b76c4a42218fd70d0dbabab201abb7d /addons/hw_proxy/controllers/main.py
parentb9c3365d21d82bdf289d30065a645052bcd8cbe7 (diff)
[FIX] P3: removed commands module
Diffstat (limited to 'addons/hw_proxy/controllers/main.py')
-rw-r--r--addons/hw_proxy/controllers/main.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/addons/hw_proxy/controllers/main.py b/addons/hw_proxy/controllers/main.py
index f341ab7b9e0..0521b72c89b 100644
--- a/addons/hw_proxy/controllers/main.py
+++ b/addons/hw_proxy/controllers/main.py
@@ -2,8 +2,8 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from __future__ import print_function
-import commands
import logging
+import subprocess
import time
from threading import Lock
@@ -16,11 +16,11 @@ _logger = logging.getLogger(__name__)
# Those are the builtin raspberry pi USB modules, they should
# not appear in the list of connected devices.
-BANNED_DEVICES = set([
+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
-])
+}
# drivers modules must add to drivers an object with a get_status() method
@@ -99,14 +99,14 @@ class Proxy(http.Controller):
"""
if debug is None:
resp += """(<a href="/hw_proxy/status?debug">debug version</a>)"""
- devices = commands.getoutput("lsusb").split('\n')
+ devices = subprocess.check_output("lsusb").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"
+ resp += "<div class='device' data-device='"+device+"'>"+device_name+"</div>\n"
count += 1
if count == 0: