GSList *(*scan)(struct drv_context *drvc);
int (*dev_inst_new)(void *priv, struct drv_context *drvc,
const char *resource, char **params, const char *serialcomm);
- int (*open)(void *priv);
+ int (*open)(struct sr_scpi_dev_inst *scpi);
int (*source_add)(struct sr_session *session, void *priv, int events,
int timeout, sr_receive_data_callback cb, void *cb_data);
int (*source_remove)(struct sr_session *session, void *priv);
int (*read_begin)(void *priv);
int (*read_data)(void *priv, char *buf, int maxlen);
int (*read_complete)(void *priv);
- int (*close)(void *priv);
+ int (*close)(struct sr_scpi_dev_inst *scpi);
void (*free)(void *priv);
unsigned int read_timeout_ms;
void *priv;
*/
SR_PRIV int sr_scpi_open(struct sr_scpi_dev_inst *scpi)
{
- return scpi->open(scpi->priv);
+ return scpi->open(scpi);
}
/**
*/
SR_PRIV int sr_scpi_close(struct sr_scpi_dev_inst *scpi)
{
- return scpi->close(scpi->priv);
+ return scpi->close(scpi);
}
/**
return SR_OK;
}
-static int scpi_gpib_open(void *priv)
+static int scpi_gpib_open(struct sr_scpi_dev_inst *scpi)
{
- struct scpi_gpib *gscpi = priv;
+ struct scpi_gpib *gscpi = scpi->priv;
if ((gscpi->descriptor = ibfind(gscpi->name)) < 0)
return SR_ERR;
return gscpi->read_started && (ibsta & END);
}
-static int scpi_gpib_close(void *priv)
+static int scpi_gpib_close(struct sr_scpi_dev_inst *scpi)
{
- struct scpi_gpib *gscpi = priv;
+ struct scpi_gpib *gscpi = scpi->priv;
ibonl(gscpi->descriptor, 0);
return SR_OK;
}
-static int scpi_serial_open(void *priv)
+static int scpi_serial_open(struct sr_scpi_dev_inst *scpi)
{
- struct scpi_serial *sscpi = priv;
+ struct scpi_serial *sscpi = scpi->priv;
struct sr_serial_dev_inst *serial = sscpi->serial;
if (serial_open(serial, SERIAL_RDWR) != SR_OK)
}
}
-static int scpi_serial_close(void *priv)
+static int scpi_serial_close(struct sr_scpi_dev_inst *scpi)
{
- struct scpi_serial *sscpi = priv;
+ struct scpi_serial *sscpi = scpi->priv;
return serial_close(sscpi->serial);
}
return SR_OK;
}
-static int scpi_tcp_open(void *priv)
+static int scpi_tcp_open(struct sr_scpi_dev_inst *scpi)
{
- struct scpi_tcp *tcp = priv;
+ struct scpi_tcp *tcp = scpi->priv;
struct addrinfo hints;
struct addrinfo *results, *res;
int err;
tcp->response_bytes_read >= tcp->response_length);
}
-static int scpi_tcp_close(void *priv)
+static int scpi_tcp_close(struct sr_scpi_dev_inst *scpi)
{
- struct scpi_tcp *tcp = priv;
+ struct scpi_tcp *tcp = scpi->priv;
if (close(tcp->socket) < 0)
return SR_ERR;
return;
}
-static int scpi_usbtmc_libusb_open(void *priv)
+static int scpi_usbtmc_libusb_open(struct sr_scpi_dev_inst *scpi)
{
- struct scpi_usbtmc_libusb *uscpi = priv;
+ struct scpi_usbtmc_libusb *uscpi = scpi->priv;
struct sr_usb_dev_inst *usb = uscpi->usb;
struct libusb_device *dev;
struct libusb_device_descriptor des;
uscpi->bulkin_attributes & EOM;
}
-static int scpi_usbtmc_libusb_close(void *priv)
+static int scpi_usbtmc_libusb_close(struct sr_scpi_dev_inst *scpi)
{
- int ret;
- struct scpi_usbtmc_libusb *uscpi = priv;
+ struct scpi_usbtmc_libusb *uscpi = scpi->priv;
struct sr_usb_dev_inst *usb = uscpi->usb;
+ int ret;
if (!usb->devhdl)
return SR_ERR;
return SR_OK;
}
-static int scpi_visa_open(void *priv)
+static int scpi_visa_open(struct sr_scpi_dev_inst *scpi)
{
- struct scpi_visa *vscpi = priv;
+ struct scpi_visa *vscpi = scpi->priv;
if (viOpenDefaultRM(&vscpi->rmgr) != VI_SUCCESS) {
sr_err("Cannot open default resource manager.");
return !(status & 16);
}
-static int scpi_visa_close(void *priv)
+static int scpi_visa_close(struct sr_scpi_dev_inst *scpi)
{
- struct scpi_visa *vscpi = priv;
+ struct scpi_visa *vscpi = scpi->priv;
viClose(vscpi->vi);
viClose(vscpi->rmgr);
return SR_OK;
}
-static int scpi_vxi_open(void *priv)
+static int scpi_vxi_open(struct sr_scpi_dev_inst *scpi)
{
- struct scpi_vxi *vxi = priv;
+ struct scpi_vxi *vxi = scpi->priv;
Create_LinkParms link_parms;
Create_LinkResp *link_resp;
return vxi->read_complete;
}
-static int scpi_vxi_close(void *priv)
+static int scpi_vxi_close(struct sr_scpi_dev_inst *scpi)
{
- struct scpi_vxi *vxi = priv;
+ struct scpi_vxi *vxi = scpi->priv;
Device_Error *dev_error;
if (!vxi->client)