summaryrefslogtreecommitdiff
path: root/io-module/mts_io.c
diff options
context:
space:
mode:
Diffstat (limited to 'io-module/mts_io.c')
-rw-r--r--io-module/mts_io.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/io-module/mts_io.c b/io-module/mts_io.c
index 1ae85e6..1c9a5b6 100644
--- a/io-module/mts_io.c
+++ b/io-module/mts_io.c
@@ -333,14 +333,30 @@ static ssize_t mts_attr_show_product_info(struct device *dev,
struct device_attribute *attr,
char *buf)
{
+ int i;
ssize_t value;
-
+
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, "%.32s\n", id_eeprom.device_id);
+ } else if (strcmp(attr->attr.name, "uuid") == 0) {
+ //Loop Through UUID Bytes and print them in HEX
+
+ for(i = 0; i < 16; i++) {
+ value = sprintf(buf, "%02X", id_eeprom.uuid[i]);
+ if(value == -1) {
+ return value;
+ }
+ buf += value;
+ }
+ value = sprintf(buf, "\n");
+ if(value == -1) {
+ return value;
+ }
+ value = 33; //16*2 (ASCII HEX) + 1 ('\n')
} else if (strcmp(attr->attr.name, "hw-version") == 0) {
value = sprintf(buf, "%.32s\n", id_eeprom.hw_version);
} else if (strcmp(attr->attr.name, "imei") == 0) {
@@ -367,6 +383,8 @@ 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_uuid, "uuid",
+ mts_attr_show_product_info);
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",
@@ -470,6 +488,13 @@ static void init_accessory_ports(void)
static int mts_id_eeprom_load(void)
{
+ int i;
+ char buf[64] = {0};
+ char* ptr;
+
+ //The mts_id_eeprom buffer is initialize once on boot
+ //reloading the mts_io.ko module will not reinitialize this buffer
+ //only rebooting will reinitialize this buffer
memcpy(&id_eeprom, mts_id_eeprom, sizeof(mts_id_eeprom));
if (mts_id_eeprom[0] == 0xFF) {
@@ -493,6 +518,7 @@ static int mts_id_eeprom_load(void)
id_eeprom.mac_addr[3],
id_eeprom.mac_addr[4],
id_eeprom.mac_addr[5]);
+
log_info("imei: %.32s", id_eeprom.imei);
log_info("capa-gps: %s", DEVICE_CAPA(id_eeprom.capa, CAPA_GPS) ? "yes" : "no");
log_info("capa-din: %s", DEVICE_CAPA(id_eeprom.capa, CAPA_DIN) ? "yes" : "no");
@@ -518,6 +544,12 @@ static int mts_id_eeprom_load(void)
id_eeprom.mac_wifi[4],
id_eeprom.mac_wifi[5]);
}
+ //Loop Through UUID Bytes and print them in HEX
+ ptr = (char*)buf;
+ for(i = 0; i < 16; i++) {
+ ptr += sprintf(ptr, "%02X", id_eeprom.uuid[i]);
+ }
+ log_info("uuid: %s", (char*)buf);
return 0;
}