Post Go back to editing

Modifying libiio recipe

Hi , I have questions on how to effect some changes I want in libiio bbappend recipe in meta-adi zedboard.

I would like during petalinux-build for the build process to download a libiio of specific commit or to checkout that specific commit (can be through its SHA ID) then to build that and to include to the final Linux binaries. Another way can also be myself getting a local copy of libiio, checking out a specific commit of it, and specify the libiio bbappend recipe to use that local libiio during petalinux-build.  How to do that?

The context behind it is actually I was wondering why the libiio USB backend is not working in my recent 2 builds. Only iio_info -s command works in the host, and I haven't changed anything in the host side in terms of installed libiio in it. I pulled back some older petalinux images I have built around 3-4 weeks ago and they work in terms of USB backend. That 3-4 weeks ago are when I got the USB backend working c/o  but right now it won't.  The last builds that worked were during Sept 24 and Sept 30.  I'm thinking the recent libiio releases which are being downloaded by the meta-adi recipes might have some changes since then. As I've said, nothing changed in host side, my kernel has been localized since September (I don't know how it happened - maybe due to repeated builds - but it has the kernel source inside /components/yocto/workspace/sources/linux-xlnx and not inside build/ directory which I can modify and effect the changes without yocto patches) so I guess the only thing that could change is libiio. And so my goal for now is how to get libiio I'm using reverted to its earlier commits in the master, around September.



Inserted clarifications inside description.
[edited by: ubermensch at 3:05 AM (GMT -4) on 19 Oct 2021]

Top Replies

    •  Analog Employees 
    Oct 20, 2021 +1 verified
    I would like during petalinux-build for the build process to download a libiio of specific commit or to checkout that specific commit (can be through its SHA ID

    Hi,

    To checkout a specific…

Parents Reply Children
  • Hi, thanks.

    Could you try from commit ID 803d1b15 and tell me if it works?

    -Paul

  • I'll get back to you tomorrow regarding this commit ID.

    What's the date for this commit ID 803d1b15?  I can't find it in libiio's gitk.

  • I just pushed it a few minutes ago. It's the branch 'iiod-fix-usb-read-line', which has only one commit on top of the current master.

  • Hello Paul,

    I've tried it, with this libiio commit (803d1b15) being the only change I did.  Initial testing on my side shows I lost my USB backend again, similar to the previous build before I changed to commit c14a0f8b3.  IIOD can scan and somehow see my device in USB, but in-depth accesses by iio_info, iio_readdev, iio_reg fails.

    ~$ lsusb
    Bus 002 Device 004: ID 04d9:a0ac Holtek Semiconductor, Inc.
    Bus 002 Device 005: ID 1a2c:2d23 China Resource Semico Co., Ltd
    Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
    Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 008 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
    Bus 007 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 001 Device 013: ID 04b4:0008 Cypress Semiconductor Corp.
    Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
    Bus 003 Device 003: ID 2357:010c  
    Bus 003 Device 019: ID 0456:b671 Analog Devices, Inc.
    Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 006 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
    Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub


    ~$ iio_info -s
    Library version: 0.23 (git tag: 92d6a35)
    Compiled with backends: local xml ip usb serial
    Unable to create Local IIO context : No such file or directory (2)
    Available contexts:
        0: 0456:b671 (Analog Devices Inc. Generic USB IIOD), serial=00000000 [usb:3.19.0]

    ~$ iio_info -u usb:3.19.0
    Library version: 0.23 (git tag: 92d6a35)
    Compiled with backends: local xml ip usb serial
    Unable to create IIO context usb:3.19.0: Invalid argument (22)

    ~$ iio_readdev -u usb:3.19.0 -b 1024 -s 1024 iio:device0 > samples.dat
    Unable to create IIO context usb:3.19.0: Invalid argument (22)

    ~$ iio_info -S usb
    Library version: 0.23 (git tag: 92d6a35)
    Compiled with backends: local xml ip usb serial
    Available contexts:
        0: 0456:b671 (Analog Devices Inc. Generic USB IIOD), serial=00000000 [usb:3.19.0]

    ~$ iio_info -S
    Library version: 0.23 (git tag: 92d6a35)
    Compiled with backends: local xml ip usb serial
    Available contexts:
        0: 0456:b671 (Analog Devices Inc. Generic USB IIOD), serial=00000000 [usb:3.19.0]

    ~$ iio_reg -u usb:3.19.0 iio:device0 0x0
    Unable to create IIO context usb:3.19.0: Invalid argument (22)
    Segmentation fault (core dumped)

    ~$ iio_readdev -u usb:3.19.0 -b 1024 -s 1024 iio:device0 > samples.dat
    Unable to create IIO context usb:3.19.0: Invalid argument (22)

    ~$ iio_info -u usb:3.19.0
    Library version: 0.23 (git tag: 92d6a35)
    Compiled with backends: local xml ip usb serial
    Unable to create IIO context usb:3.19.0: Invalid argument (22)

  • I think I properly fixed it now. This time I tested it myself as well. The fix: iiod: fix read_line() for USB by pcercuei · Pull Request #756 · analogdevicesinc/libiio (github.com)

    The fix is commit 08e1b88.

  • Hi ,

    I just tested the iiod-fix-usb-read-line branch of libiio with the 08e1b88 commit ID in Linux.  Initial testing on my side is showing that the USB backend is working.  IIOD can scan and see my device in USB via iio_info -s, and also further access by iio_info -u usb<USB uri> is working.  iio_readdev and iio_reg are also working as they are returning data from the Zedboard unlike before.

    I also tested this in Windows and looks good too.  Zedboard gets detected as USB device in Dev Manager.  iio_info, iio_readdev and iio_reg also works in Windows.