Skip to content

Commit

Permalink
ice9-bluetooth-sniffer: manually apply #40 and patch usrp serial pars…
Browse files Browse the repository at this point in the history
…ing function to work properly
  • Loading branch information
mrene committed Aug 10, 2024
1 parent 5bef463 commit 4d973bc
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 7 deletions.
8 changes: 1 addition & 7 deletions pkgs/default/ice9-bluetooth-sniffer/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@
, lld ? null
}:

let
pr-40-usrp-data-format = fetchurl {
url = "https://patch-diff.githubusercontent.com/raw/mikeryan/ice9-bluetooth-sniffer/pull/40.patch";
hash = "sha256-QeAsI1YFz4krB0yPNZqxPyspCqhawHNrUCBOo93bF78=";
};
in
stdenv.mkDerivation {
pname = "ice9-bluetooth-sniffer";
version = "unstable-2023-10-04";
Expand All @@ -32,7 +26,7 @@ stdenv.mkDerivation {
};

patches = [
pr-40-usrp-data-format
./usrp-fixes.patch
];

cmakeFlags = lib.optional stdenv.isDarwin (lib.cmakeFeature "CMAKE_EXE_LINKER_FLAGS" "-fuse-ld=lld");
Expand Down
33 changes: 33 additions & 0 deletions pkgs/default/ice9-bluetooth-sniffer/usrp-fixes.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
diff --git a/usrp.c b/usrp.c
index 59a2fed..bc10fa7 100644
--- a/usrp.c
+++ b/usrp.c
@@ -6,7 +6,7 @@
#include <signal.h>
#include <stdio.h>
#include <string.h>
-
+#include <complex.h>
#include <uhd.h>

#include "sdr.h"
@@ -114,7 +114,7 @@ char *usrp_get_serial(char *name) {
char *dash;
if (strncmp(name, "usrp-", 5) != 0)
return NULL;
- dash = strchr(name, '-');
+ dash = strrchr(name, '-');
if (dash == NULL)
return NULL;
return dash + 1; // skip the dash
@@ -156,8 +156,8 @@ void *usrp_stream_thread(void *arg) {
void *buf;
uhd_rx_metadata_error_code_t error_code;
uhd_stream_args_t stream_args = {
- .cpu_format = "fc32",
- .otw_format = "sc16",
+ .cpu_format = "sc8",
+ .otw_format = "sc8",
.args = "",
.channel_list = &channel,
.n_channels = 1

0 comments on commit 4d973bc

Please sign in to comment.