]> sigrok.org Git - sigrok-cli.git/blobdiff - parsers.c
sr: rename all sr_hwplugin(s)_* functions to sr_hw_*
[sigrok-cli.git] / parsers.c
index b895825030b9052433eebaf1f6c443dc02b19eb2..4430b90daa1f631b1aa384d285eac29c941fd336 100644 (file)
--- a/parsers.c
+++ b/parsers.c
@@ -33,7 +33,9 @@ char **parse_probestring(int max_probes, const char *probestring)
 
        error = FALSE;
        range = NULL;
 
        error = FALSE;
        range = NULL;
-       probelist = g_malloc0(max_probes * sizeof(char *));
+       if (!(probelist = g_try_malloc0(max_probes * sizeof(char *)))) {
+               /* TODO: Handle errors. */
+       }
        tokens = g_strsplit(probestring, ",", max_probes);
 
        for (i = 0; tokens[i]; i++) {
        tokens = g_strsplit(probestring, ",", max_probes);
 
        for (i = 0; tokens[i]; i++) {
@@ -144,10 +146,10 @@ struct sr_device *parse_devicestring(const char *devicestring)
                        return NULL;
 
                device_cnt = 0;
                        return NULL;
 
                device_cnt = 0;
-               devices = sr_device_list();
+               devices = sr_dev_list();
                for (l = devices; l; l = l->next) {
                        d = l->data;
                for (l = devices; l; l = l->next) {
                        d = l->data;
-                       if (strstr(d->plugin->name, "demo"))
+                       if (sr_dev_has_hwcap(d, SR_HWCAP_DEMO_DEVICE))
                                continue;
                        if (device_cnt == device_num) {
                                if (device_num == device_cnt) {
                                continue;
                        if (device_cnt == device_num) {
                                if (device_num == device_cnt) {
@@ -162,14 +164,14 @@ struct sr_device *parse_devicestring(const char *devicestring)
                 * no need to let them all scan
                 */
                device = NULL;
                 * no need to let them all scan
                 */
                device = NULL;
-               plugins = sr_list_hwplugins();
+               plugins = sr_hw_list();
                for (p = plugins; p; p = p->next) {
                        plugin = p->data;
                        if (strcmp(plugin->name, devicestring))
                                continue;
                for (p = plugins; p; p = p->next) {
                        plugin = p->data;
                        if (strcmp(plugin->name, devicestring))
                                continue;
-                       num_devices = sr_init_hwplugins(plugin);
+                       num_devices = sr_hw_init(plugin);
                        if (num_devices == 1) {
                        if (num_devices == 1) {
-                               devices = sr_device_list();
+                               devices = sr_dev_list();
                                device = devices->data;
                        } else if (num_devices > 1) {
                                printf("driver '%s' found %d devices, select by ID instead.\n",
                                device = devices->data;
                        } else if (num_devices > 1) {
                                printf("driver '%s' found %d devices, select by ID instead.\n",