Skip to main content

This is a wrapper for hackrf. It includes both libhackrf and hackrf-tools

Project description

python_hackrf

python_hackrf is a cython wrapper for hackrf (https://github.com/greatscottgadgets/hackrf).

You can install this library using

pip install python_hackrf

Or assemble it manually using the following steps:

In order to build the library you need to go to the python_hackrf directory

cd python_hackrf

call

python setup.py build_ext --inplace.

If the build fails, you will need to specify the paths for the libusb library.

CFLAGS="-I/path to libusb.h /libusb-1.0" \
LDFLAGS="-L/path to libusb-1.0.so /lib" \
python setup.py build_ext --inplace

Requirements:

hackrf:

Almost all the functionality of the standard library is implemented. Some features will be added later. (operacake).

hackrf tools:

  • hackrf_clock.c (Not implemented)
  • hackrf_cpldjtag.c (Not implemented)
  • hackrf_debug.c (Not implemented. But functions for this are implemented)
  • hackrf_info.c (Implemented + additionally added output of only serial numbers)
  • hackrf_operacake.c (Not implemented and the functions are also not implemented. Will be added in the future)
  • hackrf_spiflash.c (Not implement. I won’t implement them because this is a dangerous zone)
  • hackrf_sweep.c (Implemented)
  • hackrf_transfer.c (Not implemented. Will be added in the future)

usage

usage: python -m python_hackrf [-h] {info, sweep} ...

python_hackrf is a Python wrapper for libhackrf and hackrf-tools.

options:
  -h, --help    show this help message and exit

Available commands:
  {info,sweep}
    info        Read device information from HackRF such as serial number and firmware version.
    sweep       a command-line spectrum analyzer.
usage: python -m python_hackrf info [-h] [-f] [-s]

options:
  -h, --help            show this help message and exit
  -f, --full            show info like in hackrf_info
  -s, --serial_numbers  show only founded serial_numbers
usage: python -m python_hackrf sweep [-h] [-d] [-a] [-f] [-p] [-l] [-g] [-w] [-1] [-N] [-B] [-s] [-SR] [-r]

options:
  -h, --help  show this help message and exit
  -d          serial_number. serial number of desired HackRF
  -a          amp_enable. RX RF amplifier. If specified = Enable
  -f          freq_min:freq_max. minimum and maximum frequencies in MHz srart:stop or start1:stop1,start2:stop2 (MAX_SWEEP_RANGES = 10)
  -p          antenna_enable. Antenna port power. If specified = Enable
  -l          gain_db. RX LNA (IF) gain, 0-40dB, 8dB steps
  -g          gain_db. RX VGA (baseband) gain, 0-62dB, 2dB steps
  -w          bin_width. FFT bin width (frequency resolution) in Hz, 245-5000000 Depends on sample rate min= sample rate * 1e6 / 8180, max = sample_rate * 1e6 / 4
  -1          one shot mode. If specified = Enable
  -N          num_sweeps. Number of sweeps to perform
  -B          binary output. If specified = Enable
  -s          sweep style ("L" - LINEAR, "I" - INTERLEAVED). Default is INTERLEAVED
  -SR         sample rate (2, 4, 6, 8, 10, 12, 14, 16, 18, 20). Default is 20
  -r          filename. output file

Note

This library can work on android. To do this, go to the android directory and download two recipes for p4a.

Examples

Examples will be added later.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python_hackrf-1.0.5.tar.gz (54.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

python_hackrf-1.0.5-cp311-cp311-macosx_14_0_arm64.whl (192.8 kB view details)

Uploaded CPython 3.11macOS 14.0+ ARM64

File details

Details for the file python_hackrf-1.0.5.tar.gz.

File metadata

  • Download URL: python_hackrf-1.0.5.tar.gz
  • Upload date:
  • Size: 54.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for python_hackrf-1.0.5.tar.gz
Algorithm Hash digest
SHA256 359c8125680badba02c26c4c945b774ff5707e154c84f90056972b23380c737c
MD5 26b96121903b5f0e6a61a4d8e292d62b
BLAKE2b-256 c12e38d2e704bc4db7287eea98d3e48ee00f6faa6d1ce51aa15287ef4129e889

See more details on using hashes here.

File details

Details for the file python_hackrf-1.0.5-cp311-cp311-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for python_hackrf-1.0.5-cp311-cp311-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 de46d0dfe036904587eed6ea079216e5aaba699cee6346b8f4db217b594b9366
MD5 8dbce72cfb84718a8e4573fe957792f4
BLAKE2b-256 4f55e391a92cbb9f85a6e0011ae1e964c2e673359338d4b5e0ad957e1801531b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page