wlan-ap-Telecominfraproject/feeds/wlan-ap/opensync/patches/33-add-new-manufacturing-data.patch
ravi vaishnav 45dcf6a878 Adding manufacturing data to the AWLAN_Node entry.
Tested on ECW5211, EA8300, EC420, and WF188n.

Signed-off-by: ravi vaishnav <ravi.vaishnav@netexperience.com>
2021-04-17 17:43:19 +02:00

271 lines
8.5 KiB
Diff

Index: opensync-2.0.5.0/interfaces/opensync.ovsschema
===================================================================
--- opensync-2.0.5.0.orig/interfaces/opensync.ovsschema
+++ opensync-2.0.5.0/interfaces/opensync.ovsschema
@@ -199,6 +199,59 @@
"type": "integer"
}
}
+ },
+ "qr_code": {
+ "type": {
+ "key": "string",
+ "value": {
+ "type": "string",
+ "maxLength": 128
+ },
+ "min": 0,
+ "max": "unlimited"
+ }
+ },
+ "model_description": {
+ "type": {
+ "key": {
+ "type": "string"
+ }
+ }
+ },
+ "manufacturer_name": {
+ "type": {
+ "key": {
+ "type": "string"
+ }
+ }
+ },
+ "manufacturer_date": {
+ "type": {
+ "key": {
+ "type": "string"
+ }
+ }
+ },
+ "manufacturer_url": {
+ "type": {
+ "key": {
+ "type": "string"
+ }
+ }
+ },
+ "reference_design": {
+ "type": {
+ "key": {
+ "type": "string"
+ }
+ }
+ },
+ "certification_region": {
+ "type": {
+ "key": {
+ "type": "string"
+ }
+ }
}
},
"isRoot": true,
Index: opensync-2.0.5.0/src/lib/target/inc/target.h
===================================================================
--- opensync-2.0.5.0.orig/src/lib/target/inc/target.h
+++ opensync-2.0.5.0/src/lib/target/inc/target.h
@@ -332,6 +332,115 @@ bool target_hw_revision_get(void *buff,
*/
bool target_platform_version_get(void *buff, size_t buffsz);
+/**
+ * @brief Return device model revision
+ *
+ * This function provides a null terminated byte string containing the
+ * model revision. The model revision is a part of AWLAN_Node table.
+ *
+ * @param buff pointer to a string buffer
+ * @param buffsz size of string buffer
+ * @return true on success
+ */
+bool target_model_revision_get(void *buff, size_t buffsz);
+
+/**
+ * @brief Return device model description
+ *
+ * This function provides a null terminated byte string containing the
+ * model description. The model description is a part of AWLAN_Node table.
+ *
+ * @param buff pointer to a string buffer
+ * @param buffsz size of string buffer
+ * @return true on success
+ */
+bool target_model_description_get(void *buff, size_t buffsz);
+
+/**
+ * @brief Return device manufacturer name
+ *
+ * This function provides a null terminated byte string containing the
+ * manufacturer name. The manufacturer name is a part of AWLAN_Node table.
+ *
+ * @param buff pointer to a string buffer
+ * @param buffsz size of string buffer
+ * @return true on success
+ */
+bool target_manuf_name_get(void *buff, size_t buffsz);
+
+/**
+ * @brief Return device manufacturer date
+ *
+ * This function provides a null terminated byte string containing the
+ * manufacturer date. The manufacturer date is a part of AWLAN_Node table.
+ *
+ * @param buff pointer to a string buffer
+ * @param buffsz size of string buffer
+ * @return true on success
+ */
+bool target_manuf_date_get(void *buff, size_t buffsz);
+
+/**
+ * @brief Return device manufacturer url
+ *
+ * This function provides a null terminated byte string containing the
+ * manufacturer url. The manufacturer url is a part of AWLAN_Node table.
+ *
+ * @param buff pointer to a string buffer
+ * @param buffsz size of string buffer
+ * @return true on success
+ */
+bool target_manuf_url_get(void *buff, size_t buffsz);
+
+/**
+ * @brief Return device manufacturer name abbreviation
+ *
+ * This function provides a null terminated byte string containing the
+ * manufacturer name abbreviation. This is one of the pieces that form
+ * the QR code entry which is a part of AWLAN_Node table.
+ *
+ * @param buff pointer to a string buffer
+ * @param buffsz size of string buffer
+ * @return true on success
+ */
+bool target_manuf_abbr_get(void *buff, size_t buffsz);
+
+/**
+ * @brief Return device reference design
+ *
+ * This function provides a null terminated byte string containing the
+ * reference design. The reference design is a part of AWLAN_Node table.
+ *
+ * @param buff pointer to a string buffer
+ * @param buffsz size of string buffer
+ * @return true on success
+ */
+bool target_ref_design_get(void *buff, size_t buffsz);
+
+/**
+ * @brief Return device certification region
+ *
+ * This function provides a null terminated byte string containing the
+ * certification region. The certification region is a part of AWLAN_Node table.
+ *
+ * @param buff pointer to a string buffer
+ * @param buffsz size of string buffer
+ * @return true on success
+ */
+bool target_cert_region_get(void *buff, size_t buffsz);
+
+/**
+ * @brief Return device mac address
+ *
+ * This function provides a null terminated byte string containing the
+ * mac address. The mac address is a part of AWLAN_Node table.
+ *
+ * @param buff pointer to a string buffer
+ * @param buffsz size of string buffer
+ * @return true on success
+ */
+bool target_mac_addr_get(void *buff, size_t buffsz);
+
/// @} LIB_TARGET_ENTITY
/// @defgroup LIB_TARGET_MAP Interface Mapping API
Index: opensync-2.0.5.0/src/dm/src/dm_ovsdb.c
===================================================================
--- opensync-2.0.5.0.orig/src/dm/src/dm_ovsdb.c
+++ opensync-2.0.5.0/src/dm/src/dm_ovsdb.c
@@ -326,7 +326,7 @@ void fill_entity_data(struct schema_AWLA
s_awlan_node->sku_number_exists = true;
}
- if (true == target_hw_revision_get(buff, sizeof(buff)))
+ if (true == target_model_revision_get(buff, sizeof(buff)))
{
STRSCPY(s_awlan_node->revision, buff);
}
@@ -359,6 +359,58 @@ void fill_entity_data(struct schema_AWLA
}
s_awlan_node->model_exists = true;
+ if (true == target_model_description_get(buff, sizeof(buff)))
+ {
+ STRSCPY(s_awlan_node->model_description, buff);
+ s_awlan_node->model_description_exists = true;
+ }
+
+ if (true == target_manuf_name_get(buff, sizeof(buff)))
+ {
+ STRSCPY(s_awlan_node->manufacturer_name, buff);
+ s_awlan_node->manufacturer_name_exists = true;
+ }
+
+ if (true == target_manuf_date_get(buff, sizeof(buff)))
+ {
+ STRSCPY(s_awlan_node->manufacturer_date, buff);
+ s_awlan_node->manufacturer_date_exists = true;
+ }
+
+ if (true == target_manuf_url_get(buff, sizeof(buff)))
+ {
+ STRSCPY(s_awlan_node->manufacturer_url, buff);
+ s_awlan_node->manufacturer_url_exists = true;
+ }
+
+ if (true == target_ref_design_get(buff, sizeof(buff)))
+ {
+ STRSCPY(s_awlan_node->reference_design, buff);
+ s_awlan_node->reference_design_exists = true;
+ }
+
+ if (true == target_cert_region_get(buff, sizeof(buff)))
+ {
+ STRSCPY(s_awlan_node->certification_region, buff);
+ s_awlan_node->certification_region_exists = true;
+ }
+
+ if (true == target_mac_addr_get(buff, sizeof(buff)))
+ {
+ STRSCPY(s_awlan_node->id, buff);
+ s_awlan_node->id_exists = true;
+ }
+
+ SCHEMA_KEY_VAL_APPEND(s_awlan_node->qr_code, "DT", "AP");
+ SCHEMA_KEY_VAL_APPEND(s_awlan_node->qr_code, "DM", s_awlan_node->id);
+ if (true == target_manuf_abbr_get(buff, sizeof(buff)))
+ {
+ SCHEMA_KEY_VAL_APPEND(s_awlan_node->qr_code, "VN", buff);
+ }
+ SCHEMA_KEY_VAL_APPEND(s_awlan_node->qr_code, "SN", s_awlan_node->serial_number);
+ SCHEMA_KEY_VAL_APPEND(s_awlan_node->qr_code, "MN", s_awlan_node->model);
+ SCHEMA_KEY_VAL_APPEND(s_awlan_node->qr_code, "HW", s_awlan_node->revision);
+
LOG(NOTICE, "Device entity {serial=%s id=%s version=%s platform=%s sku=%s}",
s_awlan_node->serial_number,
s_awlan_node->id,
@@ -422,6 +474,13 @@ bool act_update_entity (void)
"sku_number",
"upgrade_status",
"upgrade_timer",
+ "qr_code",
+ "model_description",
+ "manufacturer_name",
+ "manufacturer_date",
+ "manufacturer_url",
+ "reference_design",
+ "certification_region",
NULL)
);