return 0;
}
- sdi = sr_device_instance_new(0, SR_ST_ACTIVE, "alsa", NULL, NULL);
+ sdi = sr_dev_inst_new(0, SR_ST_ACTIVE, "alsa", NULL, NULL);
if (!sdi)
goto free_alsa;
struct alsa *alsa;
int err;
- if (!(sdi = sr_get_device_instance(device_instances, device_index)))
+ if (!(sdi = sr_get_dev_inst(device_instances, device_index)))
return SR_ERR;
alsa = sdi->priv;
struct sr_device_instance *sdi;
struct alsa *alsa;
- if (!(sdi = sr_get_device_instance(device_instances, device_index))) {
+ if (!(sdi = sr_get_dev_inst(device_instances, device_index))) {
sr_err("alsa: %s: sdi was NULL", __func__);
return SR_ERR; /* TODO: SR_ERR_ARG? */
}
{
struct sr_device_instance *sdi;
- if (!(sdi = sr_get_device_instance(device_instances, 0))) {
+ if (!(sdi = sr_get_dev_inst(device_instances, 0))) {
sr_err("alsa: %s: sdi was NULL", __func__);
return SR_ERR_BUG;
}
g_free(sdi->priv);
- sr_device_instance_free(sdi);
+ sr_dev_inst_free(sdi);
return SR_OK;
}
struct alsa *alsa;
void *info = NULL;
- if (!(sdi = sr_get_device_instance(device_instances, device_index)))
+ if (!(sdi = sr_get_dev_inst(device_instances, device_index)))
return NULL;
alsa = sdi->priv;
struct sr_device_instance *sdi;
struct alsa *alsa;
- if (!(sdi = sr_get_device_instance(device_instances, device_index)))
+ if (!(sdi = sr_get_dev_inst(device_instances, device_index)))
return SR_ERR;
alsa = sdi->priv;
int count;
int err;
- if (!(sdi = sr_get_device_instance(device_instances, device_index)))
+ if (!(sdi = sr_get_dev_inst(device_instances, device_index)))
return SR_ERR;
alsa = sdi->priv;
sigma->use_triggers = 0;
/* Register SIGMA device. */
- sdi = sr_device_instance_new(0, SR_ST_INITIALIZING,
+ sdi = sr_dev_inst_new(0, SR_ST_INITIALIZING,
USB_VENDOR_NAME, USB_MODEL_NAME, USB_MODEL_VERSION);
if (!sdi)
goto free;
struct sigma *sigma;
int ret;
- if (!(sdi = sr_get_device_instance(device_instances, device_index)))
+ if (!(sdi = sr_get_dev_inst(device_instances, device_index)))
return SR_ERR;
sigma = sdi->priv;
struct sr_device_instance *sdi;
struct sigma *sigma;
- if (!(sdi = sr_get_device_instance(device_instances, device_index))) {
+ if (!(sdi = sr_get_dev_inst(device_instances, device_index))) {
sr_err("sigma: %s: sdi was NULL", __func__);
return SR_ERR; /* TODO: SR_ERR_ARG? */
}
continue;
}
g_free(sdi->priv);
- sr_device_instance_free(sdi);
+ sr_dev_inst_free(sdi);
}
g_slist_free(device_instances);
device_instances = NULL;
struct sigma *sigma;
void *info = NULL;
- if (!(sdi = sr_get_device_instance(device_instances, device_index))) {
+ if (!(sdi = sr_get_dev_inst(device_instances, device_index))) {
sr_err("It's NULL.\n");
return NULL;
}
{
struct sr_device_instance *sdi;
- sdi = sr_get_device_instance(device_instances, device_index);
+ sdi = sr_get_dev_inst(device_instances, device_index);
if (sdi)
return sdi->status;
else
struct sigma *sigma;
int ret;
- if (!(sdi = sr_get_device_instance(device_instances, device_index)))
+ if (!(sdi = sr_get_dev_inst(device_instances, device_index)))
return SR_ERR;
sigma = sdi->priv;
/* Avoid compiler warnings. */
(void)session_data;
- if (!(sdi = sr_get_device_instance(device_instances, device_index)))
+ if (!(sdi = sr_get_dev_inst(device_instances, device_index)))
return SR_ERR;
sigma = sdi->priv;
/* Avoid compiler warnings. */
(void)session_data;
- if (!(sdi = sr_get_device_instance(device_instances, device_index))) {
+ if (!(sdi = sr_get_dev_inst(device_instances, device_index))) {
sr_err("asix: %s: sdi was NULL", __func__);
return SR_ERR_BUG;
}
sr_dbg("la8: found device");
/* Register the device with libsigrok. */
- sdi = sr_device_instance_new(0, SR_ST_INITIALIZING,
+ sdi = sr_dev_inst_new(0, SR_ST_INITIALIZING,
USB_VENDOR_NAME, USB_MODEL_NAME, USB_MODEL_VERSION);
if (!sdi) {
sr_err("la8: %s: sr_device_instance_new failed", __func__);
struct sr_device_instance *sdi;
struct la8 *la8;
- if (!(sdi = sr_get_device_instance(device_instances, device_index))) {
+ if (!(sdi = sr_get_dev_inst(device_instances, device_index))) {
sr_err("la8: %s: sdi was NULL", __func__);
return SR_ERR; /* TODO: SR_ERR_ARG? */
}
struct sr_device_instance *sdi;
struct la8 *la8;
- if (!(sdi = sr_get_device_instance(device_instances, device_index))) {
+ if (!(sdi = sr_get_dev_inst(device_instances, device_index))) {
sr_err("la8: %s: sdi was NULL", __func__);
return SR_ERR; /* TODO: SR_ERR_ARG? */
}
sr_err("la8: %s: sdi->priv was NULL, nothing "
"to do", __func__);
#endif
- sr_device_instance_free(sdi); /* Returns void. */
+ sr_dev_inst_free(sdi); /* Returns void. */
}
g_slist_free(device_instances); /* Returns void. */
device_instances = NULL;
sr_spew("la8: entering %s", __func__);
- if (!(sdi = sr_get_device_instance(device_instances, device_index))) {
+ if (!(sdi = sr_get_dev_inst(device_instances, device_index))) {
sr_err("la8: %s: sdi was NULL", __func__);
return NULL;
}
{
struct sr_device_instance *sdi;
- if (!(sdi = sr_get_device_instance(device_instances, device_index))) {
+ if (!(sdi = sr_get_dev_inst(device_instances, device_index))) {
sr_err("la8: %s: sdi was NULL, device not found", __func__);
return SR_ST_NOT_FOUND;
}
sr_spew("la8: entering %s", __func__);
- if (!(sdi = sr_get_device_instance(device_instances, device_index))) {
+ if (!(sdi = sr_get_dev_inst(device_instances, device_index))) {
sr_err("la8: %s: sdi was NULL", __func__);
return SR_ERR; /* TODO: SR_ERR_ARG? */
}
sr_spew("la8: entering %s", __func__);
- if (!(sdi = sr_get_device_instance(device_instances, device_index))) {
+ if (!(sdi = sr_get_dev_inst(device_instances, device_index))) {
sr_err("la8: %s: sdi was NULL", __func__);
return SR_ERR; /* TODO: SR_ERR_ARG? */
}
sr_dbg("la8: stopping acquisition");
- if (!(sdi = sr_get_device_instance(device_instances, device_index))) {
+ if (!(sdi = sr_get_dev_inst(device_instances, device_index))) {
sr_err("la8: %s: sdi was NULL", __func__);
return SR_ERR_BUG;
}
/* Avoid compiler warnings. */
(void)deviceinfo;
- sdi = sr_device_instance_new(0, SR_ST_ACTIVE, DEMONAME, NULL, NULL);
+ sdi = sr_dev_inst_new(0, SR_ST_ACTIVE, DEMONAME, NULL, NULL);
if (!sdi) {
sr_err("demo: %s: sr_device_instance_new failed", __func__);
return 0;
struct sr_device_instance *sdi;
void *info = NULL;
- if (!(sdi = sr_get_device_instance(device_instances, device_index))) {
+ if (!(sdi = sr_get_dev_inst(device_instances, device_index))) {
sr_err("demo: %s: sdi was NULL", __func__);
return NULL;
}
mso->protocol_trigger.spimode = 0;
}
- sdi = sr_device_instance_new(devcnt, SR_ST_INITIALIZING,
+ sdi = sr_dev_inst_new(devcnt, SR_ST_INITIALIZING,
manufacturer, product, hwrev);
if (!sdi) {
sr_err("Unable to create device instance for %s",
/* save a pointer to our private instance data */
sdi->priv = mso;
- sdi->serial = sr_serial_device_instance_new(path, -1);
+ sdi->serial = sr_serial_dev_inst_new(path, -1);
if (!sdi->serial)
goto err_device_instance_free;
continue;
err_device_instance_free:
- sr_device_instance_free(sdi);
+ sr_dev_inst_free(sdi);
err_free_mso:
g_free(mso);
}
serial_close(sdi->serial->fd);
g_free(sdi->priv);
sdi->priv = NULL;
- sr_device_instance_free(sdi);
+ sr_dev_inst_free(sdi);
}
g_slist_free(device_instances);
device_instances = NULL;
struct mso *mso;
int ret = SR_ERR;
- if (!(sdi = sr_get_device_instance(device_instances, device_index)))
+ if (!(sdi = sr_get_dev_inst(device_instances, device_index)))
return ret;
mso = sdi->priv;
{
struct sr_device_instance *sdi;
- if (!(sdi = sr_get_device_instance(device_instances, device_index))) {
+ if (!(sdi = sr_get_dev_inst(device_instances, device_index))) {
sr_err("mso19: %s: sdi was NULL", __func__);
return SR_ERR; /* TODO: SR_ERR_ARG? */
}
struct mso *mso;
void *info = NULL;
- if (!(sdi = sr_get_device_instance(device_instances, device_index)))
+ if (!(sdi = sr_get_dev_inst(device_instances, device_index)))
return NULL;
mso = sdi->priv;
{
struct sr_device_instance *sdi;
- if (!(sdi = sr_get_device_instance(device_instances, device_index)))
+ if (!(sdi = sr_get_dev_inst(device_instances, device_index)))
return SR_ST_NOT_FOUND;
return sdi->status;
{
struct sr_device_instance *sdi;
- if (!(sdi = sr_get_device_instance(device_instances, device_index)))
+ if (!(sdi = sr_get_dev_inst(device_instances, device_index)))
return SR_ERR;
switch (capability) {
struct sr_datafeed_header header;
int ret = SR_ERR;
- if (!(sdi = sr_get_device_instance(device_instances, device_index)))
+ if (!(sdi = sr_get_dev_inst(device_instances, device_index)))
return ret;
mso = sdi->priv;
GString *tmp_str, *devicename, *version;
gchar tmp_c;
- sdi = sr_device_instance_new(0, SR_ST_INACTIVE, NULL, NULL, NULL);
+ sdi = sr_dev_inst_new(0, SR_ST_INACTIVE, NULL, NULL, NULL);
ols = ols_device_new();
sdi->priv = ols;
sdi->index = final_devcnt;
} else {
/* not an OLS -- some other board that uses the sump protocol */
- sdi = sr_device_instance_new(final_devcnt, SR_ST_INACTIVE,
+ sdi = sr_dev_inst_new(final_devcnt, SR_ST_INACTIVE,
"Sump", "Logic Analyzer", "v1.0");
ols = ols_device_new();
ols->num_probes = 32;
sdi->priv = ols;
}
- ols->serial = sr_serial_device_instance_new(device_names[i], -1);
+ ols->serial = sr_serial_dev_inst_new(device_names[i], -1);
device_instances = g_slist_append(device_instances, sdi);
final_devcnt++;
serial_close(fds[i].fd);
struct sr_device_instance *sdi;
struct ols_device *ols;
- if (!(sdi = sr_get_device_instance(device_instances, device_index)))
+ if (!(sdi = sr_get_dev_inst(device_instances, device_index)))
return SR_ERR;
ols = sdi->priv;
struct sr_device_instance *sdi;
struct ols_device *ols;
- if (!(sdi = sr_get_device_instance(device_instances, device_index))) {
+ if (!(sdi = sr_get_dev_inst(device_instances, device_index))) {
sr_err("ols: %s: sdi was NULL", __func__);
return SR_ERR; /* TODO: SR_ERR_ARG? */
}
/* TODO: Check for serial != NULL. */
if (ols->serial->fd != -1)
serial_close(ols->serial->fd);
- sr_serial_device_instance_free(ols->serial);
- sr_device_instance_free(sdi);
+ sr_serial_dev_inst_free(ols->serial);
+ sr_dev_inst_free(sdi);
}
g_slist_free(device_instances);
device_instances = NULL;
struct ols_device *ols;
void *info;
- if (!(sdi = sr_get_device_instance(device_instances, device_index)))
+ if (!(sdi = sr_get_dev_inst(device_instances, device_index)))
return NULL;
ols = sdi->priv;
{
struct sr_device_instance *sdi;
- if (!(sdi = sr_get_device_instance(device_instances, device_index)))
+ if (!(sdi = sr_get_dev_inst(device_instances, device_index)))
return SR_ST_NOT_FOUND;
return sdi->status;
int ret;
uint64_t *tmp_u64;
- if (!(sdi = sr_get_device_instance(device_instances, device_index)))
+ if (!(sdi = sr_get_dev_inst(device_instances, device_index)))
return SR_ERR;
ols = sdi->priv;
int num_channels;
int i;
- if (!(sdi = sr_get_device_instance(device_instances, device_index)))
+ if (!(sdi = sr_get_dev_inst(device_instances, device_index)))
return SR_ERR;
ols = sdi->priv;
struct fx2_device *fx2;
int err, skip, i;
- if (!(sdi = sr_get_device_instance(device_instances, device_index)))
+ if (!(sdi = sr_get_dev_inst(device_instances, device_index)))
return SR_ERR;
fx2 = sdi->priv;
/* not a supported VID/PID */
continue;
- sdi = sr_device_instance_new(devcnt, SR_ST_INITIALIZING,
+ sdi = sr_dev_inst_new(devcnt, SR_ST_INITIALIZING,
fx2_prof->vendor, fx2_prof->model, fx2_prof->model_version);
if (!sdi)
return 0;
sr_dbg("Found a Saleae Logic with %s firmware.",
new_saleae_logic_firmware ? "new" : "old");
sdi->status = SR_ST_INACTIVE;
- fx2->usb = sr_usb_device_instance_new
+ fx2->usb = sr_usb_dev_inst_new
(libusb_get_bus_number(devlist[i]),
libusb_get_device_address(devlist[i]), NULL);
} else {
g_get_current_time(&fx2->fw_updated);
else
sr_err("firmware upload failed for device %d", devcnt);
- fx2->usb = sr_usb_device_instance_new
+ fx2->usb = sr_usb_dev_inst_new
(libusb_get_bus_number(devlist[i]), 0xff, NULL);
}
devcnt++;
struct fx2_device *fx2;
int timediff, err;
- if (!(sdi = sr_get_device_instance(device_instances, device_index)))
+ if (!(sdi = sr_get_dev_inst(device_instances, device_index)))
return SR_ERR;
fx2 = sdi->priv;
{
struct sr_device_instance *sdi;
- if (!(sdi = sr_get_device_instance(device_instances, device_index))) {
+ if (!(sdi = sr_get_dev_inst(device_instances, device_index))) {
sr_err("logic: %s: sdi was NULL", __func__);
return SR_ERR; /* TODO: SR_ERR_ARG? */
}
continue;
}
close_device(sdi);
- sr_usb_device_instance_free(fx2->usb);
- sr_device_instance_free(sdi);
+ sr_usb_dev_inst_free(fx2->usb);
+ sr_dev_inst_free(sdi);
}
g_slist_free(device_instances);
struct fx2_device *fx2;
void *info = NULL;
- if (!(sdi = sr_get_device_instance(device_instances, device_index)))
+ if (!(sdi = sr_get_dev_inst(device_instances, device_index)))
return NULL;
fx2 = sdi->priv;
{
struct sr_device_instance *sdi;
- sdi = sr_get_device_instance(device_instances, device_index);
+ sdi = sr_get_dev_inst(device_instances, device_index);
if (sdi)
return sdi->status;
else
int ret;
uint64_t *tmp_u64;
- if (!(sdi = sr_get_device_instance(device_instances, device_index)))
+ if (!(sdi = sr_get_dev_inst(device_instances, device_index)))
return SR_ERR;
fx2 = sdi->priv;
int size, i;
unsigned char *buf;
- if (!(sdi = sr_get_device_instance(device_instances, device_index)))
+ if (!(sdi = sr_get_dev_inst(device_instances, device_index)))
return SR_ERR;
fx2 = sdi->priv;
fx2->session_data = session_data;
struct libusb_device_descriptor des;
int err, i;
- if (!(sdi = sr_get_device_instance(device_instances, device_index)))
+ if (!(sdi = sr_get_dev_inst(device_instances, device_index)))
return NULL;
libusb_get_device_list(usb_context, &devlist);
* the zeroplus range?
*/
/* Register the device with libsigrok. */
- sdi = sr_device_instance_new(devcnt,
+ sdi = sr_dev_inst_new(devcnt,
SR_ST_INACTIVE, USB_VENDOR_NAME,
USB_MODEL_NAME, USB_MODEL_VERSION);
if (!sdi) {
device_instances =
g_slist_append(device_instances, sdi);
- zp->usb = sr_usb_device_instance_new(
+ zp->usb = sr_usb_dev_inst_new(
libusb_get_bus_number(devlist[i]),
libusb_get_device_address(devlist[i]), NULL);
devcnt++;
{
struct sr_device_instance *sdi;
- if (!(sdi = sr_get_device_instance(device_instances, device_index))) {
+ if (!(sdi = sr_get_dev_inst(device_instances, device_index))) {
sr_err("zp: %s: sdi was NULL", __func__);
return SR_ERR; /* TODO: SR_ERR_ARG? */
}
struct zp *zp;
void *info;
- if (!(sdi = sr_get_device_instance(device_instances, device_index))) {
+ if (!(sdi = sr_get_dev_inst(device_instances, device_index))) {
sr_err("zp: %s: sdi was NULL", __func__);
return NULL;
}
{
struct sr_device_instance *sdi;
- sdi = sr_get_device_instance(device_instances, device_index);
+ sdi = sr_get_dev_inst(device_instances, device_index);
if (sdi)
return sdi->status;
else
uint64_t *tmp_u64;
struct zp *zp;
- if (!(sdi = sr_get_device_instance(device_instances, device_index))) {
+ if (!(sdi = sr_get_dev_inst(device_instances, device_index))) {
sr_err("zp: %s: sdi was NULL", __func__);
return SR_ERR;
}
unsigned char *buf;
struct zp *zp;
- if (!(sdi = sr_get_device_instance(device_instances, device_index))) {
+ if (!(sdi = sr_get_dev_inst(device_instances, device_index))) {
sr_err("zp: %s: sdi was NULL", __func__);
return SR_ERR;
}
packet.type = SR_DF_END;
sr_session_bus(session_device_id, &packet);
- if (!(sdi = sr_get_device_instance(device_instances, device_index))) {
+ if (!(sdi = sr_get_dev_inst(device_instances, device_index))) {
sr_err("zp: %s: sdi was NULL", __func__);
return SR_ERR_BUG;
}
}
}
-SR_PRIV struct sr_device_instance *sr_device_instance_new(int index, int status,
+SR_PRIV struct sr_device_instance *sr_dev_inst_new(int index, int status,
const char *vendor, const char *model, const char *version)
{
struct sr_device_instance *sdi;
return sdi;
}
-SR_PRIV struct sr_device_instance *sr_get_device_instance(
+SR_PRIV struct sr_device_instance *sr_get_dev_inst(
GSList *device_instances, int device_index)
{
struct sr_device_instance *sdi;
return NULL;
}
-SR_PRIV void sr_device_instance_free(struct sr_device_instance *sdi)
+SR_PRIV void sr_dev_inst_free(struct sr_device_instance *sdi)
{
g_free(sdi->priv);
g_free(sdi->vendor);
#ifdef HAVE_LIBUSB_1_0
-SR_PRIV struct sr_usb_device_instance *sr_usb_device_instance_new(uint8_t bus,
+SR_PRIV struct sr_usb_device_instance *sr_usb_dev_inst_new(uint8_t bus,
uint8_t address, struct libusb_device_handle *hdl)
{
struct sr_usb_device_instance *udi;
return udi;
}
-SR_PRIV void sr_usb_device_instance_free(struct sr_usb_device_instance *usb)
+SR_PRIV void sr_usb_dev_inst_free(struct sr_usb_device_instance *usb)
{
/* Avoid compiler warnings. */
(void)usb;
#endif
-SR_PRIV struct sr_serial_device_instance *sr_serial_device_instance_new(
+SR_PRIV struct sr_serial_device_instance *sr_serial_dev_inst_new(
const char *port, int fd)
{
struct sr_serial_device_instance *serial;
return serial;
}
-SR_PRIV void sr_serial_device_instance_free(
+SR_PRIV void sr_serial_dev_inst_free(
struct sr_serial_device_instance *serial)
{
g_free(serial->port);
* returned by a plugin's get_capabilities() function.
* @param hwcap The capability to find in the list.
*
- * @return Returns TRUE if found, FALSE otherwise.
+ * @return TRUE if found, FALSE otherwise.
*/
SR_API gboolean sr_has_hwcap(int *capabilities, int hwcap)
{
*
* @param hwcap The capability to find
*
- * @return Returns a struct with information about the parameter, or NULL
+ * @return A struct with information about the parameter, or NULL
* if not found.
*/
SR_API struct sr_hwcap_option *sr_find_hwcap_option(int hwcap)
/* TODO: Sanity checks on device_index. */
- if (!(sdi = sr_get_device_instance(device_instances, device_index))) {
+ if (!(sdi = sr_get_dev_inst(device_instances, device_index))) {
sr_err("session driver: %s: device instance with device "
"index %d was not found", __func__, device_index);
return NULL;
/* TODO: Error handling. */
for (l = device_instances; l; l = l->next)
- sr_device_instance_free(l->data);
+ sr_dev_inst_free(l->data);
g_slist_free(device_instances);
device_instances = NULL;
{
struct sr_device_instance *sdi;
- sdi = sr_device_instance_new(device_index, SR_ST_INITIALIZING,
+ sdi = sr_dev_inst_new(device_index, SR_ST_INITIALIZING,
NULL, NULL, NULL);
if (!sdi)
return SR_ERR;
#ifdef HAVE_LIBUSB_1_0
/* USB-specific instances */
-SR_PRIV struct sr_usb_device_instance *sr_usb_device_instance_new(uint8_t bus,
+SR_PRIV struct sr_usb_device_instance *sr_usb_dev_inst_new(uint8_t bus,
uint8_t address, struct libusb_device_handle *hdl);
-SR_PRIV void sr_usb_device_instance_free(struct sr_usb_device_instance *usb);
+SR_PRIV void sr_usb_dev_inst_free(struct sr_usb_device_instance *usb);
#endif
/* Serial-specific instances */
-SR_PRIV struct sr_serial_device_instance *sr_serial_device_instance_new(
+SR_PRIV struct sr_serial_device_instance *sr_serial_dev_inst_new(
const char *port, int fd);
-SR_PRIV void sr_serial_device_instance_free(
+SR_PRIV void sr_serial_dev_inst_free(
struct sr_serial_device_instance *serial);
/*--- log.c -----------------------------------------------------------------*/
struct sr_datafeed_packet *packet);
/* Generic device instances */
-SR_PRIV struct sr_device_instance *sr_device_instance_new(int index,
+SR_PRIV struct sr_device_instance *sr_dev_inst_new(int index,
int status, const char *vendor, const char *model, const char *version);
-SR_PRIV struct sr_device_instance *sr_get_device_instance(
+SR_PRIV struct sr_device_instance *sr_get_dev_inst(
GSList *device_instances, int device_index);
-SR_PRIV void sr_device_instance_free(struct sr_device_instance *sdi);
+SR_PRIV void sr_dev_inst_free(struct sr_device_instance *sdi);
SR_PRIV void sr_source_remove(int fd);
SR_PRIV void sr_source_add(int fd, int events, int timeout,