Commit 3805635e authored by Marc Schink's avatar Marc Schink
Browse files

Update for libjaylink API changes

parent bc5373b9
......@@ -31,8 +31,7 @@ int main(int argc, char **argv)
uint8_t caps[JAYLINK_DEV_EXT_CAPS_SIZE];
struct jaylink_hardware_version hwver;
uint32_t interfaces;
uint32_t freq;
uint16_t div;
struct jaylink_speed speed;
struct jaylink_swo_speed swo_speed;
uint8_t config[JAYLINK_DEV_CONFIG_SIZE];
bool use_serial_number;
......@@ -68,9 +67,18 @@ int main(int argc, char **argv)
return EXIT_FAILURE;
}
ret = jaylink_get_device_list(ctx, &devs);
ret = jaylink_discovery_scan(ctx, 0);
if (ret < 0) {
if (ret != JAYLINK_OK) {
printf("jaylink_discovery_scan() failed: %s.\n",
jaylink_strerror_name(ret));
jaylink_exit(ctx);
return EXIT_FAILURE;
}
ret = jaylink_get_devices(ctx, &devs, NULL);
if (ret != JAYLINK_OK) {
printf("jaylink_get_device_list() failed: %s.\n",
jaylink_strerror_name(ret));
jaylink_exit(ctx);
......@@ -104,7 +112,7 @@ int main(int argc, char **argv)
jaylink_strerror_name(ret));
}
jaylink_free_device_list(devs, true);
jaylink_free_devices(devs, true);
if (!device_found) {
printf("No J-Link device found.\n");
......@@ -207,7 +215,7 @@ int main(int argc, char **argv)
}
if (jaylink_has_cap(caps, JAYLINK_DEV_CAP_GET_SPEEDS)) {
ret = jaylink_get_speeds(devh, &freq, &div);
ret = jaylink_get_speeds(devh, &speed);
if (ret != JAYLINK_OK) {
printf("jaylink_get_speeds() failed: "
......@@ -222,7 +230,8 @@ int main(int argc, char **argv)
if (jaylink_has_cap(caps, JAYLINK_DEV_CAP_ADAPTIVE_CLOCKING))
printf(" - Adaptive clocking\n");
printf(" - %u MHz / div; div >= %u\n", freq / 1000000, div);
printf(" - %u MHz / div; div >= %u\n", speed.freq / 1000000,
speed.div);
}
if (jaylink_has_cap(caps, JAYLINK_DEV_CAP_SWO)) {
......
......@@ -102,9 +102,18 @@ int main(int argc, char **argv)
return EXIT_FAILURE;
}
ret = jaylink_get_device_list(ctx, &devs);
ret = jaylink_discovery_scan(ctx, 0);
if (ret < 0) {
if (ret != JAYLINK_OK) {
printf("jaylink_discovery_scan() failed: %s.\n",
jaylink_strerror_name(ret));
jaylink_exit(ctx);
return EXIT_FAILURE;
}
ret = jaylink_get_devices(ctx, &devs, NULL);
if (ret != JAYLINK_OK) {
printf("jaylink_get_device_list() failed: %s.\n",
jaylink_strerror_name(ret));
jaylink_exit(ctx);
......@@ -138,7 +147,7 @@ int main(int argc, char **argv)
jaylink_strerror_name(ret));
}
jaylink_free_device_list(devs, true);
jaylink_free_devices(devs, true);
if (!device_found) {
printf("No J-Link device found.\n");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment