diff options
author | jt1134 <jt1134@gmail.com> | 2013-01-06 18:50:57 -0600 |
---|---|---|
committer | jt1134 <jt1134@gmail.com> | 2013-01-06 19:32:05 -0600 |
commit | e8139108c77cb93a1b4731b354df7af85cf1a02b (patch) | |
tree | ea4984f83841a091d5a3f261584d49471a5c1309 | |
parent | 761f0b49543696d43afcfff6b8c389a131b4228a (diff) | |
download | device_samsung_aries-common-e8139108c77cb93a1b4731b354df7af85cf1a02b.zip device_samsung_aries-common-e8139108c77cb93a1b4731b354df7af85cf1a02b.tar.gz device_samsung_aries-common-e8139108c77cb93a1b4731b354df7af85cf1a02b.tar.bz2 |
bdaddr_read: add changes to read bdaddr from system property
Change-Id: I69b5f081256efaed7beed56df6bd087a473bd075
-rw-r--r-- | bdaddr_read/bdaddr_read.c | 23 | ||||
-rw-r--r-- | init.aries.rc | 2 |
2 files changed, 6 insertions, 19 deletions
diff --git a/bdaddr_read/bdaddr_read.c b/bdaddr_read/bdaddr_read.c index 360cc74..648377d 100644 --- a/bdaddr_read/bdaddr_read.c +++ b/bdaddr_read/bdaddr_read.c @@ -4,7 +4,7 @@ #include <cutils/log.h> #define LOG_TAG "bdaddr" -#define SAMSUNG_BDADDR_PATH "/efs/imei/bt.txt" +#define SAMSUNG_BDADDR_PATH "ril.bt_macaddr" #define BDADDR_PATH "/data/bdaddr" /* Read bluetooth MAC from SAMSUNG_BDADDR_PATH (different format), @@ -16,30 +16,17 @@ int main() { char tmpbdaddr[23]; // bt_macaddr:xxxxxxxxxxxx char bdaddr[18]; - int count; int fd; - fd = open(SAMSUNG_BDADDR_PATH, O_RDONLY); - if(fd < 0) { - fprintf(stderr, "open(%s) failed\n", SAMSUNG_BDADDR_PATH); - ALOGE("Can't open %s\n", SAMSUNG_BDADDR_PATH); - return -1; - } - - count = read(fd, tmpbdaddr, sizeof(tmpbdaddr)); - if (count < 0) { + property_get(SAMSUNG_BDADDR_PATH, tmpbdaddr, ""); + if (tmpbdaddr[0] == 0) { fprintf(stderr, "read(%s) failed\n", SAMSUNG_BDADDR_PATH); ALOGE("Can't read %s\n", SAMSUNG_BDADDR_PATH); return -1; } - else if (count != sizeof(tmpbdaddr)) { - fprintf(stderr, "read(%s) unexpected size %d\n", SAMSUNG_BDADDR_PATH, count); - ALOGE("Error reading %s (unexpected size %d)\n", SAMSUNG_BDADDR_PATH, count); - return -1; - } - count = sprintf(bdaddr, "%2.2s:%2.2s:%2.2s:%2.2s:%2.2s:%2.2s\0", - tmpbdaddr+11,tmpbdaddr+13,tmpbdaddr+15,tmpbdaddr+17,tmpbdaddr+19,tmpbdaddr+21); + sprintf(bdaddr, "%2.2s:%2.2s:%2.2s:%2.2s:%2.2s:%2.2s\0", + tmpbdaddr,tmpbdaddr+2,tmpbdaddr+4,tmpbdaddr+6,tmpbdaddr+8,tmpbdaddr+10); fd = open(BDADDR_PATH, O_WRONLY|O_CREAT|O_TRUNC, 00600|00060|00006); if (fd < 0) { diff --git a/init.aries.rc b/init.aries.rc index f758e97..2192133 100644 --- a/init.aries.rc +++ b/init.aries.rc @@ -163,7 +163,7 @@ service bdaddr /system/bin/bdaddr_read disabled oneshot -on property:init.svc.bootanim=running +on property:ril.bt_macaddr=* start bdaddr # bugreport is triggered by holding down volume down, volume up and power |