diff options
author | Sean Godinez <sgodinez@multitech.com> | 2015-03-11 07:54:56 -0500 |
---|---|---|
committer | Sean Godinez <sgodinez@multitech.com> | 2015-03-11 07:54:56 -0500 |
commit | 3b52a1b7883353913b1a04a24fcd012771acac1c (patch) | |
tree | cef3a0c120fa35e24386512be3f47666848857cc /io-module | |
parent | 1a06d05dad8eb53ba8bfb4cf45d92041b226b813 (diff) | |
download | mts-io-3b52a1b7883353913b1a04a24fcd012771acac1c.tar.gz mts-io-3b52a1b7883353913b1a04a24fcd012771acac1c.tar.bz2 mts-io-3b52a1b7883353913b1a04a24fcd012771acac1c.zip |
added uuid field (16 bytes) to eeprom1.1.2
Diffstat (limited to 'io-module')
-rw-r--r-- | io-module/mtcdt.c | 1 | ||||
-rw-r--r-- | io-module/mts_eeprom.h | 3 | ||||
-rw-r--r-- | io-module/mts_io.c | 34 |
3 files changed, 36 insertions, 2 deletions
diff --git a/io-module/mtcdt.c b/io-module/mtcdt.c index 0a4f601..0b7dba1 100644 --- a/io-module/mtcdt.c +++ b/io-module/mtcdt.c @@ -260,6 +260,7 @@ static struct attribute *mtcdt_platform_attributes[] = { &dev_attr_vendor_id.attr, &dev_attr_product_id.attr, &dev_attr_device_id.attr, + &dev_attr_uuid.attr, &dev_attr_hw_version.attr, &dev_attr_imei.attr, &dev_attr_eth_mac.attr, diff --git a/io-module/mts_eeprom.h b/io-module/mts_eeprom.h index 640f749..5f5e69c 100644 --- a/io-module/mts_eeprom.h +++ b/io-module/mts_eeprom.h @@ -20,7 +20,8 @@ struct mts_id_eeprom_layout { uint8_t capa[32]; uint8_t mac_bluetooth[6]; uint8_t mac_wifi[6]; - uint8_t reserved[302]; + uint8_t uuid[16]; + uint8_t reserved[286]; }; /* accessory card EEPROM */ 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; } |