(DRVS) {
¢er_309_driver_info,
&voltcraft_k204_driver_info,
- NULL},
+ NULL
+ },
#endif
#ifdef HAVE_HW_CHRONOVU_LA
(DRVS) {&chronovu_la_driver_info, NULL},
(DRVS) {
&gmc_mh_1x_2x_rs232_driver_info,
&gmc_mh_2x_bd232_driver_info,
- NULL},
+ NULL
+ },
#endif
#ifdef HAVE_HW_HAMEG_HMO
(DRVS) {&hameg_hmo_driver_info, NULL},
(DRVS) {
&mic_98581_driver_info,
&mic_98583_driver_info,
- NULL},
+ NULL
+ },
#endif
#ifdef HAVE_HW_MOTECH_LPS_30X
(DRVS) {&motech_lps_301_driver_info, NULL},
(DRVS) {
&norma_dmm_driver_info,
&siemens_b102x_driver_info,
- NULL},
+ NULL
+ },
#endif
#ifdef HAVE_HW_OPENBENCH_LOGIC_SNIFFER
(DRVS) {&ols_driver_info, NULL},
&voltcraft_vc960_driver_info,
&tenma_72_7745_driver_info,
&tenma_72_7750_driver_info,
- NULL},
+ NULL
+ },
#endif
#ifdef HAVE_HW_UNI_T_UT32X
(DRVS) {&uni_t_ut32x_driver_info, NULL},
NULL,
};
/** @endcond */
-
/* Driver-specific API function wrappers */
#define HW_INIT(X) \
static int init_##X(struct sr_dev_driver *d, \
- struct sr_context *sr_ctx) { \
- (void) d; return init(sr_ctx, X); }
+ struct sr_context *sr_ctx) { (void)d; return init(sr_ctx, X); }
#define HW_CLEANUP(X) \
static int cleanup_##X(const struct sr_dev_driver *d) { \
- (void) d; return cleanup(X); }
+ (void)d; return cleanup(X); }
#define HW_SCAN(X) \
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) \
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) \
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) \
static int dev_acquisition_start_##X(const struct sr_dev_inst *sdi, \
void *cb_data) { return dev_acquisition_start(sdi, cb_data, X); }
(void)fd;
(void)revents;
- (void)cb_data;
- drvc = (struct drv_context *) cb_data;
+ drvc = (struct drv_context *)cb_data;
tv.tv_sec = tv.tv_usec = 0;
libusb_handle_events_timeout(drvc->sr_ctx->libusb_ctx, &tv);
* Need to implement device-specific lists.
*/
-/** Init driver. */
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
{
return std_init(sr_ctx, di, LOG_PREFIX);
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)
{
return NULL;
}
-/** Driver device list function */
static GSList *dev_list(const struct sr_dev_driver *di)
{
return ((struct drv_context *)(di->priv))->instances;
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,
const struct sr_channel_group *cg)
{
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,
const struct sr_channel_group *cg)
{
/* Driver-specific API function wrappers */
#define HW_INIT(X) \
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) \
static int cleanup_##X(const struct sr_dev_driver *di) { \
- (void) di; return cleanup(X); }
+ (void)di; return cleanup(X); }
#define HW_SCAN(X) \
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) \
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) \
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) \
static int config_list_##X(uint32_t key, GVariant **data, \
const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { \
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;
GSList *l, *devices;
const char *conn, *serialcomm;
size_t len;
uint8_t buf[128];
+ dmm = (struct dmm_info *)di;
+
conn = serialcomm = NULL;
for (l = options; l; l = l->next) {
src = l->data;
static void handle_packet(const uint8_t *buf, struct sr_dev_inst *sdi,
void *info)
{
- struct dmm_info *dmm = (struct dmm_info *) sdi->driver;
+ struct dmm_info *dmm;
float floatval;
struct sr_datafeed_packet packet;
struct sr_datafeed_analog analog;
struct dev_context *devc;
+ dmm = (struct dmm_info *)sdi->driver;
+
log_dmm_packet(buf);
devc = sdi->priv;
/** Request packet, if required. */
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 sr_serial_dev_inst *serial;
int ret;
+ dmm = (struct dmm_info *)sdi->driver;
+
if (!dmm->packet_request)
return SR_OK;
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;
int len, i, offset = 0;
struct sr_serial_dev_inst *serial;
+ dmm = (struct dmm_info *)sdi->driver;
+
devc = sdi->priv;
serial = sdi->conn;
if (!(devc = sdi->priv))
return TRUE;
- dmm = (struct dmm_info *) sdi->driver;
+ dmm = (struct dmm_info *)sdi->driver;
if (revents == G_IO_IN) {
/* Serial data arrived. */
/* Driver-specific API function wrappers */
#define HW_INIT(X) \
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) \
static int cleanup_##X(const struct sr_dev_driver *di) { \
- (void) di; return cleanup(X); }
+ (void)di; return cleanup(X); }
#define HW_SCAN(X) \
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) \
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) \
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) \
static int dev_acquisition_start_##X(const struct sr_dev_inst *sdi, \
void *cb_data) { return dev_acquisition_start(sdi, cb_data, X); }
struct sr_dev_driver ***lists, **drivers;
GArray *array;
- if (!combined_list) {
- array = g_array_new(TRUE, FALSE, sizeof(struct sr_dev_driver *));
- for (lists = drivers_lists; *lists; lists++)
- for (drivers = *lists; *drivers; drivers++)
- g_array_append_val(array, *drivers);
- combined_list = (struct sr_dev_driver **) array->data;
- g_array_free(array, FALSE);
- }
+ if (combined_list)
+ return combined_list;
+
+ array = g_array_new(TRUE, FALSE, sizeof(struct sr_dev_driver *));
+ for (lists = drivers_lists; *lists; lists++)
+ for (drivers = *lists; *drivers; drivers++)
+ g_array_append_val(array, *drivers);
+ combined_list = (struct sr_dev_driver **)array->data;
+ g_array_free(array, FALSE);
return combined_list;
}