Thank you!<br><br>I pulled the latest upstream master and saw your modifications. I compiled and installed gr-osmosdr and launched gnuradio - I saw your documentation update showing bias syntax. I then launched gqrx several times using hackrf=0,bias=0 and hackrf=0,bias=1 and both strings worked as expected. Low noise floor, about 22db gain when enabled. I tuned around hf/vhf/uhf and gain was good across all bands. This lna really is awesome. <br><br>BTW I used a multimeter to visually check for bias power and indeed I measured 3.00 volts at the hackrf output going into the lna when bias=1 and 0.00v when bias=0.<br><br>I didn't have a chance to check transmit bias yet. <br><br>If still not working for you maybe try loading the latest hackrf firmware. I seem to remember bias/phantom power support being a later addition to the firmware package. <br><br><br>-----Original Message-----<br><br>From: horiz0n@gmx.net<br>To: k1gto@comcast.net,osmocom-sdr@lists.osmocom.org<br>Cc: <br>Sent: 2015-05-27 18:06:14 GMT<br>Subject: Re: HackRF powered antenna support (pleeeeease :)<br><br>Brad,<br><br>calling that function does not seem to work with my hardware. Nevertheless  <br>i've reworked your original patch and applied it. Please test current  <br>master.<br><br>Best regards,<br>Dimitri<br><br>On Wed, 27 May 2015 13:36:18 +0200, BRAD <k1gto@comcast.net> wrote:<br><br>> Was the code patch below suitable to get merged upstream?<br>><br>><br>> -----Original Message-----<br>><br>> From: k1gto@comcast.net<br>> To: osmocom-sdr@lists.osmocom.org<br>> Cc:<br>> Sent: 2015-05-15 17:23:53 GMT<br>> Subject: Re: HackRF powered antenna support (pleeeeease :)<br>><br>><br>> I modified the osmosdr hackrf code to support antenna/phantom power via  <br>> a new<br>> device argument "bias=" (to match bladeRF's existing bias power syntax).  <br>> 0=disable<br>> and 1=enable. My initial testing suggests it works great, but I would  <br>> invite<br>> others to also confirm if they are able. You'll have to apply the patch  <br>> below.<br>><br>><br>> I also added a device argument to control bias power at transmit time. I  <br>> named<br>> this option differently - "bias_tx" - to avoid accidentally enabling  <br>> bias power<br>> in transmit mode when an LNA may be attached in an input amplifier  <br>> configuration.<br>> I reached out to the designer of the lna4all to find out if bias power  <br>> can be<br>> supported, from a hardware perspective, in transmit mode (hackrf output<br>> connected to lna4all input, lna4all output connected to antenna). We'll  <br>> see what<br>> he says. If so, I look forward to testing transmit mode bias power.<br>><br>><br>> Patch follows:<br>><br>><br>> $ git diff 275e6aed19b9ba8563bffd318a227a1196e1da2c  <br>> 9ca86fdcd068daf44d9dec0dd1993b22c24b02f2<br>> | cat<br>> diff --git a/lib/hackrf/hackrf_sink_c.cc b/lib/hackrf/hackrf_sink_c.cc<br>> index 00f9768..0d52c60 100644<br>> --- a/lib/hackrf/hackrf_sink_c.cc<br>> +++ b/lib/hackrf/hackrf_sink_c.cc<br>> @@ -164,6 +164,7 @@ hackrf_sink_c::hackrf_sink_c (const std::string  <br>> &args)<br>> _bandwidth(0)<br>> {<br>> int ret;<br>> + bool bias = false;<br>><br>> dict_t dict = params_to_dict(args);<br>><br>> @@ -184,6 +185,11 @@ hackrf_sink_c::hackrf_sink_c (const std::string  <br>> &args)<br>> _usage++;<br>> }<br>><br>> + // Check device args to find out if bias/phantom power is desired.<br>> + if ( dict.count("bias_tx") ) {<br>> + bias = boost::lexical_cast<bool>( dict["bias_tx"] );<br>> + }<br>> +<br>> _dev = NULL;<br>> ret = hackrf_open( &_dev );<br>> HACKRF_THROW_ON_ERROR(ret, "Failed to open HackRF device")<br>> @@ -218,6 +224,14 @@ hackrf_sink_c::hackrf_sink_c (const std::string  <br>> &args)<br>><br>> set_if_gain( 16 ); /* preset to a reasonable default (non-GRC use case)  <br>> */<br>><br>> + ret = hackrf_set_antenna_enable(_dev, (uint8_t)bias);<br>> + HACKRF_THROW_ON_ERROR( ret, "Failed to enable bias/phantom antenna  <br>> power");<br>> + if (bias==true) {<br>> + std::cerr << "Successfully enabled antenna bias/power (bias_tx=" <<  <br>> bias << ")"<br>> << std::endl;<br>> + } else {<br>> + std::cerr << "Successfully disabled antenna bias/power (bias_tx=" <<  <br>> bias <<<br>> ")" << std::endl;<br>> + }<br>> +<br>> _buf = (char *) malloc( BUF_LEN );<br>><br>> cb_init( &_cbuf, _buf_num, BUF_LEN );<br>> diff --git a/lib/hackrf/hackrf_source_c.cc  <br>> b/lib/hackrf/hackrf_source_c.cc<br>> index e3b3ea4..4ba24ec 100644<br>> --- a/lib/hackrf/hackrf_source_c.cc<br>> +++ b/lib/hackrf/hackrf_source_c.cc<br>> @@ -181,6 +181,16 @@ hackrf_source_c::hackrf_source_c (const std::string  <br>> &args)<br>> _buf[i] = (unsigned short *) malloc(_buf_len);<br>> }<br>><br>> +<br>> +// Enable bias/phantom power on the antenna port if device argument  <br>> parameter<br>> bias= is present. 1=enable, 0=disable.<br>> + if ( dict.count("bias") ) {<br>> + bool bias = boost::lexical_cast<bool>( dict["bias"] );<br>> + int ret = hackrf_set_antenna_enable(_dev, (uint8_t)bias);<br>> + HACKRF_THROW_ON_ERROR( ret, "Failed to enable bias/phantom antenna  <br>> power");<br>> + std::cerr << "Successfully set antenna power to " << bias << std::endl;<br>> + }<br>> +<br>> +<br>> // _thread = gr::thread::thread(_hackrf_wait, this);<br>><br>> ret = hackrf_start_rx( _dev, _hackrf_rx_callback, (void *)this );<br>><br>><br>><br>> From: "Brad Hein" <k1gto@comcast.net><br>> To: osmocom-sdr@lists.osmocom.org<br>> Sent: Thursday, January 22, 2015 12:03:57 PM<br>> Subject: HackRF powered antenna support (pleeeeease :)<br>><br>><br>><br>> I would like to humbly request support for hackrf antenna power in  <br>> gr-osmosdr.<br>> At runtime preferably, or at least an init string flag to control it<br>> (hackrf=0,antenna_power=1 for example). The function call seems to be  <br>> hackrf_set_antenna_enable()<br>> but it's not exposed in gr-osmosdr as far as I can tell.<br>><br>><br>> I have some dev experience (but not in C) but I'm falling short trying to<br>> understand the code and add the feature myself. If someone wants to  <br>> provide some<br>> "ELI5" guidance I'll be happy to give it another go.<br>><br>><br>> Having this feature would open up the powered antenna feature to users  <br>> of gr-osmosdr<br>> such as gnuradio, gqrx, and the list goes on (big win!)<br>><br>><br>> Reference:<br>> https://www.mail-archive.com/hackrf-dev@greatscottgadgets.com/msg00423.html<br>><br>><br>><br>> Thanks!<br>><br>> Brad<br>><br>><br>><br>><br>