From 4cc2d1e450a1c2eddcbb129d1a8101ae6c59a96f Mon Sep 17 00:00:00 2001
From: Ezekiel Dohmen <ezekiel.dohmen@ligo.org>
Date: Mon, 4 Apr 2022 14:32:32 -0700
Subject: [PATCH] Fixing bad error check, and fixing module symvers path

---
 src/epics/util/Makefile.kernel             | 4 ++--
 src/epics/util/lib/createKernelMakefile.pm | 5 +++--
 src/fe/dolphin.c                           | 2 +-
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/epics/util/Makefile.kernel b/src/epics/util/Makefile.kernel
index 946ae8f6e..62ed34c58 100644
--- a/src/epics/util/Makefile.kernel
+++ b/src/epics/util/Makefile.kernel
@@ -71,9 +71,9 @@ IOP_EXTRA_OBJ += src/include/drv/ligoPcieTiming.o
 IOP_EXTRA_OBJ += src/include/drv/plx_9056.o
 IOP_EXTRA_OBJ += src/include/drv/spectracomGPS.o
 
-ifdef DOLPHIN_TEST
+ifdef BUILD_WITH_DOLPHIN
 IOP_EXTRA_OBJ += src/fe/dolphin.o
-endif #DOLPHIN_TEST
+endif #BUILD_WITH_DOLPHIN
 
 #
 # Virtual IO (VIO) / Dolphin Timing special DAC ADC functions
diff --git a/src/epics/util/lib/createKernelMakefile.pm b/src/epics/util/lib/createKernelMakefile.pm
index 1870a6657..212d77b01 100644
--- a/src/epics/util/lib/createKernelMakefile.pm
+++ b/src/epics/util/lib/createKernelMakefile.pm
@@ -25,7 +25,7 @@ if ($::dolphin_time_xmit > -1) {
 }
 if ($::virtualiop != 1) {
     if ($::pciNet > 0) {
-        print OUTM "DOLPHIN_TEST:=1\n";
+        print OUTM "BUILD_WITH_DOLPHIN:=1\n";
     }
 }
 
@@ -165,7 +165,8 @@ if ($::iopModel > -1) {  #************ SETUP FOR IOP ***************
         if ($::dolphinGen == 2) {
           print OUTM "#Enable use of PCIe RFM Network Gen 2\n";
           print OUTM "DISDIR = /opt/srcdis\n";
-          print OUTM "KBUILD_EXTRA_SYMBOLS += \$(DISDIR)/src/SCI_SOCKET/ksocket/LINUX/Module.symvers\n";
+          print OUTM "KERNEL_RELEASE := \$(shell uname -r)\n";
+          print OUTM "KBUILD_EXTRA_SYMBOLS += /opt/DIS/lib/modules/\$(KERNEL_RELEASE)/dis_sisci.symvers\n";
           print OUTM "EXTRA_CFLAGS += -DOS_IS_LINUX=1 -D_DIS_KERNEL_=1 -I\$(DISDIR)/src/IRM_GX/drv/src -I\$(DISDIR)/src/IRM_GX/drv/src/LINUX -I\$(DISDIR)/src/include -I\$(DISDIR)/src/include/dis -I\$(DISDIR)/src/COMMON/osif/kernel/include -I\$(DISDIR)/src/COMMON/osif/kernel/include/LINUX -DDOLPHIN_TEST=1  -DDIS_BROADCAST=0x80000000\n";
 	} else {
           print OUTM "#Enable use of PCIe RFM Network Gen 1\n";
diff --git a/src/fe/dolphin.c b/src/fe/dolphin.c
index 0c1e01b80..101ada5e8 100644
--- a/src/fe/dolphin.c
+++ b/src/fe/dolphin.c
@@ -41,7 +41,7 @@ session_callback( session_cb_arg_t IN arg,
     /// @brief This function contains the required Dolphin callback routine. \n
     // printl("Session callback reason=%d status=%d target_node=%d\n", reason,
     // status, target_node); if (reason == SR_OK) iop_rfm_valid = 1;
-    if ( reason == SR_OK || status == SR_OK )
+    if ( reason == SR_OK || status == SR_NONE ) //TODO: This does not seem like a good check, we could pass if reason has an error and status is SR_NONE
         iop_rfm_valid = 1;
     else
         iop_rfm_valid = 0;
-- 
GitLab