Minor cosmetics, cleanups.
This commit is contained in:
parent
8852eb75d1
commit
1a8639164e
|
@ -214,7 +214,8 @@ SR_PRIV struct sr_dev_driver **drivers_lists[] = {
|
||||||
(DRVS) {
|
(DRVS) {
|
||||||
¢er_309_driver_info,
|
¢er_309_driver_info,
|
||||||
&voltcraft_k204_driver_info,
|
&voltcraft_k204_driver_info,
|
||||||
NULL},
|
NULL
|
||||||
|
},
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_HW_CHRONOVU_LA
|
#ifdef HAVE_HW_CHRONOVU_LA
|
||||||
(DRVS) {&chronovu_la_driver_info, NULL},
|
(DRVS) {&chronovu_la_driver_info, NULL},
|
||||||
|
@ -241,7 +242,8 @@ SR_PRIV struct sr_dev_driver **drivers_lists[] = {
|
||||||
(DRVS) {
|
(DRVS) {
|
||||||
&gmc_mh_1x_2x_rs232_driver_info,
|
&gmc_mh_1x_2x_rs232_driver_info,
|
||||||
&gmc_mh_2x_bd232_driver_info,
|
&gmc_mh_2x_bd232_driver_info,
|
||||||
NULL},
|
NULL
|
||||||
|
},
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_HW_HAMEG_HMO
|
#ifdef HAVE_HW_HAMEG_HMO
|
||||||
(DRVS) {&hameg_hmo_driver_info, NULL},
|
(DRVS) {&hameg_hmo_driver_info, NULL},
|
||||||
|
@ -271,7 +273,8 @@ SR_PRIV struct sr_dev_driver **drivers_lists[] = {
|
||||||
(DRVS) {
|
(DRVS) {
|
||||||
&mic_98581_driver_info,
|
&mic_98581_driver_info,
|
||||||
&mic_98583_driver_info,
|
&mic_98583_driver_info,
|
||||||
NULL},
|
NULL
|
||||||
|
},
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_HW_MOTECH_LPS_30X
|
#ifdef HAVE_HW_MOTECH_LPS_30X
|
||||||
(DRVS) {&motech_lps_301_driver_info, NULL},
|
(DRVS) {&motech_lps_301_driver_info, NULL},
|
||||||
|
@ -280,7 +283,8 @@ SR_PRIV struct sr_dev_driver **drivers_lists[] = {
|
||||||
(DRVS) {
|
(DRVS) {
|
||||||
&norma_dmm_driver_info,
|
&norma_dmm_driver_info,
|
||||||
&siemens_b102x_driver_info,
|
&siemens_b102x_driver_info,
|
||||||
NULL},
|
NULL
|
||||||
|
},
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_HW_OPENBENCH_LOGIC_SNIFFER
|
#ifdef HAVE_HW_OPENBENCH_LOGIC_SNIFFER
|
||||||
(DRVS) {&ols_driver_info, NULL},
|
(DRVS) {&ols_driver_info, NULL},
|
||||||
|
@ -337,7 +341,8 @@ SR_PRIV struct sr_dev_driver **drivers_lists[] = {
|
||||||
&voltcraft_vc960_driver_info,
|
&voltcraft_vc960_driver_info,
|
||||||
&tenma_72_7745_driver_info,
|
&tenma_72_7745_driver_info,
|
||||||
&tenma_72_7750_driver_info,
|
&tenma_72_7750_driver_info,
|
||||||
NULL},
|
NULL
|
||||||
|
},
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_HW_UNI_T_UT32X
|
#ifdef HAVE_HW_UNI_T_UT32X
|
||||||
(DRVS) {&uni_t_ut32x_driver_info, NULL},
|
(DRVS) {&uni_t_ut32x_driver_info, NULL},
|
||||||
|
@ -354,4 +359,3 @@ SR_PRIV struct sr_dev_driver **drivers_lists[] = {
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
/** @endcond */
|
/** @endcond */
|
||||||
|
|
||||||
|
|
|
@ -240,20 +240,19 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
|
||||||
/* Driver-specific API function wrappers */
|
/* Driver-specific API function wrappers */
|
||||||
#define HW_INIT(X) \
|
#define HW_INIT(X) \
|
||||||
static int init_##X(struct sr_dev_driver *d, \
|
static int init_##X(struct sr_dev_driver *d, \
|
||||||
struct sr_context *sr_ctx) { \
|
struct sr_context *sr_ctx) { (void)d; return init(sr_ctx, X); }
|
||||||
(void) d; return init(sr_ctx, X); }
|
|
||||||
#define HW_CLEANUP(X) \
|
#define HW_CLEANUP(X) \
|
||||||
static int cleanup_##X(const struct sr_dev_driver *d) { \
|
static int cleanup_##X(const struct sr_dev_driver *d) { \
|
||||||
(void) d; return cleanup(X); }
|
(void)d; return cleanup(X); }
|
||||||
#define HW_SCAN(X) \
|
#define HW_SCAN(X) \
|
||||||
static GSList *scan_##X(struct sr_dev_driver *d, GSList *options) { \
|
static GSList *scan_##X(struct sr_dev_driver *d, GSList *options) { \
|
||||||
(void) d; return scan(options, X); }
|
(void)d; return scan(options, X); }
|
||||||
#define HW_DEV_LIST(X) \
|
#define HW_DEV_LIST(X) \
|
||||||
static GSList *dev_list_##X(const struct sr_dev_driver *d) { \
|
static GSList *dev_list_##X(const struct sr_dev_driver *d) { \
|
||||||
(void) d; return dev_list(X); }
|
(void)d; return dev_list(X); }
|
||||||
#define HW_DEV_CLEAR(X) \
|
#define HW_DEV_CLEAR(X) \
|
||||||
static int dev_clear_##X(const struct sr_dev_driver *d) { \
|
static int dev_clear_##X(const struct sr_dev_driver *d) { \
|
||||||
(void) d; return dev_clear(X); }
|
(void)d; return dev_clear(X); }
|
||||||
#define HW_DEV_ACQUISITION_START(X) \
|
#define HW_DEV_ACQUISITION_START(X) \
|
||||||
static int dev_acquisition_start_##X(const struct sr_dev_inst *sdi, \
|
static int dev_acquisition_start_##X(const struct sr_dev_inst *sdi, \
|
||||||
void *cb_data) { return dev_acquisition_start(sdi, cb_data, X); }
|
void *cb_data) { return dev_acquisition_start(sdi, cb_data, X); }
|
||||||
|
|
|
@ -598,9 +598,8 @@ static int receive_data(int fd, int revents, void *cb_data)
|
||||||
|
|
||||||
(void)fd;
|
(void)fd;
|
||||||
(void)revents;
|
(void)revents;
|
||||||
(void)cb_data;
|
|
||||||
|
|
||||||
drvc = (struct drv_context *) cb_data;
|
drvc = (struct drv_context *)cb_data;
|
||||||
|
|
||||||
tv.tv_sec = tv.tv_usec = 0;
|
tv.tv_sec = tv.tv_usec = 0;
|
||||||
libusb_handle_events_timeout(drvc->sr_ctx->libusb_ctx, &tv);
|
libusb_handle_events_timeout(drvc->sr_ctx->libusb_ctx, &tv);
|
||||||
|
|
|
@ -66,7 +66,6 @@ static const uint32_t devopts_bd[] = {
|
||||||
* Need to implement device-specific lists.
|
* Need to implement device-specific lists.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** Init driver. */
|
|
||||||
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
|
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
|
||||||
{
|
{
|
||||||
return std_init(sr_ctx, di, LOG_PREFIX);
|
return std_init(sr_ctx, di, LOG_PREFIX);
|
||||||
|
@ -237,8 +236,9 @@ static GSList *scan_1x_2x_rs232(struct sr_dev_driver *di, GSList *options)
|
||||||
return devices;
|
return devices;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Scan for Metrahit 2x in a bidirectional mode using Gossen Metrawatt 'BD 232' interface.
|
/**
|
||||||
*
|
* Scan for Metrahit 2x in a bidirectional mode using Gossen Metrawatt
|
||||||
|
* 'BD 232' interface.
|
||||||
*/
|
*/
|
||||||
static GSList *scan_2x_bd232(struct sr_dev_driver *di, GSList *options)
|
static GSList *scan_2x_bd232(struct sr_dev_driver *di, GSList *options)
|
||||||
{
|
{
|
||||||
|
@ -354,7 +354,6 @@ exit_err:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Driver device list function */
|
|
||||||
static GSList *dev_list(const struct sr_dev_driver *di)
|
static GSList *dev_list(const struct sr_dev_driver *di)
|
||||||
{
|
{
|
||||||
return ((struct drv_context *)(di->priv))->instances;
|
return ((struct drv_context *)(di->priv))->instances;
|
||||||
|
@ -383,7 +382,6 @@ static int cleanup(const struct sr_dev_driver *di)
|
||||||
return std_dev_clear(di, NULL);
|
return std_dev_clear(di, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get value of configuration item */
|
|
||||||
static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_channel_group *cg)
|
const struct sr_channel_group *cg)
|
||||||
{
|
{
|
||||||
|
@ -415,7 +413,7 @@ static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *s
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Implementation of config_list, auxiliary function for common parts, */
|
/** Implementation of config_list, auxiliary function for common parts. */
|
||||||
static int config_list_common(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_list_common(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_channel_group *cg)
|
const struct sr_channel_group *cg)
|
||||||
{
|
{
|
||||||
|
|
|
@ -249,19 +249,19 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
|
||||||
/* Driver-specific API function wrappers */
|
/* Driver-specific API function wrappers */
|
||||||
#define HW_INIT(X) \
|
#define HW_INIT(X) \
|
||||||
static int init_##X(struct sr_dev_driver *di, struct sr_context *sr_ctx) { \
|
static int init_##X(struct sr_dev_driver *di, struct sr_context *sr_ctx) { \
|
||||||
(void) di; return init(sr_ctx, X); }
|
(void)di; return init(sr_ctx, X); }
|
||||||
#define HW_CLEANUP(X) \
|
#define HW_CLEANUP(X) \
|
||||||
static int cleanup_##X(const struct sr_dev_driver *di) { \
|
static int cleanup_##X(const struct sr_dev_driver *di) { \
|
||||||
(void) di; return cleanup(X); }
|
(void)di; return cleanup(X); }
|
||||||
#define HW_SCAN(X) \
|
#define HW_SCAN(X) \
|
||||||
static GSList *scan_##X(struct sr_dev_driver *di, GSList *options) { \
|
static GSList *scan_##X(struct sr_dev_driver *di, GSList *options) { \
|
||||||
(void) di; return scan(options, X); }
|
(void)di; return scan(options, X); }
|
||||||
#define HW_DEV_LIST(X) \
|
#define HW_DEV_LIST(X) \
|
||||||
static GSList *dev_list_##X(const struct sr_dev_driver *di) { \
|
static GSList *dev_list_##X(const struct sr_dev_driver *di) { \
|
||||||
(void) di; return dev_list(X); }
|
(void)di; return dev_list(X); }
|
||||||
#define HW_DEV_CLEAR(X) \
|
#define HW_DEV_CLEAR(X) \
|
||||||
static int dev_clear_##X(const struct sr_dev_driver *di) { \
|
static int dev_clear_##X(const struct sr_dev_driver *di) { \
|
||||||
(void) di; return dev_clear(X); }
|
(void)di; return dev_clear(X); }
|
||||||
#define HW_CONFIG_LIST(X) \
|
#define HW_CONFIG_LIST(X) \
|
||||||
static int config_list_##X(uint32_t key, GVariant **data, \
|
static int config_list_##X(uint32_t key, GVariant **data, \
|
||||||
const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { \
|
const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { \
|
||||||
|
|
|
@ -53,7 +53,7 @@ static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
|
||||||
|
|
||||||
static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
{
|
{
|
||||||
struct dmm_info *dmm = (struct dmm_info *) di;
|
struct dmm_info *dmm;
|
||||||
struct sr_config *src;
|
struct sr_config *src;
|
||||||
GSList *l, *devices;
|
GSList *l, *devices;
|
||||||
const char *conn, *serialcomm;
|
const char *conn, *serialcomm;
|
||||||
|
@ -65,6 +65,8 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
size_t len;
|
size_t len;
|
||||||
uint8_t buf[128];
|
uint8_t buf[128];
|
||||||
|
|
||||||
|
dmm = (struct dmm_info *)di;
|
||||||
|
|
||||||
conn = serialcomm = NULL;
|
conn = serialcomm = NULL;
|
||||||
for (l = options; l; l = l->next) {
|
for (l = options; l; l = l->next) {
|
||||||
src = l->data;
|
src = l->data;
|
||||||
|
|
|
@ -41,12 +41,14 @@ static void log_dmm_packet(const uint8_t *buf)
|
||||||
static void handle_packet(const uint8_t *buf, struct sr_dev_inst *sdi,
|
static void handle_packet(const uint8_t *buf, struct sr_dev_inst *sdi,
|
||||||
void *info)
|
void *info)
|
||||||
{
|
{
|
||||||
struct dmm_info *dmm = (struct dmm_info *) sdi->driver;
|
struct dmm_info *dmm;
|
||||||
float floatval;
|
float floatval;
|
||||||
struct sr_datafeed_packet packet;
|
struct sr_datafeed_packet packet;
|
||||||
struct sr_datafeed_analog analog;
|
struct sr_datafeed_analog analog;
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
|
|
||||||
|
dmm = (struct dmm_info *)sdi->driver;
|
||||||
|
|
||||||
log_dmm_packet(buf);
|
log_dmm_packet(buf);
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
|
|
||||||
|
@ -75,11 +77,13 @@ static void handle_packet(const uint8_t *buf, struct sr_dev_inst *sdi,
|
||||||
/** Request packet, if required. */
|
/** Request packet, if required. */
|
||||||
SR_PRIV int req_packet(struct sr_dev_inst *sdi)
|
SR_PRIV int req_packet(struct sr_dev_inst *sdi)
|
||||||
{
|
{
|
||||||
struct dmm_info *dmm = (struct dmm_info *) sdi->driver;
|
struct dmm_info *dmm;
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
struct sr_serial_dev_inst *serial;
|
struct sr_serial_dev_inst *serial;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
dmm = (struct dmm_info *)sdi->driver;
|
||||||
|
|
||||||
if (!dmm->packet_request)
|
if (!dmm->packet_request)
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
|
|
||||||
|
@ -106,11 +110,13 @@ SR_PRIV int req_packet(struct sr_dev_inst *sdi)
|
||||||
|
|
||||||
static void handle_new_data(struct sr_dev_inst *sdi, void *info)
|
static void handle_new_data(struct sr_dev_inst *sdi, void *info)
|
||||||
{
|
{
|
||||||
struct dmm_info *dmm = (struct dmm_info *) sdi->driver;
|
struct dmm_info *dmm;
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
int len, i, offset = 0;
|
int len, i, offset = 0;
|
||||||
struct sr_serial_dev_inst *serial;
|
struct sr_serial_dev_inst *serial;
|
||||||
|
|
||||||
|
dmm = (struct dmm_info *)sdi->driver;
|
||||||
|
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
serial = sdi->conn;
|
serial = sdi->conn;
|
||||||
|
|
||||||
|
@ -165,7 +171,7 @@ int receive_data(int fd, int revents, void *cb_data)
|
||||||
if (!(devc = sdi->priv))
|
if (!(devc = sdi->priv))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
dmm = (struct dmm_info *) sdi->driver;
|
dmm = (struct dmm_info *)sdi->driver;
|
||||||
|
|
||||||
if (revents == G_IO_IN) {
|
if (revents == G_IO_IN) {
|
||||||
/* Serial data arrived. */
|
/* Serial data arrived. */
|
||||||
|
|
|
@ -415,19 +415,19 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
|
||||||
/* Driver-specific API function wrappers */
|
/* Driver-specific API function wrappers */
|
||||||
#define HW_INIT(X) \
|
#define HW_INIT(X) \
|
||||||
static int init_##X(struct sr_dev_driver *di, struct sr_context *sr_ctx) { \
|
static int init_##X(struct sr_dev_driver *di, struct sr_context *sr_ctx) { \
|
||||||
(void) di; return init(sr_ctx, X); }
|
(void)di; return init(sr_ctx, X); }
|
||||||
#define HW_CLEANUP(X) \
|
#define HW_CLEANUP(X) \
|
||||||
static int cleanup_##X(const struct sr_dev_driver *di) { \
|
static int cleanup_##X(const struct sr_dev_driver *di) { \
|
||||||
(void) di; return cleanup(X); }
|
(void)di; return cleanup(X); }
|
||||||
#define HW_SCAN(X) \
|
#define HW_SCAN(X) \
|
||||||
static GSList *scan_##X(struct sr_dev_driver *di, GSList *options) { \
|
static GSList *scan_##X(struct sr_dev_driver *di, GSList *options) { \
|
||||||
(void) di; return scan(options, X); }
|
(void)di; return scan(options, X); }
|
||||||
#define HW_DEV_LIST(X) \
|
#define HW_DEV_LIST(X) \
|
||||||
static GSList *dev_list_##X(const struct sr_dev_driver *di) { \
|
static GSList *dev_list_##X(const struct sr_dev_driver *di) { \
|
||||||
(void) di; return dev_list(X); }
|
(void)di; return dev_list(X); }
|
||||||
#define HW_DEV_CLEAR(X) \
|
#define HW_DEV_CLEAR(X) \
|
||||||
static int dev_clear_##X(const struct sr_dev_driver *di) { \
|
static int dev_clear_##X(const struct sr_dev_driver *di) { \
|
||||||
(void) di; return dev_clear(X); }
|
(void)di; return dev_clear(X); }
|
||||||
#define HW_DEV_ACQUISITION_START(X) \
|
#define HW_DEV_ACQUISITION_START(X) \
|
||||||
static int dev_acquisition_start_##X(const struct sr_dev_inst *sdi, \
|
static int dev_acquisition_start_##X(const struct sr_dev_inst *sdi, \
|
||||||
void *cb_data) { return dev_acquisition_start(sdi, cb_data, X); }
|
void *cb_data) { return dev_acquisition_start(sdi, cb_data, X); }
|
||||||
|
|
|
@ -269,14 +269,15 @@ SR_API struct sr_dev_driver **sr_driver_list(void)
|
||||||
struct sr_dev_driver ***lists, **drivers;
|
struct sr_dev_driver ***lists, **drivers;
|
||||||
GArray *array;
|
GArray *array;
|
||||||
|
|
||||||
if (!combined_list) {
|
if (combined_list)
|
||||||
array = g_array_new(TRUE, FALSE, sizeof(struct sr_dev_driver *));
|
return combined_list;
|
||||||
for (lists = drivers_lists; *lists; lists++)
|
|
||||||
for (drivers = *lists; *drivers; drivers++)
|
array = g_array_new(TRUE, FALSE, sizeof(struct sr_dev_driver *));
|
||||||
g_array_append_val(array, *drivers);
|
for (lists = drivers_lists; *lists; lists++)
|
||||||
combined_list = (struct sr_dev_driver **) array->data;
|
for (drivers = *lists; *drivers; drivers++)
|
||||||
g_array_free(array, FALSE);
|
g_array_append_val(array, *drivers);
|
||||||
}
|
combined_list = (struct sr_dev_driver **)array->data;
|
||||||
|
g_array_free(array, FALSE);
|
||||||
|
|
||||||
return combined_list;
|
return combined_list;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue