X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fbaylibre-acme%2Fapi.c;h=caafc7037fd65408eae48c559e491554653ff8a7;hb=1c47e0da8f2571bc34dbdc368c3c1f55318c3aa0;hp=6ec4d7492ddb7d5d5be7e8c41111dc172ae1c825;hpb=a0648b1a12699429d8a70b8eeb05942885bd32b3;p=libsigrok.git
diff --git a/src/hardware/baylibre-acme/api.c b/src/hardware/baylibre-acme/api.c
index 6ec4d749..caafc703 100644
--- a/src/hardware/baylibre-acme/api.c
+++ b/src/hardware/baylibre-acme/api.c
@@ -17,6 +17,7 @@
* along with this program. If not, see .
*/
+#include
#include "protocol.h"
#include
#include
@@ -68,7 +69,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
(void)options;
- drvc = di->priv;
+ drvc = di->context;
devices = NULL;
devc = g_malloc0(sizeof(struct dev_context));
@@ -143,7 +144,7 @@ err_out:
static GSList *dev_list(const struct sr_dev_driver *di)
{
- return ((struct drv_context *)(di->priv))->instances;
+ return ((struct drv_context *)(di->context))->instances;
}
static int dev_clear(const struct sr_dev_driver *di)
@@ -374,7 +375,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
}
tspec.it_interval.tv_sec = 0;
- tspec.it_interval.tv_nsec = (1000000000L / devc->samplerate);
+ tspec.it_interval.tv_nsec = SR_HZ_TO_NS(devc->samplerate);
tspec.it_value = tspec.it_interval;
if (timerfd_settime(devc->timer_fd, 0, &tspec, NULL)) {
@@ -391,7 +392,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
sr_session_source_add_channel(sdi->session, devc->channel,
G_IO_IN | G_IO_ERR, 1000, bl_acme_receive_data, (void *)sdi);
- /* Send header packet to the session bus. */
std_session_send_df_header(sdi, LOG_PREFIX);
devc->start_time = g_get_monotonic_time();
@@ -400,7 +400,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
{
- struct sr_datafeed_packet packet;
struct dev_context *devc;
(void)cb_data;
@@ -415,14 +414,11 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
g_io_channel_shutdown(devc->channel, FALSE, NULL);
g_io_channel_unref(devc->channel);
devc->channel = NULL;
- close(devc->timer_fd);
- /* Send last packet. */
- packet.type = SR_DF_END;
- sr_session_send(sdi, &packet);
+ std_session_send_df_end(sdi, LOG_PREFIX);
if (devc->samples_missed > 0)
- sr_warn("%d samples missed", devc->samples_missed);
+ sr_warn("%" PRIu64 " samples missed", devc->samples_missed);
return SR_OK;
}
@@ -443,5 +439,5 @@ SR_PRIV struct sr_dev_driver baylibre_acme_driver_info = {
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
- .priv = NULL,
+ .context = NULL,
};