Skip to content

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

@mt-caret

Description

@mt-caret

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:

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions