summaryrefslogtreecommitdiff
path: root/README.md
blob: 94e1af1f97c60e587ec86922321fa078089cf745 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# RusTL-SDR

A pure Rust implementation of the RTL-SDR driver, for shits and giggles.

This is mostly an exercise in writing low-level driver code.

Unusable, and highly unlikely to ever become usable. But it's fun.

For real alternatives check out the original [librtlsdr](https://github.com/osmocom/rtl-sdr/) implementation or the high-level [rtlsdr_mt](https://github.com/kchmck/rtlsdr_mt.rs) Rust bindings.

## Usage

Install the crate in your `Cargo.toml`:

```toml
[dependencies]
rustl-sdr = "0.2"
```

Use in your code:

```rust
extern crate libusb;
extern crate rustl_sdr;

fn foo() {
    let ctx = libusb::Context::new().unwrap();
    rtlsdr = rustl_sdr::RtlSdr::new(&ctx);
    rtlsdr.init();
    rtlsdr.do_stuff();
}
```

## Dev

The usual:

```bash
$ cargo build
$ cargo test -- --nocapture
```

Since there isn't (?) any good USB device mocking setup, for tests to pass an RTL-SDR device must be connected.

## Design

Similarly to the original rtl-sdr driver, we use libusb via the `rusb` bindings as the main interface to issue commands to the rtl-sdr USB dongle.

## License

[GPLv3](LICENSE)