{"id":22881305,"url":"https://github.com/gvozdevleonid/python_hackrf","last_synced_at":"2025-05-08T00:53:14.134Z","repository":{"id":197585784,"uuid":"698925394","full_name":"GvozdevLeonid/python_hackrf","owner":"GvozdevLeonid","description":"This is a Cyhton wrapper for hackrf. It includes both libhackrf and hackrf-tools. It can also work on Android using buildozer installer.","archived":false,"fork":false,"pushed_at":"2025-05-02T16:11:23.000Z","size":739,"stargazers_count":15,"open_issues_count":2,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-08T00:53:05.596Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Cython","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GvozdevLeonid.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-10-01T12:05:04.000Z","updated_at":"2025-05-04T22:09:15.000Z","dependencies_parsed_at":"2023-11-28T11:43:28.075Z","dependency_job_id":"d579a1f3-b4bf-4b7b-bfd6-64fe71aecaa7","html_url":"https://github.com/GvozdevLeonid/python_hackrf","commit_stats":null,"previous_names":["gvozdevleonid/python_hackrf"],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GvozdevLeonid%2Fpython_hackrf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GvozdevLeonid%2Fpython_hackrf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GvozdevLeonid%2Fpython_hackrf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GvozdevLeonid%2Fpython_hackrf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GvozdevLeonid","download_url":"https://codeload.github.com/GvozdevLeonid/python_hackrf/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252978726,"owners_count":21834914,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-13T17:32:44.819Z","updated_at":"2025-05-08T00:53:14.119Z","avatar_url":"https://github.com/GvozdevLeonid.png","language":"Cython","funding_links":[],"categories":[],"sub_categories":[],"readme":"# python_hackrf\n\npython_hackrf is a cython wrapper for [hackrf](https://github.com/greatscottgadgets/hackrf).\n\nBefore installing python_hackrf library, you must have hackrf host software installed. Because this library uses dynamic linking with an existing library file.\n\nYou can install this library using\n```\npip install git+https://github.com/GvozdevLeonid/python_hackrf.git\n```\n\nIf your hackrf files are in non-standard paths and during installation the python_hackrf cannot find hackrf.h or the library file, you can specify the paths via environment variables\n```\nexport PYTHON_HACKRF_CFLAGS=path_to_hackrf.h\nexport PYTHON_HACKRF_LDFLAGS=path_to_hackrf.(so, dylib, dll)\n```\n\n## Requirements:\n* Cython==0.29.37\n* Numpy\u003e=2.2.1\n* Scipy (optional, for faster work)\n* pyFFTW (optional, for faster work)\n* pyjnius and android (only for android)\n\n\n## Scope:\nAll functions from libhackrf are ported. On Android, connection to hackrf and obtaining a list of devices are changed.\n\n#### hackrf_tools\n* hackrf_info.c (Implemented)\n* hackrf_operacake.c (Implemented)\n* hackrf_sweep.c (Implemented)\n* hackrf_transfer.c (Implemented)\n* hackrf_clock.c (Will not be implemented)\n* hackrf_cpldjtag.c (Will not be implemented)\n* hackrf_debug.c (Will not be implemented)\n* hackrf_spiflash.c (Will not be implemented and features will not be ported)\n\n## Usage\n```\nusage: python_hackrf [-h] {info, sweep, operacake, transfer} ...\n\npython_hackrf is a Python wrapper for libhackrf and hackrf-tools.\n\noptions:\n  -h, --help            show this help message and exit\n\nAvailable commands:\n  {info,operacake,sweep,transfer}\n    info                Read device information from HackRF such as serial number and firmware version.\n    operacake           Specify either list, mode, or GPIO test option.\n    sweep               Command-line spectrum analyzer.\n    transfer            Send and receive signals using HackRF. Input/output files consist of complex64 quadrature samples.\n```\n##### python_hackrf info\n```\nusage: python_hackrf info [-h] [-f] [-s]\n\noptions:\n  -h, --help            show this help message and exit\n  -f, --full            show info like in hackrf_info\n  -s, --serial_numbers  show only founded serial_numbers\n```\n##### python_hackrf sweep\n```\nusage: python_hackrf sweep [-h] [-d] [-a] [-f] [-p] [-l] [-g] [-w] [-1] [-N] [-B] [-S] [-s] [-b] [-r]\n\noptions:\n  -h, --help  show this help message and exit\n  -d          serial number of desired HackRF\n  -a          RX RF amplifier. If specified = Enable\n  -f          freq_min:freq_max. minimum and maximum frequencies in MHz start:stop or start1:stop1,start2:stop2 (MAX_SWEEP_RANGES = 10)\n  -p          antenna port power. If specified = Enable\n  -l          RX LNA (IF) gain, 0 - 40dB, 8dB steps\n  -g          RX VGA (baseband) gain, 0 - 62dB, 2dB steps\n  -w          FFT bin width (frequency resolution) in Hz, 245-5000000 Depends on sample rate min= sample rate * 1e6 / 8180, max = sample_rate\n              * 1e6 / 4\n  -1          one shot mode. If specified = Enable\n  -N          number of sweeps to perform\n  -B          binary output. If specified = Enable\n  -S          sweep style (\"L\" - LINEAR, \"I\" - INTERLEAVED). Default is INTERLEAVED\n  -s          sample rate in MHz (2, 4, 6, 8, 10, 12, 14, 16, 18, 20). Default is 20\n  -b          baseband filter bandwidth in MHz (1.75, 2.5, 3.5, 5.0, 5.5, 6.0, 7.0, 8.0, 9.0, 10.0, 12.0, 14.0, 15.0 20.0, 24.0, 28.0). Default .75 * sample rate\n  -r          \u003cfilename\u003e output file\n```\n##### python_hackrf operacake\n```\nusage: python_hackrf operacake [-h] [-d] [-o] [-m] [-a] [-b] [-f] [-t] [-w] [-l] [-g]\n\noptions:\n  -h, --help       show this help message and exit\n  -d               serial number of desired HackRF\n  -o , --address   specify a particular Opera Cake by address. Default is 0\n  -m , --mode      specify switching mode [options: manual, frequency, time]\n  -a               set port connected to port A0\n  -b               set port connected to port B0\n  -f               \u003cport:min:max\u003e or \u003cport:min:max\u003e,\u003cport:min:max\u003e automatically assign \u003cport\u003e for range \u003cmin:max\u003e in MHz.\n  -t               \u003cport:dwell\u003e or \u003cport:dwell\u003e,\u003cport:dwell\u003e in time mode, dwell on \u003cport\u003e for \u003cdwell\u003e samples. Specify only \u003cport\u003e to use the default\n                   dwell time (with -w).\n  -w               set default dwell time in samples for time mode\n  -l, --list       list available Opera Cake boards\n  -g, --gpio_test  test GPIO functionality of an Opera Cake\n```\n##### python_hackrf transfer\nBe careful pyhackrf_transfer saves data in complex64 format!\n```\nusage: python_hackrf transfer [-h] [-d] [-r] [-t] [-f] [-i] [-o] [-m] [-a] [-p] [-l] [-g] [-x] [-s] [-N] [-R] -[b] [-H]\n\noptions:\n  -d                  serial number of desired HackRF\n  -r                  \u003cfilename\u003e receive data into file (use \"-\" for stdout)\n  -t                  \u003cfilename\u003e transmit data from file (use \"-\" for stdout)\n  -f, --freq_hz       frequency in Hz (0MHz to 7250MHz supported). Default is 900MHz\n  -i, --i_freq_hz     intermediate frequency in Hz (2000MHz to 3000MHz supported)\n  -o, --lo_freq_hz    front-end local oscillator frequency in Hz (84MHz to 5400MHz supported)\n  -m, --image_reject  image rejection filter selection (bypass, low, high)\n  -a                  RX RF amplifier. If specified = Enable\n  -p                  antenna port power. If specified = Enable\n  -l                  RX LNA (IF) gain, 0 - 40dB, 8dB steps\n  -g                  RX VGA (baseband) gain, 0 - 62dB, 2dB steps\n  -x                  TX VGA (IF) gain, 0 - 47dB, 1dB steps\n  -s                  sample rate in MHz (2, 4, 6, 8, 10, 12, 14, 16, 18, 20). Default is 10\n  -N                  number of samples to transfer (default is unlimited)\n  -R                  repeat TX mode. Fefault is off\n  -b                  baseband filter bandwidth in MHz (1.75, 2.5, 3.5, 5.0, 5.5, 6.0, 7.0, 8.0, 9.0, 10.0, 12.0, 14.0, 15.0 20.0, 24.0, 28.0). Default .75 * sample rate\n  -H                  synchronize RX/TX to external trigger input\n```\n## Android\nThis library can work on android. To do this, go to the android directory and download 3 recipes for [p4a](https://github.com/kivy/python-for-android).\n\nbuildozer.spec\n```\nrequirements = python3,android,pyjnius,numpy,libusb,libhackrf,python_hackrf\np4a.local_recipes = path_to_pythonforandroidrecipes_folder\n```\n\n#### Your recipes folder should contain at least the following files:\n```\npythonforandroidrecipes/\n    __init__.py\n    libusb/\n        __init__.py\n    python_hackrf/\n        __init__.py\n    libhackrf/\n        __init__.py\n        hackrf_android.patch\n        jni/\n            Android.mk\n            Application.mk\n            libhackrf.mk\n```\n\n\n## Examples\nYou can see a basic example of working with python_hackrf in [this](https://pysdr.org/content/hackrf.html) tutorial.\n\nPlease use the original hackrf documentation\n\n\n## Notes\nFor pyhackrf_transfer, FileBuffer (utils module) has been implemented, which will allow you to more conveniently receive and send iq data from sdr.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgvozdevleonid%2Fpython_hackrf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgvozdevleonid%2Fpython_hackrf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgvozdevleonid%2Fpython_hackrf/lists"}