add configuration schema for usb port
Add configuration schema for usb port defining properties such as baud
rate, data parity etc. This schema will be used by phosphor-modbus
service to connect to modbus rtu devices.
Tested: Schema validation passes.
Change-Id: Ib8ca83bb81cd367c9ecdba44cb3802f154a91bb6
Signed-off-by: Jagpal Singh Gill <paligill@gmail.com>
diff --git a/schemas/exposes_record.json b/schemas/exposes_record.json
index a194618..2c2f569 100644
--- a/schemas/exposes_record.json
+++ b/schemas/exposes_record.json
@@ -158,6 +158,9 @@
},
{
"$ref": "gpio_presence.json#/$defs/GPIODeviceDetect"
+ },
+ {
+ "$ref": "usb_port.json#/$defs/USBPort"
}
]
},
diff --git a/schemas/meson.build b/schemas/meson.build
index 12a4c07..e68d526 100644
--- a/schemas/meson.build
+++ b/schemas/meson.build
@@ -18,5 +18,6 @@
'satellite_controller.json',
'stepwise.json',
'topology.json',
+ 'usb_port.json',
'virtual_sensor.json',
]
diff --git a/schemas/usb_port.json b/schemas/usb_port.json
new file mode 100644
index 0000000..4aa49f2
--- /dev/null
+++ b/schemas/usb_port.json
@@ -0,0 +1,53 @@
+{
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "$defs": {
+ "USBPort": {
+ "description": "The definition of the USB TTY port.",
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "Type": {
+ "description": "The type of configuration object.",
+ "const": "USBPort"
+ },
+ "Name": {
+ "description": "The name of the USB port.",
+ "type": "string"
+ },
+ "DeviceAddress": {
+ "description": "The address of the USB device.",
+ "type": "string"
+ },
+ "DeviceInterface": {
+ "description": "This indicates the interface number of the device.",
+ "type": "number"
+ },
+ "Port": {
+ "description": "This indicates the physical port of the serial device within that interface.",
+ "type": "number"
+ },
+ "Mode": {
+ "enum": ["RS232", "RS485"]
+ },
+ "BaudRate": {
+ "description": "The baudrate of the communication channel.",
+ "enum": [9600, 19200, 57600, 115200]
+ },
+ "RTSDelay": {
+ "description": "The request to send delay in milli-seconds.",
+ "type": "number"
+ }
+ },
+ "required": [
+ "Name",
+ "Type",
+ "DeviceAddress",
+ "DeviceInterface",
+ "Port",
+ "Mode",
+ "BaudRate",
+ "RTSDelay"
+ ]
+ }
+ }
+}