summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--io-module/mts_io.c54
1 files changed, 50 insertions, 4 deletions
diff --git a/io-module/mts_io.c b/io-module/mts_io.c
index c208083..4371e41 100644
--- a/io-module/mts_io.c
+++ b/io-module/mts_io.c
@@ -1900,12 +1900,32 @@ static ssize_t mts_attr_show_product_info(struct device *dev,
{
ssize_t value;
- if (strcmp(attr->attr.name, "product-id") == 0) {
- value = sprintf(buf, "%s\n", id_eeprom.product_id);
+ if (strcmp(attr->attr.name, "vendor-id") == 0) {
+ value = sprintf(buf, "%.32s\n", id_eeprom.vendor_id);
+ } else if (strcmp(attr->attr.name, "product-id") == 0) {
+ value = sprintf(buf, "%.32s\n", id_eeprom.product_id);
} else if (strcmp(attr->attr.name, "device-id") == 0) {
- value = sprintf(buf, "%s\n", id_eeprom.device_id);
+ value = sprintf(buf, "%.32s\n", id_eeprom.device_id);
} else if (strcmp(attr->attr.name, "hw-version") == 0) {
- value = sprintf(buf, "%s\n", id_eeprom.hw_version);
+ value = sprintf(buf, "%.32s\n", id_eeprom.hw_version);
+ } else if (strcmp(attr->attr.name, "imei") == 0) {
+ value = sprintf(buf, "%.32s\n", id_eeprom.imei);
+ } else if (strcmp(attr->attr.name, "wifi-mac") == 0) {
+ value = sprintf(buf, "%02X:%02X:%02X:%02X:%02X:%02X",
+ id_eeprom.mac_wifi[0],
+ id_eeprom.mac_wifi[1],
+ id_eeprom.mac_wifi[2],
+ id_eeprom.mac_wifi[3],
+ id_eeprom.mac_wifi[4],
+ id_eeprom.mac_wifi[5]);
+ } else if (strcmp(attr->attr.name, "eth-mac") == 0) {
+ value = sprintf(buf, "%02X:%02X:%02X:%02X:%02X:%02X",
+ id_eeprom.mac_addr[0],
+ id_eeprom.mac_addr[1],
+ id_eeprom.mac_addr[2],
+ id_eeprom.mac_addr[3],
+ id_eeprom.mac_addr[4],
+ id_eeprom.mac_addr[5]);
} else {
log_error("attribute '%s' not found", attr->attr.name);
value = -1;
@@ -1923,6 +1943,9 @@ 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_vendor_id, "vendor-id",
+ mts_attr_show_product_info);
+
static DEVICE_ATTR_RO_MTS(dev_attr_product_id, "product-id",
mts_attr_show_product_info);
@@ -1932,10 +1955,22 @@ static DEVICE_ATTR_RO_MTS(dev_attr_device_id, "device-id",
static DEVICE_ATTR_RO_MTS(dev_attr_hw_version, "hw-version",
mts_attr_show_product_info);
+static DEVICE_ATTR_RO_MTS(dev_attr_imei, "imei",
+ mts_attr_show_product_info);
+
+static DEVICE_ATTR_RO_MTS(dev_attr_wifi_mac, "wifi-mac",
+ mts_attr_show_product_info);
+
+static DEVICE_ATTR_RO_MTS(dev_attr_eth_mac, "eth-mac",
+ mts_attr_show_product_info);
+
static struct attribute *mt100eocg_platform_attributes[] = {
+ &dev_attr_vendor_id.attr,
&dev_attr_product_id.attr,
&dev_attr_device_id.attr,
&dev_attr_hw_version.attr,
+ &dev_attr_imei.attr,
+ &dev_attr_eth_mac.attr,
&dev_attr_extserial_dtr.attr,
&dev_attr_extserial_dcd_gpio.attr,
&dev_attr_rsersrc.attr,
@@ -1977,9 +2012,13 @@ static struct attribute_group mt100eocg_platform_attribute_group = {
};
static struct attribute *mtr2_platform_attributes[] = {
+ &dev_attr_vendor_id.attr,
&dev_attr_product_id.attr,
&dev_attr_device_id.attr,
&dev_attr_hw_version.attr,
+ &dev_attr_imei.attr,
+ &dev_attr_eth_mac.attr,
+ &dev_attr_wifi_mac.attr,
&dev_attr_reset.attr,
&dev_attr_reset_monitor.attr,
&dev_attr_radio_reset.attr,
@@ -2018,9 +2057,12 @@ static struct attribute_group mtr2_platform_attribute_group = {
};
static struct attribute *mtcdp_platform_attributes[] = {
+ &dev_attr_vendor_id.attr,
&dev_attr_product_id.attr,
&dev_attr_device_id.attr,
&dev_attr_hw_version.attr,
+ &dev_attr_imei.attr,
+ &dev_attr_eth_mac.attr,
&dev_attr_reset.attr,
&dev_attr_reset_monitor.attr,
&dev_attr_radio_reset.attr,
@@ -2084,9 +2126,13 @@ static struct attribute_group mtcdp_platform_attribute_group = {
};
static struct attribute *mtr_platform_attributes[] = {
+ &dev_attr_vendor_id.attr,
&dev_attr_product_id.attr,
&dev_attr_device_id.attr,
&dev_attr_hw_version.attr,
+ &dev_attr_imei.attr,
+ &dev_attr_eth_mac.attr,
+ &dev_attr_wifi_mac.attr,
&dev_attr_reset.attr,
&dev_attr_reset_monitor.attr,
&dev_attr_radio_reset_telit.attr,