summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Murray <scottm@ghidorah.spiteful.org>2018-05-15 08:42:33 -0400
committerScott Murray <scott.murray@konsulko.com>2018-06-05 21:16:30 -0400
commita0b0ea9312d41a6f48d3a8e92d1d12f69a714bcd (patch)
tree87c98e031615ec6d2c004c75ff0257f625d95559
parenta7d712761a612c1f1199aaf4f31ad6d567e94edf (diff)
Always enable Kingfisher support
Make Kingfisher support unconditional to move all platform detection to run-time. This fixes the issue of violating the application build workflow with the SDK. Additionally, the Kingfisher detection has been improved with an added check for the Si4689 device-tree node to differentiate from a regular M3ULCB, and the Kingfisher output has been fixed for recent BSP changes. Change-Id: I28e18a065385205aefec974079b0a9c2d31059b6 Signed-off-by: Scott Murray <scott.murray@konsulko.com>
-rw-r--r--binding/CMakeLists.txt5
-rw-r--r--binding/radio-binding.c4
-rw-r--r--binding/radio_impl_kingfisher.c13
3 files changed, 10 insertions, 12 deletions
diff --git a/binding/CMakeLists.txt b/binding/CMakeLists.txt
index d0d23ed..321022a 100644
--- a/binding/CMakeLists.txt
+++ b/binding/CMakeLists.txt
@@ -24,13 +24,10 @@ PROJECT_TARGET_ADD(radio-binding)
set(radio_SOURCES
radio-binding.c
radio_output.c
+ radio_impl_kingfisher.c
radio_impl_rtlsdr.c
rtl_fm.c
convenience/convenience.c)
- if(HAVE_KINGFISHER)
- set(radio_SOURCES ${radio_SOURCES} radio_impl_kingfisher.c)
- add_definitions(-DHAVE_KINGFISHER)
- endif()
add_library(${TARGET_NAME} MODULE ${radio_SOURCES})
diff --git a/binding/radio-binding.c b/binding/radio-binding.c
index 220701b..8efe3bd 100644
--- a/binding/radio-binding.c
+++ b/binding/radio-binding.c
@@ -29,9 +29,7 @@
#include "radio_impl.h"
#include "radio_impl_rtlsdr.h"
-#ifdef HAVE_KINGFISHER
#include "radio_impl_kingfisher.h"
-#endif
static radio_impl_ops_t *radio_impl_ops;
@@ -475,13 +473,11 @@ static int init()
// Look for RTL-SDR USB adapter
radio_impl_ops = &rtlsdr_impl_ops;
rc = radio_impl_ops->init();
-#ifdef HAVE_KINGFISHER
if(rc != 0) {
// Look for Kingfisher Si4689
radio_impl_ops = &kf_impl_ops;
rc = radio_impl_ops->init();
}
-#endif
if(rc == 0) {
printf("%s found\n", radio_impl_ops->name);
radio_impl_ops->set_frequency_callback(freq_callback, NULL);
diff --git a/binding/radio_impl_kingfisher.c b/binding/radio_impl_kingfisher.c
index 642b354..0685388 100644
--- a/binding/radio_impl_kingfisher.c
+++ b/binding/radio_impl_kingfisher.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2017 Konsulko Group
+ * Copyright (C) 2017,2018 Konsulko Group
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,6 +25,7 @@
#include "radio_impl.h"
+#define SI_NODE "/sys/firmware/devicetree/base/si468x@0/compatible"
#define SI_INIT "/usr/bin/si_init"
#define SI_CTL "/usr/bin/si_ctl"
@@ -62,13 +63,17 @@ static int kf_init(void)
{
GKeyFile* conf_file;
int conf_file_present = 0;
+ struct stat statbuf;
char *value_str;
char cmd[128];
int rc;
char *output_sink;
- struct stat statbuf;
if(present)
+ return 0;
+
+ // Check for Kingfisher SI486x devicetree node
+ if(stat(SI_NODE, &statbuf) != 0)
return -1;
// Check for Cogent's si_init script and si_ctl utility
@@ -174,8 +179,8 @@ static int kf_init(void)
// Set up loopback to output sink
output_sink = getenv("PULSE_SINK");
if(!output_sink) {
- // On non-4A, loopback to the default output sink
- output_sink = "0";
+ // On non-4A, loopback to the sink for the on-board Starter Kit M3/H3 audio
+ output_sink = "1";
}
sprintf(cmd, "pactl load-module module-loopback source=alsa_input.radio sink=%s", output_sink);
rc = system(cmd);