Files
odoo_source/addons/hw_drivers/controllers/loading.py
T
Josse Colpaert 3d9ebb11b6 [ADD] hw_drivers: drivers management module for the IoT Box
- Routes to get device/driver statuses from the browser
- Framework for managing and downloading drivers for devices
connected to the IoT Box
- Automatic detection of printers and cameras in the network
- Built-in detection for USB and Bluetooth LE devices and checking
if a driver matches the device
- Authentication of the box into Odoo
- Inform Odoo of the connected devices and giving them a unique
identifier so they can be called from the browser

Thanks to qle, specially for fswebcam and cups
2018-09-25 23:01:40 +02:00

35 lines
998 B
Python

import importlib.util
import os
from .driver import BtManager
from .driver import USBDeviceManager
from odoo import modules
driversList = os.listdir("/home/pi/odoo/addons/hw_drivers/drivers")
for driver in driversList:
path = "/home/pi/odoo/addons/hw_drivers/drivers/" + driver
spec = importlib.util.spec_from_file_location(driver, path)
if spec:
foo = importlib.util.module_from_spec(spec)
spec.loader.exec_module(foo)
if not getattr(modules, '_iot_daemon_started', False):
# ----------------------------------------------------------
# Bluetooth start
# ----------------------------------------------------------
bm = BtManager()
bm.daemon = True
bm.start()
#----------------------------------------------------------
#USB start
#----------------------------------------------------------
udm = USBDeviceManager()
udm.daemon = True
udm.start()
# Did this because of the
modules._iot_daemon_started = True