From: Uwe Hermann Date: Sat, 29 Jan 2011 15:57:35 +0000 (+0100) Subject: get_sr_device_instance() -> sr_get_device_instance(). X-Git-Tag: libsigrok-0.1.0~368 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=d32d961d17e3c7f409912062e5c336c19b6ef270;p=libsigrok.git get_sr_device_instance() -> sr_get_device_instance(). --- diff --git a/hardware/alsa/alsa.c b/hardware/alsa/alsa.c index 4ee20369..8181f7dd 100644 --- a/hardware/alsa/alsa.c +++ b/hardware/alsa/alsa.c @@ -78,7 +78,7 @@ static int hw_opendev(int device_index) struct alsa *alsa; 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; alsa = sdi->priv; @@ -112,7 +112,7 @@ static void hw_closedev(int device_index) struct sr_device_instance *sdi; struct alsa *alsa; - if (!(sdi = get_sr_device_instance(device_instances, device_index))) + if (!(sdi = sr_get_device_instance(device_instances, device_index))) return; alsa = sdi->priv; if (!alsa) @@ -128,7 +128,7 @@ static void hw_cleanup(void) { struct sr_device_instance *sdi; - if (!(sdi = get_sr_device_instance(device_instances, 0))) + if (!(sdi = sr_get_device_instance(device_instances, 0))) return; free(sdi->priv); @@ -141,7 +141,7 @@ static void *hw_get_device_info(int device_index, int device_info_id) struct alsa *alsa; 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; 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 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; alsa = sdi->priv; @@ -266,7 +266,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id) int count; 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; alsa = sdi->priv; diff --git a/hardware/asix-sigma/asix-sigma.c b/hardware/asix-sigma/asix-sigma.c index 1162b63c..68bfd8f8 100644 --- a/hardware/asix-sigma/asix-sigma.c +++ b/hardware/asix-sigma/asix-sigma.c @@ -526,7 +526,7 @@ static int hw_opendev(int device_index) struct sigma *sigma; 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; sigma = sdi->priv; @@ -669,7 +669,7 @@ static void hw_closedev(int device_index) struct sr_device_instance *sdi; 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; 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; 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"); return NULL; } @@ -733,7 +733,7 @@ static int hw_get_status(int device_index) { 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) return sdi->status; else @@ -751,7 +751,7 @@ static int hw_set_configuration(int device_index, int capability, void *value) struct sigma *sigma; 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; 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; - if (!(sdi = get_sr_device_instance(device_instances, device_index))) + if (!(sdi = sr_get_device_instance(device_instances, device_index))) return SR_ERR; sigma = sdi->priv; @@ -1320,7 +1320,7 @@ static void hw_stop_acquisition(int device_index, gpointer session_device_id) struct sigma *sigma; uint8_t modestatus; - if (!(sdi = get_sr_device_instance(device_instances, device_index))) + if (!(sdi = sr_get_device_instance(device_instances, device_index))) return; sigma = sdi->priv; diff --git a/hardware/demo/demo.c b/hardware/demo/demo.c index 5ab3969e..348fd704 100644 --- a/hardware/demo/demo.c +++ b/hardware/demo/demo.c @@ -132,7 +132,7 @@ static void *hw_get_device_info(int device_index, int device_info_id) struct sr_device_instance *sdi; 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; switch (device_info_id) { diff --git a/hardware/link-mso19/link-mso19.c b/hardware/link-mso19/link-mso19.c index 9f2b46a2..392399d3 100644 --- a/hardware/link-mso19/link-mso19.c +++ b/hardware/link-mso19/link-mso19.c @@ -481,7 +481,7 @@ static int hw_opendev(int device_index) struct mso *mso; 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; mso = sdi->priv; @@ -519,7 +519,7 @@ static void hw_closedev(int device_index) { 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; 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; 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; mso = sdi->priv; @@ -563,7 +563,7 @@ static int hw_get_status(int device_index) { 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 sdi->status; @@ -578,7 +578,7 @@ static int hw_set_configuration(int device_index, int capability, void *value) { 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; switch (capability) { @@ -672,7 +672,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id) struct datafeed_header header; 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; mso = sdi->priv; diff --git a/hardware/openbench-logic-sniffer/ols.c b/hardware/openbench-logic-sniffer/ols.c index 7d80b62e..d5eb8ac9 100644 --- a/hardware/openbench-logic-sniffer/ols.c +++ b/hardware/openbench-logic-sniffer/ols.c @@ -328,7 +328,7 @@ static int hw_opendev(int device_index) { 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; 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; - if (!(sdi = get_sr_device_instance(device_instances, device_index))) + if (!(sdi = sr_get_device_instance(device_instances, device_index))) return; 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; void *info; - if (!(sdi = get_sr_device_instance(device_instances, device_index))) + if (!(sdi = sr_get_device_instance(device_instances, device_index))) return NULL; info = NULL; @@ -404,7 +404,7 @@ static int hw_get_status(int device_index) { 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 sdi->status; @@ -447,7 +447,7 @@ static int hw_set_configuration(int device_index, int capability, void *value) int ret; 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; 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; 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; if (sdi->status != ST_ACTIVE) diff --git a/hardware/saleae-logic/saleae-logic.c b/hardware/saleae-logic/saleae-logic.c index dfc07f9b..3ddb4ccf 100644 --- a/hardware/saleae-logic/saleae-logic.c +++ b/hardware/saleae-logic/saleae-logic.c @@ -173,7 +173,7 @@ struct sr_device_instance *sl_open_device(int device_index) struct libusb_device_descriptor des; 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; libusb_get_device_list(usb_context, &devlist); @@ -398,7 +398,7 @@ static void hw_closedev(int device_index) { 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); } @@ -426,7 +426,7 @@ static void *hw_get_device_info(int device_index, int device_info_id) struct sr_device_instance *sdi; 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; switch (device_info_id) { @@ -454,7 +454,7 @@ static int hw_get_status(int device_index) { 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) return sdi->status; else @@ -503,7 +503,7 @@ static int hw_set_configuration(int device_index, int capability, void *value) int ret; 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; if (capability == HWCAP_SAMPLERATE) { @@ -677,7 +677,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id) int size, i; 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; packet = g_malloc(sizeof(struct datafeed_packet)); diff --git a/hardware/zeroplus-logic-cube/zeroplus.c b/hardware/zeroplus-logic-cube/zeroplus.c index ab48aa55..b6916db1 100644 --- a/hardware/zeroplus-logic-cube/zeroplus.c +++ b/hardware/zeroplus-logic-cube/zeroplus.c @@ -196,7 +196,7 @@ struct sr_device_instance *zp_open_device(int device_index) struct libusb_device_descriptor des; 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; libusb_get_device_list(usb_context, &devlist); @@ -372,7 +372,7 @@ static void hw_closedev(int device_index) { 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); } @@ -400,7 +400,7 @@ static void *hw_get_device_info(int device_index, int device_info_id) struct sr_device_instance *sdi; 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; switch (device_info_id) { @@ -428,7 +428,7 @@ static int hw_get_status(int device_index) { 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) return sdi->status; else @@ -461,7 +461,7 @@ static int hw_set_configuration(int device_index, int capability, void *value) struct sr_device_instance *sdi; 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; switch (capability) { @@ -488,7 +488,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id) unsigned int packet_num; 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; /* 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; 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? */ analyzer_reset(sdi->usb->devhdl); diff --git a/hwplugin.c b/hwplugin.c index 5590a4bb..e9bd582e 100644 --- a/hwplugin.c +++ b/hwplugin.c @@ -119,8 +119,8 @@ struct sr_device_instance *sr_device_instance_new(int index, int status, return sdi; } -struct sr_device_instance *get_sr_device_instance( - GSList *device_instances, int device_index) +struct sr_device_instance *sr_get_device_instance(GSList *device_instances, + int device_index) { struct sr_device_instance *sdi; GSList *l; diff --git a/sigrok-proto.h b/sigrok-proto.h index 8a96a88f..658553d4 100644 --- a/sigrok-proto.h +++ b/sigrok-proto.h @@ -65,8 +65,8 @@ GSList *list_hwplugins(void); /* Generic device instances */ struct sr_device_instance *sr_device_instance_new(int index, int status, const char *vendor, const char *model, const char *version); -struct sr_device_instance *get_sr_device_instance( - GSList *device_instances, int device_index); +struct sr_device_instance *sr_get_device_instance(GSList *device_instances, + int device_index); void sr_device_instance_free(struct sr_device_instance *sdi); /* USB-specific instances */