diff --git a/addons/hw_escpos/controllers/main.py b/addons/hw_escpos/controllers/main.py index b647e5ca8dd..9e5656ef986 100644 --- a/addons/hw_escpos/controllers/main.py +++ b/addons/hw_escpos/controllers/main.py @@ -37,6 +37,7 @@ from openerp.tools.translate import _ _logger = logging.getLogger(__name__) + class EscposDriver(Thread): def __init__(self): Thread.__init__(self) @@ -46,6 +47,7 @@ class EscposDriver(Thread): def connected_usb_devices(self): connected = [] + for device in supported_devices.device_list: if usb.core.find(idVendor=device['vendor'], idProduct=device['product']) != None: connected.append(device) @@ -75,6 +77,8 @@ class EscposDriver(Thread): self.push_task('status') return self.status + + def open_cashbox(self,printer): printer.cashdraw(2) printer.cashdraw(5) diff --git a/addons/hw_proxy/controllers/main.py b/addons/hw_proxy/controllers/main.py index 5293abd1f25..9e94e4817a4 100644 --- a/addons/hw_proxy/controllers/main.py +++ b/addons/hw_proxy/controllers/main.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- import logging +import commands import simplejson import os import os.path @@ -43,7 +44,32 @@ class Proxy(http.Controller): @http.route('/hw_proxy/status', type='http', auth='none', cors='*') def status_http(self): - resp = '\n\n

Hardware Proxy Status

\n' + resp = """ + + + + OpenERP's PosBox + + + +

Hardware Status

+

The list of enabled drivers and their status

+""" statuses = self.get_status() for driver in statuses: @@ -56,12 +82,22 @@ class Proxy(http.Controller): else: color = 'red' - resp += "

"+driver+' : '+status['status']+"

\n" + resp += "

"+driver+' : '+status['status']+"

\n" resp += "\n" - resp += "\n\n\n\n" + resp += """ +

Connected Devices

+

The list of connected USB devices as seen by the posbox

+ """ + devices = commands.getoutput("lsusb").split('\n') + resp += "
\n" + for device in devices: + device_name = device[device.find('ID')+2:] + resp+= "
"+device_name+"
\n" + resp += "
\n" + resp += "\n\n\n" return request.make_response(resp,{ 'Cache-Control': 'no-cache',