diff options
Diffstat (limited to 'api_examples/demo.c')
-rw-r--r-- | api_examples/demo.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/api_examples/demo.c b/api_examples/demo.c index 69ac318375..df9c4bd8bc 100644 --- a/api_examples/demo.c +++ b/api_examples/demo.c @@ -43,12 +43,11 @@ static char buf[BUF_SZ]; int main(int argc, char *argv[]) { - int rv = 0; - int h, i, j; - int devs_no; + int rv = 0, h, i, j, devs_no; struct api_signature *sig = NULL; ulong start, now; struct device_info *di; + lbasize_t rlen; if (!api_search_sig(&sig)) return -1; @@ -96,7 +95,6 @@ int main(int argc, char *argv[]) if (devs_no == 0) return -1; - printf("\n*** Show devices ***\n"); for (i = 0; i < devs_no; i++) { test_dump_di(i); @@ -133,11 +131,12 @@ int main(int argc, char *argv[]) if ((rv = ub_dev_open(i)) != 0) errf("open device %d error %d\n", i, rv); - else if ((rv = ub_dev_read(i, buf, 1, 0)) != 0) + else if ((rv = ub_dev_read(i, buf, 1, 0, &rlen)) != 0) errf("could not read from device %d, error %d\n", i, rv); - - printf("Sector 0 dump (512B):\n"); - test_dump_buf(buf, 512); + else { + printf("Sector 0 dump (512B):\n"); + test_dump_buf(buf, 512); + } ub_dev_close(i); } @@ -178,6 +177,7 @@ int main(int argc, char *argv[]) printf("%s = %s\n", env, ub_env_get(env)); /* reset */ + printf("\n*** Resetting board ***\n"); ub_reset(); printf("\nHmm, reset returned...?!\n"); |