Currently it is only possible to run the modules for the IoT Box on Raspios. The modifications brought by this commit brings the possibility that the various hw_* modules can be executed whatever the OS of the hardware (Linux or Windows). If the modules should be versioned according to the OS, the file will be renamed so that the end of the file includes *_L (for linux) or *_W (for windows) closes odoo/odoo#107350 X-original-commit: b7b8809ea8b7fe4ac8b24f43fe3f3a5e38a66696 Related: odoo/enterprise#34713 Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
19 lines
496 B
Python
19 lines
496 B
Python
# -*- coding: utf-8 -*-
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
import serial.tools.list_ports
|
|
|
|
from odoo.addons.hw_drivers.interface import Interface
|
|
|
|
|
|
class SerialInterface(Interface):
|
|
connection_type = 'serial'
|
|
|
|
def get_devices(self):
|
|
serial_devices = {}
|
|
for port in serial.tools.list_ports.comports():
|
|
serial_devices[port.device] = {
|
|
'identifier': port.device
|
|
}
|
|
return serial_devices
|