]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/scpi-pps/api.c
scpi-pps: Generalize vendor name cleanup.
[libsigrok.git] / src / hardware / scpi-pps / api.c
index ec84db74eabf856bcb6224bde03782a744bf937f..cf161710af1da2a8002691f5786e90bd06c71b94 100644 (file)
@@ -22,8 +22,8 @@
 
 SR_PRIV struct sr_dev_driver scpi_pps_driver_info;
 static struct sr_dev_driver *di = &scpi_pps_driver_info;
-SR_PRIV const struct scpi_pps pps_profiles[] = {};
-unsigned int num_pps_profiles;
+extern unsigned int num_pps_profiles;
+extern const struct scpi_pps pps_profiles[];
 
 static const int32_t scanopts[] = {
        SR_CONF_CONN,
@@ -47,6 +47,7 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi)
        struct pps_channel_group *pcg;
        uint64_t mask;
        unsigned int i, j;
+       const char *vendor;
 
        if (sr_scpi_get_hw_id(scpi, &hw_info) != SR_OK) {
                sr_info("Couldn't get IDN response.");
@@ -55,8 +56,10 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi)
 
        device = NULL;
        for (i = 0; i < num_pps_profiles; i++) {
-               if (!strcasecmp(hw_info->manufacturer, pps_profiles[i].idn_vendor) &&
-                               !strcmp(hw_info->model, pps_profiles[i].idn_model)) {
+               vendor = get_vendor(hw_info->manufacturer);
+               if (strcasecmp(vendor, pps_profiles[i].idn_vendor))
+                       continue;
+               if (!strcmp(hw_info->model, pps_profiles[i].idn_model)) {
                        device = &pps_profiles[i];
                        break;
                }
@@ -66,8 +69,8 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi)
                return NULL;
        }
 
-       sdi = sr_dev_inst_new(0, SR_ST_ACTIVE, device->vendor, device->idn_model,
-                       hw_info->firmware_version);
+       sdi = sr_dev_inst_new(0, SR_ST_ACTIVE, vendor,
+                       device->idn_model, hw_info->firmware_version);
        sdi->conn = scpi;
        sdi->driver = di;
        sdi->inst_type = SR_INST_SCPI;