aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilip Balister <philip@opensdr.com>2010-04-20 13:34:24 +0000
committerPhilip Balister <philip@opensdr.com>2010-04-20 13:34:24 +0000
commit29a3b01fb48d1c10f489103b9012b14be6f1553d (patch)
tree10addd92fdbefe3f902436799e6d08a37deb8dd1
parentdfd5bed2b32131cd398a5daae184cec81488b5de (diff)
downloaduhd-29a3b01fb48d1c10f489103b9012b14be6f1553d.tar.gz
uhd-29a3b01fb48d1c10f489103b9012b14be6f1553d.tar.bz2
uhd-29a3b01fb48d1c10f489103b9012b14be6f1553d.zip
usrp-e-i2c always uses hex arguments.
-rw-r--r--host/apps/omap_debug/usrp-e-i2c.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/host/apps/omap_debug/usrp-e-i2c.c b/host/apps/omap_debug/usrp-e-i2c.c
index 19d64731b..c8fcc3f98 100644
--- a/host/apps/omap_debug/usrp-e-i2c.c
+++ b/host/apps/omap_debug/usrp-e-i2c.c
@@ -12,13 +12,14 @@
int main(int argc, char *argv[])
{
- int fp, ret, i;
+ int fp, ret, i, tmp;
struct usrp_e_i2c *i2c_msg;
int direction, address, count;
if (argc < 3) {
- printf("Usage: usrp_e_i2c w address data0 data1 data2 ...\n");
- printf("Usage: usrp_e_i2c r address count\n");
+ printf("Usage: usrp-e-i2c w address data0 data1 data2 ...\n");
+ printf("Usage: usrp-e-i2c r address count\n");
+ printf("All addresses and data in hex.\n");
exit(-1);
}
@@ -30,7 +31,8 @@ int main(int argc, char *argv[])
return -1;
}
- address = atoi(argv[2]);
+ sscanf(argv[2], "%X", &address);
+ printf("Address = %X\n", address);
fp = open("/dev/usrp_e0", O_RDWR);
printf("fp = %d\n", fp);
@@ -38,8 +40,9 @@ int main(int argc, char *argv[])
if (direction) {
count = argc - 3;
} else {
- count = atoi(argv[3]);
+ sscanf(argv[3], "%X", &count);
}
+ printf("Count = %X\n", count);
i2c_msg = malloc(sizeof(i2c_msg) + count * sizeof(char));
@@ -50,7 +53,8 @@ int main(int argc, char *argv[])
// Write
for (i=0; i<count; i++) {
- i2c_msg->data[i] = atoi(argv[3+i]);
+ sscanf(argv[3+i], "%X", &tmp);
+ i2c_msg->data[i] = tmp;
}
ret = ioctl(fp, USRP_E_I2C_WRITE, i2c_msg);