| 1 |
# Part of Odoo. See LICENSE file for full copyright and licensing details. |
| 2 |
|
| 3 |
from serial.tools.list_ports import comports |
| 4 |
|
| 5 |
from odoo.addons.iot_drivers.tools.system import IS_WINDOWS |
| 6 |
from odoo.addons.iot_drivers.interface import Interface |
| 7 |
|
| 8 |
|
| 9 |
class SerialInterface(Interface): |
| 10 |
connection_type = 'serial' |
| 11 |
allow_unsupported = True |
| 12 |
|
| 13 |
def get_devices(self): |
| 14 |
serial_devices = { |
| 15 |
port.device: {'identifier': port.device} |
| 16 |
for port in comports() |
| 17 |
if IS_WINDOWS or port.device != '/dev/ttyAMA10' |
| 18 |
# RPI 5 uses ttyAMA10 as a console serial port for system messages: odoo interprets it as scale -> avoid it |
| 19 |
} |
| 20 |
return serial_devices |