chromeos-config: Remove camera id from schema
Since different camera source doesn't make new hardware topology, remove
camera identifier from Chrome OS config schema.
https://chromium.googlesource.com/chromiumos/config/+/refs/heads/master/proto/chromiumos/config/api/hardware_topology.md#camera
BUG=b:163436311
TEST=cros_config_host/cros_config_schema_unittest.py
Cq-Depend: chromium:2413691
Change-Id: Ib2f93e4851eb804beeab8a889859c25aee4fca41
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform2/+/2413928
Tested-by: Ren-Pei Zeng <kamesan@chromium.org>
Commit-Queue: Ren-Pei Zeng <kamesan@chromium.org>
Reviewed-by: David Burger <dburger@chromium.org>
(cherry picked from commit 943a9a5d4a44c982e9af22292d72f6a77a116152)
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform2/+/2570888
Reviewed-by: Pin-yen Lin <treapking@chromium.org>
Commit-Queue: Pin-yen Lin <treapking@chromium.org>
Tested-by: Pin-yen Lin <treapking@chromium.org>
diff --git a/chromeos-config/README.md b/chromeos-config/README.md
index fc6602d..2106195 100644
--- a/chromeos-config/README.md
+++ b/chromeos-config/README.md
@@ -424,7 +424,6 @@
| Attribute | Type | RegEx | Required | Oneof Group | Build-only | Description |
| --------- | ------ | --------- | -------- | ----------- | ---------- | ----------- |
| facing | string | | True | | False | Direction the camera faces relative to device screen. |
-| id | string | | True | | False | A string to identify the camera device. For USB cameras this must be 4-digit hexadecimal VID and PID separated by a colon, e.g. 0123:abcd. For MIPI cameras it depends on vendor software usage. |
| interface | string | | True | | False | The interface type of the camera device. |
| orientation | integer | | True | | False | Clockwise angle through which the output image needs to be rotated to be upright on the device screen in its native orientation. |
diff --git a/chromeos-config/cros_config_host/cros_config_schema.yaml b/chromeos-config/cros_config_host/cros_config_schema.yaml
index f7a9010..6e0b05b 100644
--- a/chromeos-config/cros_config_host/cros_config_schema.yaml
+++ b/chromeos-config/cros_config_host/cros_config_schema.yaml
@@ -358,12 +358,6 @@
items:
type: object
properties:
- id:
- type: string
- description: A string to identify the camera device. For
- USB cameras this must be 4-digit hexadecimal VID and
- PID separated by a colon, e.g. 0123:abcd. For MIPI
- cameras it depends on vendor software usage.
interface:
type: string
description: The interface type of the camera device.
@@ -388,7 +382,6 @@
- 180
- 270
required:
- - id
- interface
- facing
- orientation
diff --git a/chromeos-config/cros_config_host/cros_config_schema_unittest.py b/chromeos-config/cros_config_host/cros_config_schema_unittest.py
index 4492ff8..ccf17ff 100755
--- a/chromeos-config/cros_config_host/cros_config_schema_unittest.py
+++ b/chromeos-config/cros_config_host/cros_config_schema_unittest.py
@@ -252,6 +252,85 @@
self.assertIn('is not valid', str(ctx.exception))
+class ValidateFingerprintSchema(cros_test_lib.TestCase):
+
+ def setUp(self):
+ self._schema = cros_config_schema.ReadSchema()
+
+ def testROVersion(self):
+ config = {
+ 'chromeos': {
+ 'configs': [
+ {'identity': {'platform-name': 'foo',
+ 'sku-id': 1},
+ 'name': 'foo',
+ 'fingerprint': {
+ 'board': 'dartmonkey',
+ 'ro-version': '123'}
+ },
+ ],
+ },
+ }
+ libcros_schema.ValidateConfigSchema(self._schema,
+ libcros_schema.FormatJson(config))
+
+ def testROVersionMissingBoardName(self):
+ config = {
+ 'chromeos': {
+ 'configs': [
+ {'identity': {'platform-name': 'foo',
+ 'sku-id': 1},
+ 'name': 'foo',
+ 'fingerprint': {
+ # "ro-version" only allowed if "board" is also specified.
+ 'ro-version': '123'}
+ },
+ ],
+ },
+ }
+ with self.assertRaises(jsonschema.exceptions.ValidationError) as ctx:
+ libcros_schema.ValidateConfigSchema(self._schema,
+ libcros_schema.FormatJson(config))
+
+ self.assertEqual(ctx.exception.message,
+ "'board' is a dependency of 'ro-version'")
+
+
+class ValidateCameraSchema(cros_test_lib.TestCase):
+
+ def setUp(self):
+ self._schema = cros_config_schema.ReadSchema()
+
+ def testDevices(self):
+ config = {
+ 'chromeos': {
+ 'configs': [
+ {
+ 'identity': {'platform-name': 'foo', 'sku-id': 1},
+ 'name': 'foo',
+ 'camera': {
+ 'count': 2,
+ 'devices': [
+ {
+ 'interface': 'usb',
+ 'facing': 'front',
+ 'orientation': 180,
+ },
+ {
+ 'interface': 'mipi',
+ 'facing': 'back',
+ 'orientation': 0,
+ },
+ ],
+ }
+ },
+ ],
+ },
+ }
+ libcros_schema.ValidateConfigSchema(self._schema,
+ libcros_schema.FormatJson(config))
+
+
WHITELABEL_CONFIG = """
chromeos:
devices: