X-Git-Url: https://sigrok.org/gitweb/?p=sigrok-cli.git;a=blobdiff_plain;f=sigrok-cli.c;h=06aa053b83793495afebfcb0b9f3f9ad8ac9dad4;hp=fc6884be07b349df565b2bd1d6382394df7d9e55;hb=548b7ddc8144ca0430f852c89ae4f2e61ab487d7;hpb=7cb9889f780a78f728c10717625e288a20ea69cb diff --git a/sigrok-cli.c b/sigrok-cli.c index fc6884b..06aa053 100644 --- a/sigrok-cli.c +++ b/sigrok-cli.c @@ -94,7 +94,7 @@ static void show_version(void) printf("sigrok-cli %s\n\n", VERSION); printf("Supported hardware drivers:\n"); - plugins = sr_list_hwplugins(); + plugins = sr_hwplugins_list(); for (p = plugins; p; p = p->next) { plugin = p->data; printf(" %-20s %s\n", plugin->name, plugin->longname); @@ -114,7 +114,7 @@ static void show_version(void) printf("\n"); /* TODO: Error handling. */ - srd_init(); + srd_init(NULL); printf("Supported protocol decoders:\n"); for (l = srd_list_decoders(); l; l = l->next) { @@ -130,7 +130,7 @@ static void print_device_line(const struct sr_device *device) { const struct sr_device_instance *sdi; - sr_device_get_info(device, SR_DI_INSTANCE, (const void **) &sdi); + sr_dev_get_info(device, SR_DI_INSTANCE, (const void **)&sdi); if (sdi->vendor && sdi->vendor[0]) printf("%s ", sdi->vendor); @@ -150,7 +150,7 @@ static void show_device_list(void) int devcnt; devcnt = 0; - devices = sr_device_list(); + devices = sr_dev_list(); if (g_slist_length(devices) == 0) return; @@ -159,7 +159,7 @@ static void show_device_list(void) demo_device = NULL; for (l = devices; l; l = l->next) { device = l->data; - if (sr_device_has_hwcap(device, SR_HWCAP_DEMO_DEVICE)) { + if (sr_dev_has_hwcap(device, SR_HWCAP_DEMO_DEVICE)) { demo_device = device; continue; } @@ -189,8 +189,8 @@ static void show_device_detail(void) print_device_line(device); - if (sr_device_get_info(device, SR_DI_TRIGGER_TYPES, - (const void **) &charopts) == SR_OK) { + if (sr_dev_get_info(device, SR_DI_TRIGGER_TYPES, + (const void **)&charopts) == SR_OK) { printf("Supported triggers: "); while (*charopts) { printf("%c ", *charopts); @@ -212,8 +212,8 @@ static void show_device_detail(void) if (hwo->capability == SR_HWCAP_PATTERN_MODE) { printf(" %s", hwo->shortname); - if (sr_device_get_info(device, SR_DI_PATTERNMODES, - (const void **) &stropts) == SR_OK) { + if (sr_dev_get_info(device, SR_DI_PATTERNMODES, + (const void **)&stropts) == SR_OK) { printf(" - supported modes:\n"); for (i = 0; stropts[i]; i++) printf(" %s\n", stropts[i]); @@ -223,8 +223,8 @@ static void show_device_detail(void) } else if (hwo->capability == SR_HWCAP_SAMPLERATE) { printf(" %s", hwo->shortname); /* Supported samplerates */ - if (sr_device_get_info(device, SR_DI_SAMPLERATES, - (const void **) &samplerates) != SR_OK) { + if (sr_dev_get_info(device, SR_DI_SAMPLERATES, + (const void **)&samplerates) != SR_OK) { printf("\n"); continue; } @@ -510,13 +510,13 @@ err_out: return 0; } -void show_pd_annotation(struct srd_proto_data *pdata, void *data) +void show_pd_annotation(struct srd_proto_data *pdata, void *user_data) { int i; char **annotations; - /* 'data' is not used in this specific callback. */ - (void)data; + /* 'user_data' is not used in this specific callback. */ + (void)user_data; if (pdata->ann_format != 0) { /* CLI only shows the default annotation format. */ @@ -559,10 +559,10 @@ static int select_probes(struct sr_device *device) for (i = 0; i < max_probes; i++) { if (probelist[i]) { - sr_device_probe_name(device, i + 1, probelist[i]); + sr_dev_probe_name(device, i + 1, probelist[i]); g_free(probelist[i]); } else { - probe = sr_device_probe_find(device, i + 1); + probe = sr_dev_probe_find(device, i + 1); probe->enabled = FALSE; } } @@ -706,10 +706,10 @@ int num_real_devices(void) int num_devices; num_devices = 0; - devices = sr_device_list(); + devices = sr_dev_list(); for (l = devices; l; l = l->next) { device = l->data; - if (!sr_device_has_hwcap(device, SR_HWCAP_DEMO_DEVICE)) + if (!sr_dev_has_hwcap(device, SR_HWCAP_DEMO_DEVICE)) num_devices++; } @@ -833,7 +833,7 @@ static void run_session(void) if (opt_continuous) { capabilities = device->plugin->get_capabilities(); - if (!sr_find_hwcap(capabilities, SR_HWCAP_CONTINUOUS)) { + if (!sr_has_hwcap(capabilities, SR_HWCAP_CONTINUOUS)) { printf("This device does not support continuous sampling."); sr_session_destroy(); return; @@ -850,7 +850,7 @@ static void run_session(void) max_probes = g_slist_length(device->probes); for (i = 0; i < max_probes; i++) { if (probelist[i]) { - sr_device_trigger_set(device, i + 1, probelist[i]); + sr_dev_trigger_set(device, i + 1, probelist[i]); g_free(probelist[i]); } } @@ -866,7 +866,7 @@ static void run_session(void) } capabilities = device->plugin->get_capabilities(); - if (sr_find_hwcap(capabilities, SR_HWCAP_LIMIT_MSEC)) { + if (sr_has_hwcap(capabilities, SR_HWCAP_LIMIT_MSEC)) { if (device->plugin->set_configuration(device->plugin_index, SR_HWCAP_LIMIT_MSEC, &time_msec) != SR_OK) { printf("Failed to configure time limit.\n"); @@ -879,12 +879,12 @@ static void run_session(void) * convert to samples based on the samplerate. */ limit_samples = 0; - if (sr_device_has_hwcap(device, SR_HWCAP_SAMPLERATE)) { + if (sr_dev_has_hwcap(device, SR_HWCAP_SAMPLERATE)) { const uint64_t *samplerate; - sr_device_get_info(device, SR_DI_CUR_SAMPLERATE, - (const void **) &samplerate); - limit_samples = (*samplerate) * time_msec / (uint64_t) 1000; + sr_dev_get_info(device, SR_DI_CUR_SAMPLERATE, + (const void **)&samplerate); + limit_samples = (*samplerate) * time_msec / (uint64_t)1000; } if (limit_samples == 0) { printf("Not enough time at this samplerate.\n"); @@ -1006,7 +1006,7 @@ int main(int argc, char **argv) return 1; if (opt_pds) { - if (srd_init() != SRD_OK) { + if (srd_init(NULL) != SRD_OK) { printf("Failed to initialize sigrokdecode\n"); return 1; }