sr: opendev/closedev -> dev_open/dev_close.

This commit is contained in:
Uwe Hermann 2012-02-18 11:57:43 +01:00
parent 8105505d06
commit e7eb703fff
11 changed files with 67 additions and 67 deletions

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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;
}

View File

@ -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,

View File

@ -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);