diff options
| author | Joren Van Onder <jov@odoo.com> | 2015-08-11 12:55:27 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2015-08-11 15:13:17 +0200 |
| commit | 59b5f136bfc2f4b466063b22d7bffd0d0df64ae9 (patch) | |
| tree | edb3ac84e65a18e3c8a01ae1e6046341bf2ae666 /addons/hw_proxy/controllers/main.py | |
| parent | 0d3a9c47e7b96a317ed304ae3c89ea684744d5d1 (diff) | |
[IMP] point_of_sale: add patches from `posbox` branch
This commit contains the patches from the now obsolete 'posbox'
branch. These patches were written by Martin Donies (@mdo-odoo) and
Frédéric Van der Essen (@fvdsn).
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 eced1d65b94..677bff1354e 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> |
