]> sigrok.org Git - libsigrok.git/commitdiff
scpi: add a struct drv_context parameter to scpi_dev_inst_new()
authorAurelien Jacobs <redacted>
Fri, 17 Jan 2014 09:47:42 +0000 (10:47 +0100)
committerUwe Hermann <redacted>
Fri, 7 Feb 2014 17:53:04 +0000 (18:53 +0100)
hardware/common/scpi.c
hardware/common/scpi_serial.c
hardware/common/scpi_tcp.c
hardware/common/scpi_usbtmc.c
hardware/common/scpi_vxi.c
hardware/hameg-hmo/api.c
hardware/rigol-ds/api.c
libsigrok-internal.h

index fc61855fc7cad312836256b570c8eda0edc1541b..2307a8b5f377acdf03f67d5be4cc9650de3ffde3 100644 (file)
@@ -87,8 +87,8 @@ static const struct sr_scpi_dev_inst *scpi_devs[] = {
 #endif
 };
 
-SR_PRIV struct sr_scpi_dev_inst *scpi_dev_inst_new(const char *resource,
-               const char *serialcomm)
+SR_PRIV struct sr_scpi_dev_inst *scpi_dev_inst_new(struct drv_context *drvc,
+               const char *resource, const char *serialcomm)
 {
        struct sr_scpi_dev_inst *scpi = NULL;
        const struct sr_scpi_dev_inst *scpi_dev;
@@ -103,7 +103,7 @@ SR_PRIV struct sr_scpi_dev_inst *scpi_dev_inst_new(const char *resource,
                        *scpi = *scpi_dev;
                        scpi->priv = g_malloc0(scpi->priv_size);
                        params = g_strsplit(resource, "/", 0);
-                       if (scpi->dev_inst_new(scpi->priv, resource,
+                       if (scpi->dev_inst_new(scpi->priv, drvc, resource,
                                               params, serialcomm) != SR_OK) {
                                sr_scpi_free(scpi);
                                scpi = NULL;
index cf962af7c4075cf1a87aaafb69ec31c7d88fb347..6e73c8944df39b0a84144b03d98f3c761dc87ff6 100644 (file)
@@ -35,11 +35,12 @@ struct scpi_serial {
        size_t read;
 };
 
-static int scpi_serial_dev_inst_new(void *priv, const char *resource,
-               char **params, const char *serialcomm)
+static int scpi_serial_dev_inst_new(void *priv, struct drv_context *drvc,
+               const char *resource, char **params, const char *serialcomm)
 {
        struct scpi_serial *sscpi = priv;
 
+       (void)drvc;
        (void)params;
 
        if (!(sscpi->serial = sr_serial_dev_inst_new(resource, serialcomm)))
index 796ea9a8981862a16634a7bbd75282d201cef8d5..21235f36240d61ae25c82e484521b959ac27b833 100644 (file)
@@ -51,11 +51,12 @@ struct scpi_tcp {
        int response_bytes_read;
 };
 
-static int scpi_tcp_dev_inst_new(void *priv, const char *resource,
-               char **params, const char *serialcomm)
+static int scpi_tcp_dev_inst_new(void *priv, struct drv_context *drvc,
+               const char *resource, char **params, const char *serialcomm)
 {
        struct scpi_tcp *tcp = priv;
 
+       (void)drvc;
        (void)resource;
        (void)serialcomm;
 
index 75fcf3aed2a789d39d8ddf2d2bcd175704f59635..6cd79641b90b9ca71dd3447a9cc856b0baf18bf7 100644 (file)
@@ -37,11 +37,12 @@ struct usbtmc_scpi {
        int response_bytes_read;
 };
 
-static int scpi_usbtmc_dev_inst_new(void *priv, const char *resource,
-               char **params, const char *serialcomm)
+static int scpi_usbtmc_dev_inst_new(void *priv, struct drv_context *drvc,
+               const char *resource, char **params, const char *serialcomm)
 {
        struct usbtmc_scpi *uscpi = priv;
 
+       (void)drvc;
        (void)params;
        (void)serialcomm;
 
index 0377d52bb291759ecd73ce97c5dbc1db38ac0002..4bdb6ab9ebb799067a4a6c375b368db64e78cc95 100644 (file)
@@ -37,11 +37,12 @@ struct scpi_vxi {
        unsigned int read_complete;
 };
 
-static int scpi_vxi_dev_inst_new(void *priv, const char *resource,
-               char **params, const char *serialcomm)
+static int scpi_vxi_dev_inst_new(void *priv, struct drv_context *drvc,
+               const char *resource, char **params, const char *serialcomm)
 {
        struct scpi_vxi *vxi = priv;
 
+       (void)drvc;
        (void)resource;
        (void)serialcomm;
 
index b63ee51bb8cf4347032e6bb8920c66d77c38e8a0..5abd8c5fba192286113ccd45f0722fe9f3642ff2 100644 (file)
@@ -220,7 +220,7 @@ static struct sr_dev_inst *hmo_probe_serial_device(const char *serial_device,
        scpi = NULL;
        hw_info = NULL;
 
-       if (!(scpi = scpi_dev_inst_new(serial_device, serial_options)))
+       if (!(scpi = scpi_dev_inst_new(di->priv, serial_device, serial_options)))
                goto fail;
 
        sr_info("Probing %s.", serial_device);
index 706391f4c3bf4d027693cceb37bf2dc75aabb4c6..0f319cbd0902c5bce5d5c8c4eaee190ebf6a642b 100644 (file)
@@ -269,7 +269,7 @@ static int probe_port(const char *resource, const char *serialcomm, GSList **dev
 
        *devices = NULL;
 
-       if (!(scpi = scpi_dev_inst_new(resource, serialcomm)))
+       if (!(scpi = scpi_dev_inst_new(di->priv, resource, serialcomm)))
                return SR_ERR;
 
        if (sr_scpi_open(scpi) != SR_OK) {
index 6e665c58a52a6f2b2afc6cbaa9a4ff8f8e247ab6..951d91d9542eb2c69afccbd6c7b5547ef03d5136 100644 (file)
@@ -438,8 +438,8 @@ struct sr_scpi_dev_inst {
        const char *name;
        const char *prefix;
        int priv_size;
-       int (*dev_inst_new)(void *priv, const char *resource, char **params,
-               const char *serialcomm);
+       int (*dev_inst_new)(void *priv, struct drv_context *drvc,
+               const char *resource, char **params, const char *serialcomm);
        int (*open)(void *priv);
        int (*source_add)(void *priv, int events,
                int timeout, sr_receive_data_callback_t cb, void *cb_data);
@@ -453,8 +453,8 @@ struct sr_scpi_dev_inst {
        void *priv;
 };
 
-SR_PRIV struct sr_scpi_dev_inst *scpi_dev_inst_new(const char *resource,
-               const char *serialcomm);
+SR_PRIV struct sr_scpi_dev_inst *scpi_dev_inst_new(struct drv_context *drvc,
+               const char *resource, const char *serialcomm);
 SR_PRIV int sr_scpi_open(struct sr_scpi_dev_inst *scpi);
 SR_PRIV int sr_scpi_source_add(struct sr_scpi_dev_inst *scpi, int events,
                int timeout, sr_receive_data_callback_t cb, void *cb_data);