diff options
| author | Olivier Dony <odo@openerp.com> | 2016-11-02 13:45:41 +0100 |
|---|---|---|
| committer | Olivier Dony <odo@openerp.com> | 2016-11-14 17:11:57 +0100 |
| commit | eeadeb0d6e31e33e51e6b4930e5a9ce940ed6935 (patch) | |
| tree | f63ff72e89e2cb634cf935b8d9a2d869fb02d663 /addons/hw_proxy/controllers/main.py | |
| parent | 2fd4dfca7f496b047a32526e743cc4c4067aea8c (diff) | |
[FIX] hw_proxy,hw_blackbox_be: make RS-232 drivers protect their device
RS-232 drivers now need to register any device
they are handling in the hw_proxy.rs232_devices map.
This will prevent other drivers from probing them,
possibly messing up with the device.
Any update to rs232_devices must be done while holding
the hw_proxy.rs232_lock.
The hw_scale driver will be updated to use this mechanism
in the next commit, that will also handle a new RS-232
scale protocol.
Diffstat (limited to 'addons/hw_proxy/controllers/main.py')
| -rw-r--r-- | addons/hw_proxy/controllers/main.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/addons/hw_proxy/controllers/main.py b/addons/hw_proxy/controllers/main.py index d377b5e9a01..e1024772500 100644 --- a/addons/hw_proxy/controllers/main.py +++ b/addons/hw_proxy/controllers/main.py @@ -11,6 +11,8 @@ import subprocess import simplejson import werkzeug import werkzeug.wrappers +from threading import Lock + _logger = logging.getLogger(__name__) @@ -30,6 +32,11 @@ BANNED_DEVICES = set([ # so that 'status' can return the status of all active drivers drivers = {} +# keep a list of RS-232 devices that have been recognized by a driver, +# so other drivers can skip them during probes +rs232_devices = {} # {'/path/to/device': 'driver'} +rs232_lock = Lock() # must be held to update `rs232_devices` + class Proxy(http.Controller): def get_status(self): |
