sweep-sdk icon indicating copy to clipboard operation
sweep-sdk copied to clipboard

sweep-ctl et al. freezes up on first run, but works fine on second run

Open mt-caret opened this issue 6 years ago • 0 comments

sweep firmware version

1.4

libsweep version + affected bindings

libsweep@HEAD (I haven't tried the others)

operating system

NixOS

Platform/Hardware Setup

Description:

I've been trying to get libsweep working on NixOS, but I've been running into a weird problem; when I plug the Sweep in and run, for example, sweep-ctl /dev/ttyUSB0 get sample_rate, the Sweep starts to spin up but the command never returns anything. However, if I Ctrl-C, then rerun the same command while the Sweep is still spinning, I get the expected output immediately (in this case, the sample rate 500). I've observed similar behavior for other commands as well as the example C and C++ programs provided along with libsweep.

I assumed that something was wrong with my OS (since it's not so popular), so I patched the Sweep visualizer and tried it; the visualizer worked perfectly.

Here's the strace output for the first and second run of sweep-ctl:

  • https://gist.github.com/mt-caret/435efc3a8e85a2902abfa643b3b7f5c6
  • https://gist.github.com/mt-caret/a2da42b7518a3b46c77cd66ba8f2ec84

Here's the Nix expression that I used for building libsweep.

let
  pkgs = import <nixpkgs> {};
in
  pkgs.stdenv.mkDerivation {
    name = "libsweep";
    src = ./.;
    buildInputs = with pkgs; [ cmake ];
  }

Installing the Nix package manager and placing a file called default.nix with the above in libsweep/, then executing nix build should create a result/ directory looking like this:

$ tree ./result
./result
├── bin
│   └── sweep-ctl
├── include
│   └── sweep
│       ├── config.h
│       ├── sweep.h
│       └── sweep.hpp
├── lib
│   ├── cmake
│   │   └── sweep
│   │       └── SweepConfig.cmake
│   ├── libsweep.so -> libsweep.so.1
│   ├── libsweep.so.1 -> libsweep.so.1.3.0
│   └── libsweep.so.1.3.0
└── share
    └── man
        └── man1
            └── sweep-ctl.1.gz

mt-caret avatar Apr 17 '18 13:04 mt-caret