gnuradio / gnuradio

GNU Radio – the Free and Open Software Radio Ecosystem
https://gnuradio.org
GNU General Public License v3.0
5.15k stars 1.92k forks source link

incompatible types for usrp_block_impl::_cmd_handler_gpio command fields? #5956

Open jaredd opened 2 years ago

jaredd commented 2 years ago

What happened?

There is a confusing type disagreement between the variable type and the return type of the pmt conversion function in gr-uhd/lib/usrp_block_impl.cc in the usrp_block_impl::_cmd_handler_gpio function.

    uint32_t value = pmt::to_double(pmt::dict_ref(gpio_attr, pmt::mp("value"), pmt::mp(0)));
    uint32_t mask = pmt::to_double(pmt::dict_ref(gpio_attr, pmt::mp("mask"), pmt::mp(0)));

I want to ask whether there was a legitimate reason for using the pmt::to_double and then implicitly casting to uint32_t? Should this not rather use pmt::to_uint64 or pmt::to_long?

System Information

OS: Ubuntu Focal (Windows 10 WSL) GR Installation Method: Source (via pybombs)

$ uname -a
Linux dell3550-denver 5.10.16.3-microsoft-standard-WSL2 #1 SMP Fri Apr 2 22:23:49 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
$ Microsoft Windows [Version 10.0.19044.1706] 

GNU Radio Version

3.10 (maint-3.10)

Specific Version

3.10.0.0

Steps to Reproduce the Problem

Observe the code. This may be contributing to errors attempting to control the GPIO via tagged tx_commands for an Ettus N210 device.

Relevant log output

No response

mbr0wn commented 2 years ago

I agree with you. There's no good reason why mask/value should be non-integer data types.