From: Uwe Hermann Date: Fri, 21 Jul 2017 16:14:08 +0000 (+0200) Subject: drivers: Eliminate some unnecessary vendor/model #defines. X-Git-Url: https://sigrok.org/gitweb/?p=libsigrok.git;a=commitdiff_plain;h=b15ff1c92aabeea04649de25a3a01f851ab0a1ec drivers: Eliminate some unnecessary vendor/model #defines. Most drivers use the vendor/model strings directly already; make all of them do that consistently. --- diff --git a/src/hardware/asix-sigma/api.c b/src/hardware/asix-sigma/api.c index c9b787e7..a48d7211 100644 --- a/src/hardware/asix-sigma/api.c +++ b/src/hardware/asix-sigma/api.c @@ -112,8 +112,8 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) sdi = g_malloc0(sizeof(struct sr_dev_inst)); sdi->status = SR_ST_INITIALIZING; - sdi->vendor = g_strdup(USB_VENDOR_NAME); - sdi->model = g_strdup(USB_MODEL_NAME); + sdi->vendor = g_strdup("ASIX"); + sdi->model = g_strdup("SIGMA"); for (i = 0; i < ARRAY_SIZE(channel_names); i++) sr_channel_new(sdi, i, SR_CHANNEL_LOGIC, TRUE, channel_names[i]); diff --git a/src/hardware/asix-sigma/protocol.h b/src/hardware/asix-sigma/protocol.h index 98eb1a68..2c54dfa1 100644 --- a/src/hardware/asix-sigma/protocol.h +++ b/src/hardware/asix-sigma/protocol.h @@ -43,8 +43,6 @@ #define USB_VENDOR 0xa600 #define USB_PRODUCT 0xa000 #define USB_DESCRIPTION "ASIX SIGMA" -#define USB_VENDOR_NAME "ASIX" -#define USB_MODEL_NAME "SIGMA" enum sigma_write_register { WRITE_CLOCK_SELECT = 0, diff --git a/src/hardware/gmc-mh-1x-2x/api.c b/src/hardware/gmc-mh-1x-2x/api.c index 91f12560..7a54aa68 100644 --- a/src/hardware/gmc-mh-1x-2x/api.c +++ b/src/hardware/gmc-mh-1x-2x/api.c @@ -25,7 +25,6 @@ #define SERIALCOMM_1X_RS232 "8228/6n1/dtr=1/rts=1/flow=0" /* =8192, closer with divider */ #define SERIALCOMM_2X_RS232 "9600/6n1/dtr=1/rts=1/flow=0" #define SERIALCOMM_2X "9600/8n1/dtr=1/rts=1/flow=0" -#define VENDOR_GMC "Gossen Metrawatt" static const uint32_t scanopts[] = { SR_CONF_CONN, @@ -195,10 +194,10 @@ static GSList *scan_1x_2x_rs232(struct sr_dev_driver *di, GSList *options) } if (model != METRAHIT_NONE) { - sr_spew("%s %s detected!", VENDOR_GMC, gmc_model_str(model)); + sr_spew("%s detected!", gmc_model_str(model)); sdi = g_malloc0(sizeof(struct sr_dev_inst)); sdi->status = SR_ST_INACTIVE; - sdi->vendor = g_strdup(VENDOR_GMC); + sdi->vendor = g_strdup("Gossen Metrawatt"); sdi->model = g_strdup(gmc_model_str(model)); devc = g_malloc0(sizeof(struct dev_context)); sr_sw_limits_init(&devc->limits); @@ -258,7 +257,7 @@ static GSList *scan_2x_bd232(struct sr_dev_driver *di, GSList *options) sdi = g_malloc0(sizeof(struct sr_dev_inst)); sdi->status = SR_ST_INACTIVE; - sdi->vendor = g_strdup(VENDOR_GMC); + sdi->vendor = g_strdup("Gossen Metrawatt"); sdi->priv = devc; /* Send message 03 "Query multimeter version and status" */ @@ -286,7 +285,7 @@ static GSList *scan_2x_bd232(struct sr_dev_driver *di, GSList *options) devc->buflen = 0; if (devc->model != METRAHIT_NONE) { - sr_spew("%s %s detected!", VENDOR_GMC, gmc_model_str(devc->model)); + sr_spew("%s detected!", gmc_model_str(devc->model)); sr_sw_limits_init(&devc->limits); sdi->model = g_strdup(gmc_model_str(devc->model)); sdi->version = g_strdup_printf("Firmware %d.%d", devc->fw_ver_maj, devc->fw_ver_min); @@ -297,7 +296,7 @@ static GSList *scan_2x_bd232(struct sr_dev_driver *di, GSList *options) devc = g_malloc0(sizeof(struct dev_context)); sdi = g_malloc0(sizeof(struct sr_dev_inst)); sdi->status = SR_ST_INACTIVE; - sdi->vendor = g_strdup(VENDOR_GMC); + sdi->vendor = g_strdup("Gossen Metrawatt"); } }; diff --git a/src/hardware/ikalogic-scanalogic2/api.c b/src/hardware/ikalogic-scanalogic2/api.c index 1b2a26f4..277d0dce 100644 --- a/src/hardware/ikalogic-scanalogic2/api.c +++ b/src/hardware/ikalogic-scanalogic2/api.c @@ -104,8 +104,8 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) sdi = g_malloc0(sizeof(struct sr_dev_inst)); sdi->status = SR_ST_INACTIVE; - sdi->vendor = g_strdup(VENDOR_NAME); - sdi->model = g_strdup(MODEL_NAME); + sdi->vendor = g_strdup("IKALOGIC"); + sdi->model = g_strdup("Scanalogic-2"); sdi->version = g_strdup_printf("%u.%u", dev_info.fw_ver_major, dev_info.fw_ver_minor); sdi->serial_num = g_strdup_printf("%d", dev_info.serial); sdi->priv = devc; diff --git a/src/hardware/ikalogic-scanalogic2/protocol.h b/src/hardware/ikalogic-scanalogic2/protocol.h index bb9de666..a9471bb5 100644 --- a/src/hardware/ikalogic-scanalogic2/protocol.h +++ b/src/hardware/ikalogic-scanalogic2/protocol.h @@ -29,9 +29,6 @@ #define LOG_PREFIX "ikalogic-scanalogic2" -#define VENDOR_NAME "IKALOGIC" -#define MODEL_NAME "Scanalogic-2" - #define USB_VID_PID "20a0.4123" #define USB_INTERFACE 0 #define USB_TIMEOUT_MS (5 * 1000) diff --git a/src/hardware/ikalogic-scanaplus/api.c b/src/hardware/ikalogic-scanaplus/api.c index 5aded17b..6538dd96 100644 --- a/src/hardware/ikalogic-scanaplus/api.c +++ b/src/hardware/ikalogic-scanaplus/api.c @@ -22,8 +22,6 @@ #define USB_VENDOR_ID 0x0403 #define USB_DEVICE_ID 0x6014 -#define USB_VENDOR_NAME "IKALOGIC" -#define USB_MODEL_NAME "ScanaPLUS" #define USB_IPRODUCT "SCANAPLUS" #define SAMPLE_BUF_SIZE (8 * 1024 * 1024) @@ -97,8 +95,8 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) sdi = g_malloc0(sizeof(struct sr_dev_inst)); sdi->status = SR_ST_INACTIVE; - sdi->vendor = g_strdup(USB_VENDOR_NAME); - sdi->model = g_strdup(USB_MODEL_NAME); + sdi->vendor = g_strdup("IKALOGIC"); + sdi->model = g_strdup("ScanaPLUS"); sdi->priv = devc; for (i = 0; i < ARRAY_SIZE(channel_names); i++) diff --git a/src/hardware/kecheng-kc-330b/api.c b/src/hardware/kecheng-kc-330b/api.c index 8f2bea58..50986802 100644 --- a/src/hardware/kecheng-kc-330b/api.c +++ b/src/hardware/kecheng-kc-330b/api.c @@ -22,7 +22,6 @@ #include "protocol.h" #define USB_CONN "1041.8101" -#define VENDOR "Kecheng" #define USB_INTERFACE 0 static const uint32_t drvopts[] = { @@ -122,7 +121,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) continue; sdi = g_malloc0(sizeof(struct sr_dev_inst)); sdi->status = SR_ST_INACTIVE; - sdi->vendor = g_strdup(VENDOR); + sdi->vendor = g_strdup("Kecheng"); sdi->model = model; /* Already g_strndup()'d. */ sdi->inst_type = SR_INST_USB; sdi->conn = l->data; diff --git a/src/hardware/lascar-el-usb/protocol.c b/src/hardware/lascar-el-usb/protocol.c index 03fbf252..bda67b33 100644 --- a/src/hardware/lascar-el-usb/protocol.c +++ b/src/hardware/lascar-el-usb/protocol.c @@ -324,7 +324,7 @@ static struct sr_dev_inst *lascar_identify(unsigned char *config) sdi = g_malloc0(sizeof(struct sr_dev_inst)); sdi->status = SR_ST_INACTIVE; - sdi->vendor = g_strdup(LASCAR_VENDOR); + sdi->vendor = g_strdup("Lascar"); sdi->model = g_strdup(profile->modelname); sdi->version = g_strdup(firmware); diff --git a/src/hardware/lascar-el-usb/protocol.h b/src/hardware/lascar-el-usb/protocol.h index 14699096..bc7e6ebd 100644 --- a/src/hardware/lascar-el-usb/protocol.h +++ b/src/hardware/lascar-el-usb/protocol.h @@ -26,7 +26,6 @@ #define LOG_PREFIX "lascar-el-usb" -#define LASCAR_VENDOR "Lascar" #define LASCAR_INTERFACE 0 #define LASCAR_EP_IN 0x82 #define LASCAR_EP_OUT 2 diff --git a/src/hardware/motech-lps-30x/api.c b/src/hardware/motech-lps-30x/api.c index fb48ef09..32258f49 100644 --- a/src/hardware/motech-lps-30x/api.c +++ b/src/hardware/motech-lps-30x/api.c @@ -32,8 +32,6 @@ SR_PRIV int lps_query_status(struct sr_dev_inst *sdi); #define SERIALCOMM "2400/8n1/dtr=1/rts=1/flow=0" -#define VENDOR_MOTECH "Motech" - static const uint32_t scanopts[] = { SR_CONF_CONN, SR_CONF_SERIALCOMM, @@ -423,7 +421,7 @@ static GSList *do_scan(lps_modelid modelid, struct sr_dev_driver *drv, GSList *o sdi = g_malloc0(sizeof(struct sr_dev_inst)); sdi->status = SR_ST_INACTIVE; - sdi->vendor = g_strdup(VENDOR_MOTECH); + sdi->vendor = g_strdup("Motech"); sdi->model = g_strdup(models[modelid].modelstr); sdi->version = g_strdup(verstr); sdi->inst_type = SR_INST_SERIAL; diff --git a/src/hardware/pipistrello-ols/protocol.h b/src/hardware/pipistrello-ols/protocol.h index c1aaac4b..5c8cbb3b 100644 --- a/src/hardware/pipistrello-ols/protocol.h +++ b/src/hardware/pipistrello-ols/protocol.h @@ -31,7 +31,6 @@ #define USB_VENDOR_ID 0x0403 #define USB_DEVICE_ID 0x6010 -#define USB_VENDOR_NAME "Saanlima" #define USB_IPRODUCT "Pipistrello LX45" #define FTDI_BUF_SIZE (16 * 1024) diff --git a/src/hardware/sysclk-lwla/api.c b/src/hardware/sysclk-lwla/api.c index 127324f2..7d23bf3d 100644 --- a/src/hardware/sysclk-lwla/api.c +++ b/src/hardware/sysclk-lwla/api.c @@ -67,7 +67,7 @@ static struct sr_dev_inst *dev_inst_new(const struct model_info *model) sdi = g_malloc0(sizeof(struct sr_dev_inst)); sdi->status = SR_ST_INACTIVE; - sdi->vendor = g_strdup(VENDOR_NAME); + sdi->vendor = g_strdup("SysClk"); sdi->model = g_strdup(model->name); sdi->priv = devc; diff --git a/src/hardware/sysclk-lwla/protocol.h b/src/hardware/sysclk-lwla/protocol.h index 027f3f55..23c2728a 100644 --- a/src/hardware/sysclk-lwla/protocol.h +++ b/src/hardware/sysclk-lwla/protocol.h @@ -28,8 +28,6 @@ #include #include -#define VENDOR_NAME "SysClk" - /* Maximum configurable sample count limit. * Due to compression, there is no meaningful hardware limit the driver * could report. So this value is less than 2^64-1 for no reason other diff --git a/src/hardware/uni-t-ut32x/api.c b/src/hardware/uni-t-ut32x/api.c index f5124993..a03c8ec6 100644 --- a/src/hardware/uni-t-ut32x/api.c +++ b/src/hardware/uni-t-ut32x/api.c @@ -74,8 +74,8 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) for (l = usb_devices; l; l = l->next) { sdi = g_malloc0(sizeof(struct sr_dev_inst)); sdi->status = SR_ST_INACTIVE; - sdi->vendor = g_strdup(VENDOR); - sdi->model = g_strdup(MODEL); + sdi->vendor = g_strdup("UNI-T"); + sdi->model = g_strdup("UT32x"); sdi->inst_type = SR_INST_USB; sdi->conn = l->data; for (i = 0; i < ARRAY_SIZE(channel_names); i++) diff --git a/src/hardware/uni-t-ut32x/protocol.h b/src/hardware/uni-t-ut32x/protocol.h index f499dcde..59f81eaf 100644 --- a/src/hardware/uni-t-ut32x/protocol.h +++ b/src/hardware/uni-t-ut32x/protocol.h @@ -29,8 +29,6 @@ #define DEFAULT_DATA_SOURCE DATA_SOURCE_LIVE #define USB_CONN "1a86.e008" -#define VENDOR "UNI-T" -#define MODEL "UT32x" #define USB_INTERFACE 0 #define USB_CONFIGURATION 1 diff --git a/src/hardware/victor-dmm/api.c b/src/hardware/victor-dmm/api.c index fd13421f..55b90c7e 100644 --- a/src/hardware/victor-dmm/api.c +++ b/src/hardware/victor-dmm/api.c @@ -28,7 +28,6 @@ #define VICTOR_VID 0x1244 #define VICTOR_PID 0xd237 -#define VICTOR_VENDOR "Victor" #define VICTOR_INTERFACE 0 #define VICTOR_ENDPOINT (LIBUSB_ENDPOINT_IN | 1) @@ -74,7 +73,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) sdi = g_malloc0(sizeof(struct sr_dev_inst)); sdi->status = SR_ST_INACTIVE; - sdi->vendor = g_strdup(VICTOR_VENDOR); + sdi->vendor = g_strdup("Victor"); sdi->connection_id = g_strdup(connection_id); devc = g_malloc0(sizeof(struct dev_context)); sr_sw_limits_init(&devc->limits); diff --git a/src/hardware/yokogawa-dlm/api.c b/src/hardware/yokogawa-dlm/api.c index 28480f52..87b0c776 100644 --- a/src/hardware/yokogawa-dlm/api.c +++ b/src/hardware/yokogawa-dlm/api.c @@ -26,7 +26,6 @@ static struct sr_dev_driver yokogawa_dlm_driver_info; static const char *MANUFACTURER_ID = "YOKOGAWA"; -static const char *MANUFACTURER_NAME = "Yokogawa"; static const uint32_t scanopts[] = { SR_CONF_CONN, @@ -87,7 +86,7 @@ static struct sr_dev_inst *probe_usbtmc_device(struct sr_scpi_dev_inst *scpi) goto fail; sdi = g_malloc0(sizeof(struct sr_dev_inst)); - sdi->vendor = g_strdup(MANUFACTURER_NAME); + sdi->vendor = g_strdup("Yokogawa"); sdi->model = g_strdup(model_name); sdi->version = g_strdup(hw_info->firmware_version); diff --git a/src/hardware/zeroplus-logic-cube/api.c b/src/hardware/zeroplus-logic-cube/api.c index 5f0cd9f0..c3ee8017 100644 --- a/src/hardware/zeroplus-logic-cube/api.c +++ b/src/hardware/zeroplus-logic-cube/api.c @@ -20,7 +20,6 @@ #include #include "protocol.h" -#define VENDOR_NAME "ZEROPLUS" #define USB_INTERFACE 0 #define USB_CONFIGURATION 1 #define NUM_TRIGGER_STAGES 4 @@ -210,7 +209,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) sdi = g_malloc0(sizeof(struct sr_dev_inst)); sdi->status = SR_ST_INACTIVE; - sdi->vendor = g_strdup(VENDOR_NAME); + sdi->vendor = g_strdup("ZEROPLUS"); sdi->model = g_strdup(prof->model_name); sdi->serial_num = g_strdup(serial_num); sdi->connection_id = g_strdup(connection_id);