summaryrefslogtreecommitdiff
path: root/io-module
diff options
context:
space:
mode:
Diffstat (limited to 'io-module')
-rw-r--r--io-module/mts_io.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/io-module/mts_io.c b/io-module/mts_io.c
index 401ee30..9ea8456 100644
--- a/io-module/mts_io.c
+++ b/io-module/mts_io.c
@@ -1894,6 +1894,26 @@ static ssize_t mts_attr_store_serial_mode(struct device *dev,
return count;
}
+static ssize_t mts_attr_show_product_info(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
+{
+ ssize_t value;
+
+ if (strcmp(attr->attr.name, "product-id") == 0) {
+ value = sprintf(buf, "%s\n", id_eeprom.product_id);
+ } else if (strcmp(attr->attr.name, "device-id") == 0) {
+ value = sprintf(buf, "%s\n", id_eeprom.device_id);
+ } else if (strcmp(attr->attr.name, "hw-version") == 0) {
+ value = sprintf(buf, "%s\n", id_eeprom.hw_version);
+ } else {
+ log_error("attribute '%s' not found", attr->attr.name);
+ value = -1;
+ }
+
+ return value;
+}
+
static DEVICE_ATTR_MTS(dev_attr_serial_mode, "serial-mode",
mts_attr_show_serial_mode, mts_attr_store_serial_mode);
@@ -1903,7 +1923,19 @@ static DEVICE_ATTR_MTS(dev_attr_eth_switch_enabled, "eth-switch-enabled",
static DEVICE_ATTR_MTS(dev_attr_radio_reset_telit, "radio-reset",
mts_attr_show_gpio_pin, mts_attr_store_radio_reset_telit);
+static DEVICE_ATTR_RO_MTS(dev_attr_product_id, "product-id",
+ mts_attr_show_product_info);
+
+static DEVICE_ATTR_RO_MTS(dev_attr_device_id, "device-id",
+ mts_attr_show_product_info);
+
+static DEVICE_ATTR_RO_MTS(dev_attr_hw_version, "hw-version",
+ mts_attr_show_product_info);
+
static struct attribute *mt100eocg_platform_attributes[] = {
+ &dev_attr_product_id.attr,
+ &dev_attr_device_id.attr,
+ &dev_attr_hw_version.attr,
&dev_attr_extserial_dtr.attr,
&dev_attr_extserial_dcd_gpio.attr,
&dev_attr_rsersrc.attr,
@@ -1945,6 +1977,9 @@ static struct attribute_group mt100eocg_platform_attribute_group = {
};
static struct attribute *mtr2_platform_attributes[] = {
+ &dev_attr_product_id.attr,
+ &dev_attr_device_id.attr,
+ &dev_attr_hw_version.attr,
&dev_attr_reset.attr,
&dev_attr_reset_monitor.attr,
&dev_attr_radio_reset.attr,
@@ -1983,6 +2018,9 @@ static struct attribute_group mtr2_platform_attribute_group = {
};
static struct attribute *mtcdp_platform_attributes[] = {
+ &dev_attr_product_id.attr,
+ &dev_attr_device_id.attr,
+ &dev_attr_hw_version.attr,
&dev_attr_reset.attr,
&dev_attr_reset_monitor.attr,
&dev_attr_radio_reset.attr,
@@ -2046,6 +2084,9 @@ static struct attribute_group mtcdp_platform_attribute_group = {
};
static struct attribute *mtr_platform_attributes[] = {
+ &dev_attr_product_id.attr,
+ &dev_attr_device_id.attr,
+ &dev_attr_hw_version.attr,
&dev_attr_reset.attr,
&dev_attr_reset_monitor.attr,
&dev_attr_radio_reset_telit.attr,