jcrona / gr-nfc

GNURadio blocks allowing decode NFC transactions
GNU General Public License v3.0
37 stars 15 forks source link

upgrade OOT to 3.8 #6

Open t812206236 opened 3 years ago

t812206236 commented 3 years ago

@jcrona

I redo this upgrade and avoid unnecessary changes,The instructions I did below:

gr_modtool newmod nfc

cjq@cjq-Latitude-5288:~/prefix-3.8/src/gr-nfc$ gr_modtool add modified_miller_decoder
GNU Radio module name identified: nfc
('sink', 'source', 'sync', 'decimator', 'interpolator', 'general', 'tagged_stream', 'hier', 'noblock')
Enter block type: general
Language (python/cpp): cpp
Language: C++
Block/code identifier: modified_miller_decoder
Please specify the copyright holder: 
Enter valid argument list, including default arguments: 
Add Python QA code? [Y/n] 
Add C++ QA code? [y/N] 
Adding file 'lib/modified_miller_decoder_impl.h'...
Adding file 'lib/modified_miller_decoder_impl.cc'...
Adding file 'include/nfc/modified_miller_decoder.h'...
Editing swig/nfc_swig.i...
Adding file 'python/qa_modified_miller_decoder.py'...
Editing python/CMakeLists.txt...
Adding file 'grc/nfc_modified_miller_decoder.block.yml'...
Editing grc/CMakeLists.txt...

cd gr-nfc/
gr_modtool add modified_miller_decoder
cd lib/

# overwrite modified_miller_decoder_impl.cc  modified_miller_decoder_impl.h and update modified_miller_decoder.h

cd ..
mkdir build
cd build/

# I use pybombs, so my installation directory is /home/cjq/prefix-3.8/
cmake -DCMAKE_INSTALL_PREFIX=/home/cjq/prefix-3.8/ ../
make
cd ..
gr_modtool makeyaml modified_miller_decoder # auto generate block in yaml format

# copy all files except LICENSE, MANIFEST.md, README.md

For related tutorials, please refer to https://wiki.gnuradio.org/index.php/OutOfTreeModules.

The only problem is that this package does not implement the test, as if it was not implemented. In addition, it is not tested whether nfc is executed according to its logic. At present, it can only be compiled and run, and the block nfc_modified_miller_decoder can be seen in gr3.8, but I think there should be no problem. After all, I did not change the source code.

Signed-off-by: cjq 812206236@qq.com

t812206236 commented 3 years ago

Also, you will see a lot of changes, but these changes are automatically generated by gr_modtool, the new oot3.8 seems to have changed a lot of things.

KimlongSeng commented 2 years ago

I can't seem to get it to work now. "make" is having error with theses lines of code:

  1. "<+OTYPE+> out = (<+OTYPE+> )"

  2. r ::io_signature::make(<+MIN_IN+>, <+MAX_IN+>, sizeof(<+ITYPE+>)),

  3. " gr::io_signature::make(<+MIN_IN+>, <+MAX_IN+>, sizeof(<+ITYPE+>)) output_items[0];"

  4. gr::io_signature::make(<+MIN_OUT+>, <+MAX_OUT+>, sizeof(<+OTYPE+>)))

  5. const <+ITYPE+> in = (const <+ITYPE+> ) input_items[0];

t812206236 commented 2 years ago

@KimlongSeng I don't know why you can't compile, but I want to say that some libraries used by gnuradio's series of things are not compatible with the latest libraries, so they made a thing called pybombs. If you don't use pybombs, you may not have a problem, but once there is a problem, you don't know whose problem it is, Therefore, it is recommended to use pybombs as your gnuradio running environment, so that you can do relevant development at ease PyBOMBS ? The What, the How and the Why

KimlongSeng commented 2 years ago

Update: I manage to get the miller_decoder block show up with getting an error in the gnuradio, and fix the nfc lib error by add path to python sys manually.

My last error is showing:

Generating: '/home/rlab-dell-2/Documents/GNU radio/top_block.py'

Executing: /usr/bin/python3 -u /home/rlab-dell-2/Documents/GNU radio/top_block.py

Warning: failed to XInitThreads() gr-osmosdr 0.2.0.0 (0.2.0) gnuradio 3.8.1.0 built-in source types: file osmosdr fcd rtl rtl_tcp uhd miri hackrf bladerf rfspace airspy airspyhf soapy redpitaya freesrp Using device #0 Realtek RTL2838UHIDIR SN: 00000001 Found Rafael Micro R820T tuner [R82XX] PLL not locked! Enabled direct sampling mode, input 2 Exact sample rate is: 2000000.052982 Hz Traceback (most recent call last): File "/home/rlab-dell-2/Documents/GNU radio/top_block.py", line 172, in main() File "/home/rlab-dell-2/Documents/GNU radio/top_block.py", line 150, in main tb = top_block_cls() File "/home/rlab-dell-2/Documents/GNU radio/top_block.py", line 93, in init self.nfc_modified_miller_decoder_0 = nfc.modified_miller_decoder(samp_rate) AttributeError: module 'nfc' has no attribute 'modified_miller_decoder'

Done (return code 1)

@t812206236 Have you ever encounter this error : module 'nfc' has no attribute 'modified_miller_decoder'. it is from the auto generate gnu-radio python(graph flow Screenshot from 2021-10-18 10-23-48 )

t812206236 commented 2 years ago

@KimlongSeng I just tried and didn't encounter this problem

KimlongSeng commented 2 years ago

I see it is probably something to do with importing modual from python2+ to python 3+. Thank you for the reply :) @t812206236

t812206236 commented 2 years ago

@KimlongSeng I really, really suggest you use pybombs,The following is its built-in script for setting up the environment

cjq@cjq-Latitude-5288:~/prefix-3.8$ cat ./setup_env.sh 
# WARNING: This file is auto-generated by pybombs, any manual changes to it may be overwritten!
export PATH="/home/cjq/prefix-3.8/bin:$PATH"
export PYTHONPATH="/home/cjq/prefix-3.8/lib/python3/site-packages:/home/cjq/prefix-3.8/lib/python3/dist-packages:/home/cjq/prefix-3.8/lib/python3.8/site-packages:/home/cjq/prefix-3.8/lib/python3.8/dist-packages:/home/cjq/prefix-3.8/lib64/python3/site-packages:/home/cjq/prefix-3.8/lib64/python3/dist-packages:/home/cjq/prefix-3.8/lib64/python3.8/site-packages:/home/cjq/prefix-3.8/lib64/python3.8/dist-packages:$PYTHONPATH"
export LD_LIBRARY_PATH="/home/cjq/prefix-3.8/lib:/home/cjq/prefix-3.8/lib64/:$LD_LIBRARY_PATH"
export LIBRARY_PATH="/home/cjq/prefix-3.8/lib:/home/cjq/prefix-3.8/lib64/:$LIBRARY_PATH"
export PKG_CONFIG_PATH="/home/cjq/prefix-3.8/lib/pkgconfig:/home/cjq/prefix-3.8/lib64/pkgconfig:$PKG_CONFIG_PATH"
export PYBOMBS_PREFIX="/home/cjq/prefix-3.8"
# If we're in a Python virtualenv, activate that
if [ -r /home/cjq/prefix-3.8/bin/activate ]; then
    source /home/cjq/prefix-3.8/bin/activate
fi
cjq@cjq-Latitude-5288:~/prefix-3.8$ 

Did you see it? It has helped you select the tools you need

KimlongSeng commented 2 years ago

I reinstall gnu radio with pybomb, and it does not recognize the rtlsdr_source at first , but after installing rtl-sdr., it still show "AttributeError: module 'nfc' has no attribute 'modified_miller_decoder'" when i try to run it.

$ cat ./setup_env.sh /# WARNING: This file is auto-generated by pybombs, any manual changes to it may be overwritten! export PATH="/home/rlab-dell-2/prefix-3.8/bin:$PATH" export PYTHONPATH="/home/rlab-dell-2/prefix-3.8/lib/python3/site-packages:/home/rlab-dell-2/prefix-3.8/lib/python3/dist-packages:/home/rlab-dell-2/prefix-3.8/lib/python3.8/site-packages:/home/rlab-dell-2/prefix-3.8/lib/python3.8/dist-packages:/home/rlab-dell-2/prefix-3.8/lib64/python3/site-packages:/home/rlab-dell-2/prefix-3.8/lib64/python3/dist-packages:/home/rlab-dell-2/prefix-3.8/lib64/python3.8/site-packages:/home/rlab-dell-2/prefix-3.8/lib64/python3.8/dist-packages:$PYTHONPATH" export LD_LIBRARY_PATH="/home/rlab-dell-2/prefix-3.8/lib:/home/rlab-dell-2/prefix-3.8/lib64/:$LD_LIBRARY_PATH" export LIBRARY_PATH="/home/rlab-dell-2/prefix-3.8/lib:/home/rlab-dell-2/prefix-3.8/lib64/:$LIBRARY_PATH" export PKG_CONFIG_PATH="/home/rlab-dell-2/prefix-3.8/lib/pkgconfig:/home/rlab-dell-2/prefix-3.8/lib64/pkgconfig:$PKG_CONFIG_PATH" export PYBOMBS_PREFIX="/home/rlab-dell-2/prefix-3.8" /# If we're in a Python virtualenv, activate that if [ -r /home/rlab-dell-2/prefix-3.8/bin/activate ]; then source /home/rlab-dell-2/prefix-3.8/bin/activate