[aravis] gv_device: try harder to get the control register in heartbeat thread.
- From: Emmanuel Pacaud <emmanuel src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [aravis] gv_device: try harder to get the control register in heartbeat thread.
- Date: Wed, 6 Jul 2011 20:23:21 +0000 (UTC)
commit 3bcaf2ed9b7aa4bcde31311ec645fc7f5deabd1a
Author: Emmanuel Pacaud <emmanuel gnome org>
Date: Wed Jul 6 22:21:17 2011 +0200
gv_device: try harder to get the control register in heartbeat thread.
Now control is delcared lost when we actually have the return value
of the control register read command. This improves the reliability
of the connection on crappy links, like wifi.
docs/reference/aravis/aravis-sections.txt | 1 +
src/arvgvdevice.c | 12 ++++++++++--
src/arvgvdevice.h | 1 +
3 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/docs/reference/aravis/aravis-sections.txt b/docs/reference/aravis/aravis-sections.txt
index 4b5dbb6..cb56f92 100644
--- a/docs/reference/aravis/aravis-sections.txt
+++ b/docs/reference/aravis/aravis-sections.txt
@@ -430,6 +430,7 @@ ARV_GV_DEVICE_GET_CLASS
ARV_GV_DEVICE_GVCP_N_RETRIES_DEFAULT
ARV_GV_DEVICE_GVCP_TIMEOUT_MS_DEFAULT
ARV_GV_DEVICE_GVSP_PACKET_SIZE_DEFAULT
+ARV_GV_DEVICE_HEARTBEAT_RETRY_DELAY_US
ARV_GV_DEVICE_BUFFER_SIZE
ArvGvDeviceClass
ArvGvDevicePrivate
diff --git a/src/arvgvdevice.c b/src/arvgvdevice.c
index e74325f..2942749 100644
--- a/src/arvgvdevice.c
+++ b/src/arvgvdevice.c
@@ -348,13 +348,21 @@ arv_gv_device_heartbeat_thread (void *data)
g_usleep (thread_data->period_us);
if (io_data->is_controller) {
+ guint counter = 1;
/* TODO: Instead of reading the control register, Pylon does write the heartbeat
* timeout value, which is interresting, as doing this we could get an error
* ack packet which will indicate we lost the control access. */
- _read_register (io_data, ARV_GVBS_CONTROL_CHANNEL_PRIVILEGE_OFFSET, &value);
- arv_log_device ("[GvDevice::Heartbeat] (%d)", value);
+ while (!_read_register (io_data, ARV_GVBS_CONTROL_CHANNEL_PRIVILEGE_OFFSET, &value)) {
+ g_usleep (ARV_GV_DEVICE_HEARTBEAT_RETRY_DELAY_US);
+ counter++;
+ }
+
+ arv_log_device ("[GvDevice::Heartbeat] Ack value = %d", value);
+
+ if (counter > 1)
+ arv_log_device ("[GvDevice::Heartbeat] Tried %u times", counter);
if ((value & (ARV_GVBS_CONTROL_CHANNEL_PRIVILEGE_CONTROL |
ARV_GVBS_CONTROL_CHANNEL_PRIVILEGE_EXCLUSIVE)) == 0) {
diff --git a/src/arvgvdevice.h b/src/arvgvdevice.h
index 190af79..36a9978 100644
--- a/src/arvgvdevice.h
+++ b/src/arvgvdevice.h
@@ -31,6 +31,7 @@ G_BEGIN_DECLS
#define ARV_GV_DEVICE_GVCP_N_RETRIES_DEFAULT 5
#define ARV_GV_DEVICE_GVCP_TIMEOUT_MS_DEFAULT 500
+#define ARV_GV_DEVICE_HEARTBEAT_RETRY_DELAY_US 10000
#define ARV_GV_DEVICE_GVSP_PACKET_SIZE_DEFAULT 1500
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]