From: Uwe Hermann Date: Sat, 18 Feb 2012 10:57:43 +0000 (+0100) Subject: sr: opendev/closedev -> dev_open/dev_close. X-Git-Tag: libsigrok-0.1.0~109 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=e7eb703fff0167897f7e094e2edbf7d5798857ea;p=libsigrok.git sr: opendev/closedev -> dev_open/dev_close. --- diff --git a/hardware/alsa/alsa.c b/hardware/alsa/alsa.c index 7404ed5b..9a93aab8 100644 --- a/hardware/alsa/alsa.c +++ b/hardware/alsa/alsa.c @@ -92,7 +92,7 @@ free_alsa: return 0; } -static int hw_opendev(int dev_index) +static int hw_dev_open(int dev_index) { struct sr_dev_inst *sdi; struct alsa *alsa; @@ -127,7 +127,7 @@ static int hw_opendev(int dev_index) return SR_OK; } -static int hw_closedev(int dev_index) +static int hw_dev_close(int dev_index) { struct sr_dev_inst *sdi; struct alsa *alsa; @@ -196,7 +196,7 @@ static void *hw_dev_info_get(int dev_index, int dev_info_id) return info; } -static int hw_get_status(int dev_index) +static int hw_dev_status_get(int dev_index) { /* Avoid compiler warnings. */ dev_index = dev_index; @@ -398,10 +398,10 @@ SR_PRIV struct sr_dev_plugin alsa_plugin_info = { .api_version = 1, .init = hw_init, .cleanup = hw_cleanup, - .opendev = hw_opendev, - .closedev = hw_closedev, + .dev_open = hw_dev_open, + .dev_close = hw_dev_close, .dev_info_get = hw_dev_info_get, - .get_status = hw_get_status, + .dev_status_get = hw_dev_status_get, .hwcap_get_all = hw_hwcap_get_all, .config_set = hw_config_set, .acquisition_start = hw_acquisition_start, diff --git a/hardware/asix-sigma/asix-sigma.c b/hardware/asix-sigma/asix-sigma.c index 5932c879..7eabef03 100644 --- a/hardware/asix-sigma/asix-sigma.c +++ b/hardware/asix-sigma/asix-sigma.c @@ -555,7 +555,7 @@ static int upload_firmware(int firmware_idx, struct sigma *sigma) return SR_OK; } -static int hw_opendev(int dev_index) +static int hw_dev_open(int dev_index) { struct sr_dev_inst *sdi; struct sigma *sigma; @@ -698,7 +698,7 @@ static int configure_probes(struct sr_dev_inst *sdi, GSList *probes) return SR_OK; } -static int hw_closedev(int dev_index) +static int hw_dev_close(int dev_index) { struct sr_dev_inst *sdi; struct sigma *sigma; @@ -781,7 +781,7 @@ static void *hw_dev_info_get(int dev_index, int dev_info_id) return info; } -static int hw_get_status(int dev_index) +static int hw_dev_status_get(int dev_index) { struct sr_dev_inst *sdi; @@ -1417,10 +1417,10 @@ SR_PRIV struct sr_dev_plugin asix_sigma_plugin_info = { .api_version = 1, .init = hw_init, .cleanup = hw_cleanup, - .opendev = hw_opendev, - .closedev = hw_closedev, + .dev_open = hw_dev_open, + .dev_close = hw_dev_close, .dev_info_get = hw_dev_info_get, - .get_status = hw_get_status, + .dev_status_get = hw_dev_status_get, .hwcap_get_all = hw_hwcap_get_all, .config_set = hw_config_set, .acquisition_start = hw_acquisition_start, diff --git a/hardware/chronovu-la8/chronovu-la8.c b/hardware/chronovu-la8/chronovu-la8.c index 6ce6eb4b..b551fb7e 100644 --- a/hardware/chronovu-la8/chronovu-la8.c +++ b/hardware/chronovu-la8/chronovu-la8.c @@ -550,7 +550,7 @@ err_free_nothing: return 0; } -static int hw_opendev(int dev_index) +static int hw_dev_open(int dev_index) { int ret; struct sr_dev_inst *sdi; @@ -583,7 +583,7 @@ static int hw_opendev(int dev_index) sr_err("la8: %s: ftdi_usb_purge_buffers: (%d) %s", __func__, ret, ftdi_get_error_string(la8->ftdic)); (void) la8_close_usb_reset_sequencer(la8); /* Ignore errors. */ - goto err_opendev_close_ftdic; + goto err_dev_open_close_ftdic; } sr_dbg("la8: FTDI buffers purged successfully"); @@ -592,7 +592,7 @@ static int hw_opendev(int dev_index) sr_err("la8: %s: ftdi_setflowcontrol: (%d) %s", __func__, ret, ftdi_get_error_string(la8->ftdic)); (void) la8_close_usb_reset_sequencer(la8); /* Ignore errors. */ - goto err_opendev_close_ftdic; + goto err_dev_open_close_ftdic; } sr_dbg("la8: FTDI flow control enabled successfully"); @@ -603,7 +603,7 @@ static int hw_opendev(int dev_index) return SR_OK; -err_opendev_close_ftdic: +err_dev_open_close_ftdic: (void) la8_close(la8); /* Log, but ignore errors. */ return SR_ERR; } @@ -638,7 +638,7 @@ static int set_samplerate(struct sr_dev_inst *sdi, uint64_t samplerate) return SR_OK; } -static int hw_closedev(int dev_index) +static int hw_dev_close(int dev_index) { struct sr_dev_inst *sdi; struct la8 *la8; @@ -741,7 +741,7 @@ static void *hw_dev_info_get(int dev_index, int dev_info_id) return info; } -static int hw_get_status(int dev_index) +static int hw_dev_status_get(int dev_index) { struct sr_dev_inst *sdi; @@ -1119,10 +1119,10 @@ SR_PRIV struct sr_dev_plugin chronovu_la8_plugin_info = { .api_version = 1, .init = hw_init, .cleanup = hw_cleanup, - .opendev = hw_opendev, - .closedev = hw_closedev, + .dev_open = hw_dev_open, + .dev_close = hw_dev_close, .dev_info_get = hw_dev_info_get, - .get_status = hw_get_status, + .dev_status_get = hw_dev_status_get, .hwcap_get_all = hw_hwcap_get_all, .config_set = hw_config_set, .acquisition_start = hw_acquisition_start, diff --git a/hardware/demo/demo.c b/hardware/demo/demo.c index c1b5b5cf..2ba59cc8 100644 --- a/hardware/demo/demo.c +++ b/hardware/demo/demo.c @@ -125,7 +125,7 @@ static uint8_t pattern_sigrok[] = { 0xbe, 0xbe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; -/* List of struct sr_dev_inst, maintained by opendev()/closedev(). */ +/* List of struct sr_dev_inst, maintained by dev_open()/dev_close(). */ static GSList *dev_insts = NULL; static uint64_t cur_samplerate = SR_KHZ(200); static uint64_t limit_samples = 0; @@ -154,7 +154,7 @@ static int hw_init(const char *devinfo) return 1; } -static int hw_opendev(int dev_index) +static int hw_dev_open(int dev_index) { /* Avoid compiler warnings. */ (void)dev_index; @@ -164,7 +164,7 @@ static int hw_opendev(int dev_index) return SR_OK; } -static int hw_closedev(int dev_index) +static int hw_dev_close(int dev_index) { /* Avoid compiler warnings. */ (void)dev_index; @@ -214,7 +214,7 @@ static void *hw_dev_info_get(int dev_index, int dev_info_id) return info; } -static int hw_get_status(int dev_index) +static int hw_dev_status_get(int dev_index) { /* Avoid compiler warnings. */ (void)dev_index; @@ -495,10 +495,10 @@ SR_PRIV struct sr_dev_plugin demo_plugin_info = { .api_version = 1, .init = hw_init, .cleanup = hw_cleanup, - .opendev = hw_opendev, - .closedev = hw_closedev, + .dev_open = hw_dev_open, + .dev_close = hw_dev_close, .dev_info_get = hw_dev_info_get, - .get_status = hw_get_status, + .dev_status_get = hw_dev_status_get, .hwcap_get_all = hw_hwcap_get_all, .config_set = hw_config_set, .acquisition_start = hw_acquisition_start, diff --git a/hardware/link-mso19/link-mso19.c b/hardware/link-mso19/link-mso19.c index d6cfbc40..5fe2deed 100644 --- a/hardware/link-mso19/link-mso19.c +++ b/hardware/link-mso19/link-mso19.c @@ -540,7 +540,7 @@ static int hw_cleanup(void) return ret; } -static int hw_opendev(int dev_index) +static int hw_dev_open(int dev_index) { struct sr_dev_inst *sdi; struct mso *mso; @@ -582,7 +582,7 @@ static int hw_opendev(int dev_index) return SR_OK; } -static int hw_closedev(int dev_index) +static int hw_dev_close(int dev_index) { struct sr_dev_inst *sdi; @@ -635,7 +635,7 @@ static void *hw_dev_info_get(int dev_index, int dev_info_id) return info; } -static int hw_get_status(int dev_index) +static int hw_dev_status_get(int dev_index) { struct sr_dev_inst *sdi; @@ -835,10 +835,10 @@ SR_PRIV struct sr_dev_plugin link_mso19_plugin_info = { .api_version = 1, .init = hw_init, .cleanup = hw_cleanup, - .opendev = hw_opendev, - .closedev = hw_closedev, + .dev_open = hw_dev_open, + .dev_close = hw_dev_close, .dev_info_get = hw_dev_info_get, - .get_status = hw_get_status, + .dev_status_get = hw_dev_status_get, .hwcap_get_all = hw_hwcap_get_all, .config_set = hw_config_set, .acquisition_start = hw_acquisition_start, diff --git a/hardware/openbench-logic-sniffer/ols.c b/hardware/openbench-logic-sniffer/ols.c index 6d5fc8ba..8791aae9 100644 --- a/hardware/openbench-logic-sniffer/ols.c +++ b/hardware/openbench-logic-sniffer/ols.c @@ -480,7 +480,7 @@ hw_init_free_ports: return final_devcnt; } -static int hw_opendev(int dev_index) +static int hw_dev_open(int dev_index) { struct sr_dev_inst *sdi; struct ols_dev *ols; @@ -499,7 +499,7 @@ static int hw_opendev(int dev_index) return SR_OK; } -static int hw_closedev(int dev_index) +static int hw_dev_close(int dev_index) { struct sr_dev_inst *sdi; struct ols_dev *ols; @@ -590,7 +590,7 @@ static void *hw_dev_info_get(int dev_index, int dev_info_id) return info; } -static int hw_get_status(int dev_index) +static int hw_dev_status_get(int dev_index) { struct sr_dev_inst *sdi; @@ -1043,10 +1043,10 @@ SR_PRIV struct sr_dev_plugin ols_plugin_info = { .api_version = 1, .init = hw_init, .cleanup = hw_cleanup, - .opendev = hw_opendev, - .closedev = hw_closedev, + .dev_open = hw_dev_open, + .dev_close = hw_dev_close, .dev_info_get = hw_dev_info_get, - .get_status = hw_get_status, + .dev_status_get = hw_dev_status_get, .hwcap_get_all = hw_hwcap_get_all, .config_set = hw_config_set, .acquisition_start = hw_acquisition_start, diff --git a/hardware/saleae-logic/saleae-logic.c b/hardware/saleae-logic/saleae-logic.c index d0cbc4dd..fb3d448c 100644 --- a/hardware/saleae-logic/saleae-logic.c +++ b/hardware/saleae-logic/saleae-logic.c @@ -87,7 +87,7 @@ static struct sr_samplerates samplerates = { supported_samplerates, }; -/* List of struct sr_dev_inst, maintained by opendev()/closedev(). */ +/* List of struct sr_dev_inst, maintained by dev_open()/dev_close(). */ static GSList *dev_insts = NULL; static libusb_context *usb_context = NULL; @@ -393,7 +393,7 @@ static int hw_init(const char *devinfo) return devcnt; } -static int hw_opendev(int dev_index) +static int hw_dev_open(int dev_index) { GTimeVal cur_time; struct sr_dev_inst *sdi; @@ -448,7 +448,7 @@ static int hw_opendev(int dev_index) return SR_OK; } -static int hw_closedev(int dev_index) +static int hw_dev_close(int dev_index) { struct sr_dev_inst *sdi; @@ -534,7 +534,7 @@ static void *hw_dev_info_get(int dev_index, int dev_info_id) return info; } -static int hw_get_status(int dev_index) +static int hw_dev_status_get(int dev_index) { struct sr_dev_inst *sdi; @@ -896,10 +896,10 @@ SR_PRIV struct sr_dev_plugin saleae_logic_plugin_info = { .api_version = 1, .init = hw_init, .cleanup = hw_cleanup, - .opendev = hw_opendev, - .closedev = hw_closedev, + .dev_open = hw_dev_open, + .dev_close = hw_dev_close, .dev_info_get = hw_dev_info_get, - .get_status = hw_get_status, + .dev_status_get = hw_dev_status_get, .hwcap_get_all = hw_hwcap_get_all, .config_set = hw_config_set, .acquisition_start = hw_acquisition_start, diff --git a/hardware/zeroplus-logic-cube/zeroplus.c b/hardware/zeroplus-logic-cube/zeroplus.c index 5ca36e54..aa7a65dc 100644 --- a/hardware/zeroplus-logic-cube/zeroplus.c +++ b/hardware/zeroplus-logic-cube/zeroplus.c @@ -110,7 +110,7 @@ static const char *probe_names[] = { NULL, }; -/* List of struct sr_dev_inst, maintained by opendev()/closedev(). */ +/* List of struct sr_dev_inst, maintained by dev_open()/dev_close(). */ static GSList *dev_insts = NULL; static libusb_context *usb_context = NULL; @@ -409,7 +409,7 @@ static int hw_init(const char *devinfo) return devcnt; } -static int hw_opendev(int dev_index) +static int hw_dev_open(int dev_index) { struct sr_dev_inst *sdi; struct zp *zp; @@ -470,7 +470,7 @@ static int hw_opendev(int dev_index) return SR_OK; } -static int hw_closedev(int dev_index) +static int hw_dev_close(int dev_index) { struct sr_dev_inst *sdi; @@ -552,7 +552,7 @@ static void *hw_dev_info_get(int dev_index, int dev_info_id) return info; } -static int hw_get_status(int dev_index) +static int hw_dev_status_get(int dev_index) { struct sr_dev_inst *sdi; @@ -734,10 +734,10 @@ SR_PRIV struct sr_dev_plugin zeroplus_logic_cube_plugin_info = { .api_version = 1, .init = hw_init, .cleanup = hw_cleanup, - .opendev = hw_opendev, - .closedev = hw_closedev, + .dev_open = hw_dev_open, + .dev_close = hw_dev_close, .dev_info_get = hw_dev_info_get, - .get_status = hw_get_status, + .dev_status_get = hw_dev_status_get, .hwcap_get_all = hw_hwcap_get_all, .config_set = hw_config_set, .acquisition_start = hw_acquisition_start, diff --git a/session.c b/session.c index e129da9e..13e60619 100644 --- a/session.c +++ b/session.c @@ -114,7 +114,7 @@ SR_API int sr_session_dev_clear(void) * Add a device to the current session. * * @param dev The device to add to the current session. Must not be NULL. - * Also, dev->plugin and dev->plugin->opendev must not be NULL. + * Also, dev->plugin and dev->plugin->dev_open must not be NULL. * * @return SR_OK upon success, SR_ERR_ARG upon invalid arguments. */ @@ -132,8 +132,8 @@ SR_API int sr_session_dev_add(struct sr_dev *dev) return SR_ERR_ARG; } - if (!dev->plugin->opendev) { - sr_err("session: %s: dev->plugin->opendev was NULL", + if (!dev->plugin->dev_open) { + sr_err("session: %s: dev->plugin->dev_open was NULL", __func__); return SR_ERR_ARG; } @@ -143,8 +143,8 @@ SR_API int sr_session_dev_add(struct sr_dev *dev) return SR_ERR; /* TODO: SR_ERR_BUG? */ } - if ((ret = dev->plugin->opendev(dev->plugin_index)) != SR_OK) { - sr_err("session: %s: opendev failed (%d)", __func__, ret); + if ((ret = dev->plugin->dev_open(dev->plugin_index)) != SR_OK) { + sr_err("session: %s: dev_open failed (%d)", __func__, ret); return ret; } diff --git a/session_driver.c b/session_driver.c index 369c95a4..1ed0f58e 100644 --- a/session_driver.c +++ b/session_driver.c @@ -175,7 +175,7 @@ static int hw_cleanup(void) return SR_OK; } -static int hw_opendev(int dev_index) +static int hw_dev_open(int dev_index) { struct sr_dev_inst *sdi; @@ -210,7 +210,7 @@ static void *hw_dev_info_get(int dev_index, int dev_info_id) return info; } -static int hw_get_status(int dev_index) +static int hw_dev_status_get(int dev_index) { /* Avoid compiler warnings. */ (void)dev_index; @@ -337,10 +337,10 @@ SR_PRIV struct sr_dev_plugin session_driver = { .api_version = 1, .init = hw_init, .cleanup = hw_cleanup, - .opendev = hw_opendev, - .closedev = NULL, + .dev_open = hw_dev_open, + .dev_close = NULL, .dev_info_get = hw_dev_info_get, - .get_status = hw_get_status, + .dev_status_get = hw_dev_status_get, .hwcap_get_all = hw_hwcap_get_all, .config_set = hw_config_set, .acquisition_start = hw_acquisition_start, diff --git a/sigrok.h b/sigrok.h index 4e69215d..300e8a0b 100644 --- a/sigrok.h +++ b/sigrok.h @@ -347,10 +347,10 @@ struct sr_dev_plugin { int (*cleanup) (void); /* Device-specific */ - int (*opendev) (int dev_index); - int (*closedev) (int dev_index); + int (*dev_open) (int dev_index); + int (*dev_close) (int dev_index); void *(*dev_info_get) (int dev_index, int dev_info_id); - int (*get_status) (int dev_index); + int (*dev_status_get) (int dev_index); int *(*hwcap_get_all) (void); int (*config_set) (int dev_index, int hwcap, void *value); int (*acquisition_start) (int dev_index, gpointer session_dev_id);