Sunday, August 9, 2020

Kali Linux, HackRF One and GNURadio Not Generating Osmocom Sink

sudo apt-get install hackrf libhackrf_dev libhackrf0
sudo ldconfig
sudo hackrf_info
sudo apt-get install gnuradio gr-osmosdr gr-gsm
sudo ldconfig
sudo gnuradio-companion

The following construct kept generating errors in the Python code that alternated among gain_mode0, irq_balance0 or dc_offset NOT FOUND.  I installed GNURadio with sudo apt-get install gnuradio gr-osmsdr gr-gsm.

Mind you that Osmocom source generated okay but not Osmocom Sink.  After repeatedly failing to build gr-osmosdr from source, I went directly to the file "/usr/share/gnuradio/grc/blocks/osmosdr_sink.block.yml" and removed all the code between:

"make: |
    osmosdr.sink(
        args="numchan=" + str(${nchan}) + " " + ${args}
    )"

AND

"documentation: |-
  The osmocom sink block:"

Then I put back only the following lines:

self.${id}.set_sample_rate(${sample_rate})
    % if context.get('nchan')() > 0:
    self.${id}.set_center_freq(${freq0}, 0)
    self.${id}.set_freq_corr(${corr0}, 0)
    self.${id}.set_gain(${gain0}, 0)
    self.${id}.set_if_gain(${if_gain0}, 0)
    self.${id}.set_bb_gain(${bb_gain0}, 0)
    self.${id}.set_antenna(${ant0}, 0)
    self.${id}.set_bandwidth(${bw0}, 0)
    % endif
  callbacks:
    - set_sample_rate(${sample_rate})
    - set_center_freq(${freq0}, 0)
    - set_freq_corr(${corr0}, 0)
    - set_gain(${gain0}, 0)
    - set_if_gain(${if_gain0}, 0)
    - set_bb_gain(${bb_gain0}, 0)
    - set_antenna(${ant0}, 0)
    - set_bandwidth(${bw0}, 0) 

And I set defaults in "/usr/share/gnuradio/grc/blocks/osmosdr_sink.block.yaml" to what I would normally use.

Now this construct interacts with a Harbor Breeze ceiling fan using a file that contains the captured signal between the remote and the fan.  

Oh joy.

 

2 comments:

  1. on Kali Linux after trying [sudo apt-get install gnuradio gr-osmosdr gr-gsm] I get an error message: "E: unable to locate package gr-osmodsr" -- just figured out what's wrong by typing this: I spelled it wrong. ITS "sdr" not "dsr"

    Always check spelling.

    Thanks for the tutorial!!!

    ReplyDelete
  2. Can't install libhackrf_dev? unable to locate package libhackrf_dev? it's actually spelled "libhackrf-dev"

    use [ sudo apt-get install hackrf libhackrf-dev libhackrf0 ]

    ReplyDelete