get_sr_device_instance() -> sr_get_device_instance().
This commit is contained in:
parent
a00ba01228
commit
d32d961d17
|
@ -78,7 +78,7 @@ static int hw_opendev(int device_index)
|
||||||
struct alsa *alsa;
|
struct alsa *alsa;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
alsa = sdi->priv;
|
alsa = sdi->priv;
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ static void hw_closedev(int device_index)
|
||||||
struct sr_device_instance *sdi;
|
struct sr_device_instance *sdi;
|
||||||
struct alsa *alsa;
|
struct alsa *alsa;
|
||||||
|
|
||||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
|
||||||
return;
|
return;
|
||||||
alsa = sdi->priv;
|
alsa = sdi->priv;
|
||||||
if (!alsa)
|
if (!alsa)
|
||||||
|
@ -128,7 +128,7 @@ static void hw_cleanup(void)
|
||||||
{
|
{
|
||||||
struct sr_device_instance *sdi;
|
struct sr_device_instance *sdi;
|
||||||
|
|
||||||
if (!(sdi = get_sr_device_instance(device_instances, 0)))
|
if (!(sdi = sr_get_device_instance(device_instances, 0)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
free(sdi->priv);
|
free(sdi->priv);
|
||||||
|
@ -141,7 +141,7 @@ static void *hw_get_device_info(int device_index, int device_info_id)
|
||||||
struct alsa *alsa;
|
struct alsa *alsa;
|
||||||
void *info = NULL;
|
void *info = NULL;
|
||||||
|
|
||||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
|
||||||
return NULL;
|
return NULL;
|
||||||
alsa = sdi->priv;
|
alsa = sdi->priv;
|
||||||
|
|
||||||
|
@ -181,7 +181,7 @@ static int hw_set_configuration(int device_index, int capability, void *value)
|
||||||
struct sr_device_instance *sdi;
|
struct sr_device_instance *sdi;
|
||||||
struct alsa *alsa;
|
struct alsa *alsa;
|
||||||
|
|
||||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
alsa = sdi->priv;
|
alsa = sdi->priv;
|
||||||
|
|
||||||
|
@ -266,7 +266,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
|
||||||
int count;
|
int count;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
alsa = sdi->priv;
|
alsa = sdi->priv;
|
||||||
|
|
||||||
|
|
|
@ -526,7 +526,7 @@ static int hw_opendev(int device_index)
|
||||||
struct sigma *sigma;
|
struct sigma *sigma;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
|
|
||||||
sigma = sdi->priv;
|
sigma = sdi->priv;
|
||||||
|
@ -669,7 +669,7 @@ static void hw_closedev(int device_index)
|
||||||
struct sr_device_instance *sdi;
|
struct sr_device_instance *sdi;
|
||||||
struct sigma *sigma;
|
struct sigma *sigma;
|
||||||
|
|
||||||
if ((sdi = get_sr_device_instance(device_instances, device_index)))
|
if ((sdi = sr_get_device_instance(device_instances, device_index)))
|
||||||
{
|
{
|
||||||
sigma = sdi->priv;
|
sigma = sdi->priv;
|
||||||
if (sdi->status == ST_ACTIVE)
|
if (sdi->status == ST_ACTIVE)
|
||||||
|
@ -701,7 +701,7 @@ static void *hw_get_device_info(int device_index, int device_info_id)
|
||||||
struct sigma *sigma;
|
struct sigma *sigma;
|
||||||
void *info = NULL;
|
void *info = NULL;
|
||||||
|
|
||||||
if (!(sdi = get_sr_device_instance(device_instances, device_index))) {
|
if (!(sdi = sr_get_device_instance(device_instances, device_index))) {
|
||||||
fprintf(stderr, "It's NULL.\n");
|
fprintf(stderr, "It's NULL.\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -733,7 +733,7 @@ static int hw_get_status(int device_index)
|
||||||
{
|
{
|
||||||
struct sr_device_instance *sdi;
|
struct sr_device_instance *sdi;
|
||||||
|
|
||||||
sdi = get_sr_device_instance(device_instances, device_index);
|
sdi = sr_get_device_instance(device_instances, device_index);
|
||||||
if (sdi)
|
if (sdi)
|
||||||
return sdi->status;
|
return sdi->status;
|
||||||
else
|
else
|
||||||
|
@ -751,7 +751,7 @@ static int hw_set_configuration(int device_index, int capability, void *value)
|
||||||
struct sigma *sigma;
|
struct sigma *sigma;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
|
|
||||||
sigma = sdi->priv;
|
sigma = sdi->priv;
|
||||||
|
@ -1211,7 +1211,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
|
||||||
|
|
||||||
session_device_id = session_device_id;
|
session_device_id = session_device_id;
|
||||||
|
|
||||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
|
|
||||||
sigma = sdi->priv;
|
sigma = sdi->priv;
|
||||||
|
@ -1320,7 +1320,7 @@ static void hw_stop_acquisition(int device_index, gpointer session_device_id)
|
||||||
struct sigma *sigma;
|
struct sigma *sigma;
|
||||||
uint8_t modestatus;
|
uint8_t modestatus;
|
||||||
|
|
||||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sigma = sdi->priv;
|
sigma = sdi->priv;
|
||||||
|
|
|
@ -132,7 +132,7 @@ static void *hw_get_device_info(int device_index, int device_info_id)
|
||||||
struct sr_device_instance *sdi;
|
struct sr_device_instance *sdi;
|
||||||
void *info = NULL;
|
void *info = NULL;
|
||||||
|
|
||||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
switch (device_info_id) {
|
switch (device_info_id) {
|
||||||
|
|
|
@ -481,7 +481,7 @@ static int hw_opendev(int device_index)
|
||||||
struct mso *mso;
|
struct mso *mso;
|
||||||
int ret = SR_ERR;
|
int ret = SR_ERR;
|
||||||
|
|
||||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
mso = sdi->priv;
|
mso = sdi->priv;
|
||||||
|
@ -519,7 +519,7 @@ static void hw_closedev(int device_index)
|
||||||
{
|
{
|
||||||
struct sr_device_instance *sdi;
|
struct sr_device_instance *sdi;
|
||||||
|
|
||||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (sdi->serial->fd != -1) {
|
if (sdi->serial->fd != -1) {
|
||||||
|
@ -535,7 +535,7 @@ static void *hw_get_device_info(int device_index, int device_info_id)
|
||||||
struct mso *mso;
|
struct mso *mso;
|
||||||
void *info = NULL;
|
void *info = NULL;
|
||||||
|
|
||||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
|
||||||
return NULL;
|
return NULL;
|
||||||
mso = sdi->priv;
|
mso = sdi->priv;
|
||||||
|
|
||||||
|
@ -563,7 +563,7 @@ static int hw_get_status(int device_index)
|
||||||
{
|
{
|
||||||
struct sr_device_instance *sdi;
|
struct sr_device_instance *sdi;
|
||||||
|
|
||||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
|
||||||
return ST_NOT_FOUND;
|
return ST_NOT_FOUND;
|
||||||
|
|
||||||
return sdi->status;
|
return sdi->status;
|
||||||
|
@ -578,7 +578,7 @@ static int hw_set_configuration(int device_index, int capability, void *value)
|
||||||
{
|
{
|
||||||
struct sr_device_instance *sdi;
|
struct sr_device_instance *sdi;
|
||||||
|
|
||||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
|
|
||||||
switch (capability) {
|
switch (capability) {
|
||||||
|
@ -672,7 +672,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
|
||||||
struct datafeed_header header;
|
struct datafeed_header header;
|
||||||
int ret = SR_ERR;
|
int ret = SR_ERR;
|
||||||
|
|
||||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
|
||||||
return ret;
|
return ret;
|
||||||
mso = sdi->priv;
|
mso = sdi->priv;
|
||||||
|
|
||||||
|
|
|
@ -328,7 +328,7 @@ static int hw_opendev(int device_index)
|
||||||
{
|
{
|
||||||
struct sr_device_instance *sdi;
|
struct sr_device_instance *sdi;
|
||||||
|
|
||||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
|
|
||||||
sdi->serial->fd = serial_open(sdi->serial->port, O_RDWR);
|
sdi->serial->fd = serial_open(sdi->serial->port, O_RDWR);
|
||||||
|
@ -344,7 +344,7 @@ static void hw_closedev(int device_index)
|
||||||
{
|
{
|
||||||
struct sr_device_instance *sdi;
|
struct sr_device_instance *sdi;
|
||||||
|
|
||||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (sdi->serial->fd != -1) {
|
if (sdi->serial->fd != -1) {
|
||||||
|
@ -375,7 +375,7 @@ static void *hw_get_device_info(int device_index, int device_info_id)
|
||||||
struct sr_device_instance *sdi;
|
struct sr_device_instance *sdi;
|
||||||
void *info;
|
void *info;
|
||||||
|
|
||||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
info = NULL;
|
info = NULL;
|
||||||
|
@ -404,7 +404,7 @@ static int hw_get_status(int device_index)
|
||||||
{
|
{
|
||||||
struct sr_device_instance *sdi;
|
struct sr_device_instance *sdi;
|
||||||
|
|
||||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
|
||||||
return ST_NOT_FOUND;
|
return ST_NOT_FOUND;
|
||||||
|
|
||||||
return sdi->status;
|
return sdi->status;
|
||||||
|
@ -447,7 +447,7 @@ static int hw_set_configuration(int device_index, int capability, void *value)
|
||||||
int ret;
|
int ret;
|
||||||
uint64_t *tmp_u64;
|
uint64_t *tmp_u64;
|
||||||
|
|
||||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
|
|
||||||
if (sdi->status != ST_ACTIVE)
|
if (sdi->status != ST_ACTIVE)
|
||||||
|
@ -658,7 +658,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
|
||||||
uint16_t readcount, delaycount;
|
uint16_t readcount, delaycount;
|
||||||
uint8_t changrp_mask;
|
uint8_t changrp_mask;
|
||||||
|
|
||||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
|
|
||||||
if (sdi->status != ST_ACTIVE)
|
if (sdi->status != ST_ACTIVE)
|
||||||
|
|
|
@ -173,7 +173,7 @@ struct sr_device_instance *sl_open_device(int device_index)
|
||||||
struct libusb_device_descriptor des;
|
struct libusb_device_descriptor des;
|
||||||
int err, skip, i;
|
int err, skip, i;
|
||||||
|
|
||||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
libusb_get_device_list(usb_context, &devlist);
|
libusb_get_device_list(usb_context, &devlist);
|
||||||
|
@ -398,7 +398,7 @@ static void hw_closedev(int device_index)
|
||||||
{
|
{
|
||||||
struct sr_device_instance *sdi;
|
struct sr_device_instance *sdi;
|
||||||
|
|
||||||
if ((sdi = get_sr_device_instance(device_instances, device_index)))
|
if ((sdi = sr_get_device_instance(device_instances, device_index)))
|
||||||
close_device(sdi);
|
close_device(sdi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -426,7 +426,7 @@ static void *hw_get_device_info(int device_index, int device_info_id)
|
||||||
struct sr_device_instance *sdi;
|
struct sr_device_instance *sdi;
|
||||||
void *info = NULL;
|
void *info = NULL;
|
||||||
|
|
||||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
switch (device_info_id) {
|
switch (device_info_id) {
|
||||||
|
@ -454,7 +454,7 @@ static int hw_get_status(int device_index)
|
||||||
{
|
{
|
||||||
struct sr_device_instance *sdi;
|
struct sr_device_instance *sdi;
|
||||||
|
|
||||||
sdi = get_sr_device_instance(device_instances, device_index);
|
sdi = sr_get_device_instance(device_instances, device_index);
|
||||||
if (sdi)
|
if (sdi)
|
||||||
return sdi->status;
|
return sdi->status;
|
||||||
else
|
else
|
||||||
|
@ -503,7 +503,7 @@ static int hw_set_configuration(int device_index, int capability, void *value)
|
||||||
int ret;
|
int ret;
|
||||||
uint64_t *tmp_u64;
|
uint64_t *tmp_u64;
|
||||||
|
|
||||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
|
|
||||||
if (capability == HWCAP_SAMPLERATE) {
|
if (capability == HWCAP_SAMPLERATE) {
|
||||||
|
@ -677,7 +677,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
|
||||||
int size, i;
|
int size, i;
|
||||||
unsigned char *buf;
|
unsigned char *buf;
|
||||||
|
|
||||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
|
|
||||||
packet = g_malloc(sizeof(struct datafeed_packet));
|
packet = g_malloc(sizeof(struct datafeed_packet));
|
||||||
|
|
|
@ -196,7 +196,7 @@ struct sr_device_instance *zp_open_device(int device_index)
|
||||||
struct libusb_device_descriptor des;
|
struct libusb_device_descriptor des;
|
||||||
int err, i;
|
int err, i;
|
||||||
|
|
||||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
libusb_get_device_list(usb_context, &devlist);
|
libusb_get_device_list(usb_context, &devlist);
|
||||||
|
@ -372,7 +372,7 @@ static void hw_closedev(int device_index)
|
||||||
{
|
{
|
||||||
struct sr_device_instance *sdi;
|
struct sr_device_instance *sdi;
|
||||||
|
|
||||||
if ((sdi = get_sr_device_instance(device_instances, device_index)))
|
if ((sdi = sr_get_device_instance(device_instances, device_index)))
|
||||||
close_device(sdi);
|
close_device(sdi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -400,7 +400,7 @@ static void *hw_get_device_info(int device_index, int device_info_id)
|
||||||
struct sr_device_instance *sdi;
|
struct sr_device_instance *sdi;
|
||||||
void *info = NULL;
|
void *info = NULL;
|
||||||
|
|
||||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
switch (device_info_id) {
|
switch (device_info_id) {
|
||||||
|
@ -428,7 +428,7 @@ static int hw_get_status(int device_index)
|
||||||
{
|
{
|
||||||
struct sr_device_instance *sdi;
|
struct sr_device_instance *sdi;
|
||||||
|
|
||||||
sdi = get_sr_device_instance(device_instances, device_index);
|
sdi = sr_get_device_instance(device_instances, device_index);
|
||||||
if (sdi)
|
if (sdi)
|
||||||
return sdi->status;
|
return sdi->status;
|
||||||
else
|
else
|
||||||
|
@ -461,7 +461,7 @@ static int hw_set_configuration(int device_index, int capability, void *value)
|
||||||
struct sr_device_instance *sdi;
|
struct sr_device_instance *sdi;
|
||||||
uint64_t *tmp_u64;
|
uint64_t *tmp_u64;
|
||||||
|
|
||||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
|
|
||||||
switch (capability) {
|
switch (capability) {
|
||||||
|
@ -488,7 +488,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
|
||||||
unsigned int packet_num;
|
unsigned int packet_num;
|
||||||
unsigned char *buf;
|
unsigned char *buf;
|
||||||
|
|
||||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
|
|
||||||
/* push configured settings to device */
|
/* push configured settings to device */
|
||||||
|
@ -553,7 +553,7 @@ static void hw_stop_acquisition(int device_index, gpointer session_device_id)
|
||||||
packet.type = DF_END;
|
packet.type = DF_END;
|
||||||
session_bus(session_device_id, &packet);
|
session_bus(session_device_id, &packet);
|
||||||
|
|
||||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
|
||||||
return; /* TODO: Cry? */
|
return; /* TODO: Cry? */
|
||||||
|
|
||||||
analyzer_reset(sdi->usb->devhdl);
|
analyzer_reset(sdi->usb->devhdl);
|
||||||
|
|
|
@ -119,8 +119,8 @@ struct sr_device_instance *sr_device_instance_new(int index, int status,
|
||||||
return sdi;
|
return sdi;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct sr_device_instance *get_sr_device_instance(
|
struct sr_device_instance *sr_get_device_instance(GSList *device_instances,
|
||||||
GSList *device_instances, int device_index)
|
int device_index)
|
||||||
{
|
{
|
||||||
struct sr_device_instance *sdi;
|
struct sr_device_instance *sdi;
|
||||||
GSList *l;
|
GSList *l;
|
||||||
|
|
|
@ -65,8 +65,8 @@ GSList *list_hwplugins(void);
|
||||||
/* Generic device instances */
|
/* Generic device instances */
|
||||||
struct sr_device_instance *sr_device_instance_new(int index,
|
struct sr_device_instance *sr_device_instance_new(int index,
|
||||||
int status, const char *vendor, const char *model, const char *version);
|
int status, const char *vendor, const char *model, const char *version);
|
||||||
struct sr_device_instance *get_sr_device_instance(
|
struct sr_device_instance *sr_get_device_instance(GSList *device_instances,
|
||||||
GSList *device_instances, int device_index);
|
int device_index);
|
||||||
void sr_device_instance_free(struct sr_device_instance *sdi);
|
void sr_device_instance_free(struct sr_device_instance *sdi);
|
||||||
|
|
||||||
/* USB-specific instances */
|
/* USB-specific instances */
|
||||||
|
|
Loading…
Reference in New Issue