diff options
| author | Christophe Simonis <chs@odoo.com> | 2015-08-11 16:56:47 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2015-08-11 16:56:47 +0200 |
| commit | 171d001985eab6ac1c06339117e8b22b96d5d689 (patch) | |
| tree | 468e6d87e3e68dab775b364f27a7ff29f72816c4 /addons/hw_proxy/controllers/main.py | |
| parent | 71d51bb05fc8df01613e8c2da55b16da6bb553cd (diff) | |
| parent | 02954bad2b390024bf60d209e4ce181c04eb865d (diff) | |
[MERGE] forward port of branch 8.0 up to 02954ba
Diffstat (limited to 'addons/hw_proxy/controllers/main.py')
| -rw-r--r-- | addons/hw_proxy/controllers/main.py | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/addons/hw_proxy/controllers/main.py b/addons/hw_proxy/controllers/main.py index 337874cf67a..eb95527efcd 100644 --- a/addons/hw_proxy/controllers/main.py +++ b/addons/hw_proxy/controllers/main.py @@ -17,6 +17,14 @@ _logger = logging.getLogger(__name__) from openerp import http from openerp.http import request +# Those are the builtin raspberry pi USB modules, they should +# not appear in the list of connected devices. +BANNED_DEVICES = set([ + "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 # so that 'status' can return the status of all active drivers @@ -88,10 +96,18 @@ class Proxy(http.Controller): <p>The list of connected USB devices as seen by the posbox</p> """ devices = commands.getoutput("lsusb").split('\n') + count = 0 resp += "<div class='devices'>\n" for device in devices: device_name = device[device.find('ID')+2:] - resp+= "<div class='device' data-device='"+device+"'>"+device_name+"</div>\n" + 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>" + resp += "</div>\n" resp += """ <h2>Add New Printer</h2> |
