Menu

#294 libjaylink fails to discover devices when network is down and J-Link S/N is specified

0.10.0
closed
nobody
None
http://openocd.zylin.com6025/
libjaylink
2021-01-25
2021-01-18
No

This issue is rather related to libjaylink library but I was unable to find any public libjaylink bug tracker so I'm posting the issue here.

libjaylink is unable to find the probe by it's serial number when all network interfaces are down/disconnected. This makes it impossible to use OpenOCD on offline machines with several JLink probes connected.

Steps to reproduce:
Put you computer offline (disconnect all Ethernet cables and turn WiFi off)
Run the following script:

source [find interface/jlink.cfg]
jlink serial <your_serial_here>
source [find target/psoc6.cfg]
init
exit

Observe the following error:

Error: Failed to send discovery message.
Error: TCP/IP device discovery failed.
Error: jaylink_discovery_scan() failed: input/output error.

I've tracked the issue down to discovery_tcp_scan function which fails on offline machines (which is OK) but this error is treated as fatal in jaylink_discovery_scan so whole device discovery fails.

Bohdan

Related

Tickets: #294

Discussion

  • Antonio Borneo

    Antonio Borneo - 2021-01-21

    On Thu, Jan 21, 2021 at 9:36 PM Marc Schink dev@zapb.de wrote:

    Hi Bohdan,

    thank you for your report. I'm aware of this issue but I don't consider
    this as bug in libjaylink. We ask libjaylink to discover TCP devices
    but there are no ethernet devices available.

    Marc,
    it's a little tricky to say who is responsible for the issue, if the
    caller (openocd) or the lib (libjaylink).
    The call in openocd
    ret = jaylink_discovery_scan(jayctx, JAYLINK_HIF_USB | JAYLINK_HIF_TCP);
    for me means "look for a jlink everywhere, either on usb OR on tcp".
    But looking at the implementation, it returns error if there is an
    error opening libusb (respectively network), even if there is the
    jlink on the network (respectively libusb).
    Actually it depends on the API implementation, but without
    documentation it's hard to guess.

    If you think this is the expected behavior on the libjaylink side, we
    can change the caller, by calling jaylink_discovery_scan() twice, once
    for usb and once for network.
    Would it make more sense for you?

    Antonio

    Maybe I will introduce a special check for "network not available" but
    I'm not sure if and when. We could introduction a switch to disable TCP
    discovery in openocd but this would be a bit ugly IMO. For the moment,
    I would suggest to use a dummy ethernet device as workaround:

    $ ip link add eth23 type dummy
    $ ip address change dev eth23 10.0.0.1
    $ ip link set eth23 up
    $ route add default gw 10.0.0.1 dev eth23

    I hope this solves your problem for the moment. Anyway, I'm open for
    input if you have a proper solution for this issue.

    Best regards,
    Marc

    On Mon, 2021-01-18 at 12:26 +0000, Bohdan Tymkiv via OpenOCD-devel
    wrote:

    [tickets:#294] libjaylink fails to discover devices when network is
    down and J-Link S/N is specified

    Status: new
    Milestone: 0.10.0
    Created: Mon Jan 18, 2021 12:26 PM UTC by Bohdan Tymkiv
    Last Updated: Mon Jan 18, 2021 12:26 PM UTC
    Owner: nobody

    This issue is rather related to libjaylink library but I was unable
    to find any public libjaylink bug tracker so I'm posting the issue
    here.

    libjaylink is unable to find the probe by it's serial number when all
    network interfaces are down/disconnected. This makes it impossible to
    use OpenOCD on offline machines with several JLink probes connected.

    Steps to reproduce:
    Put you computer offline (disconnect all Ethernet cables and turn
    WiFi off)
    Run the following script:

    source [find interface/jlink.cfg]
    jlink serial <your_serial_here>
    source [find target/psoc6.cfg]
    init
    exit
    Observe the following error:</your_serial_here>

    Error: Failed to send discovery message.
    Error: TCP/IP device discovery failed.
    Error: jaylink_discovery_scan() failed: input/output error.
    I've tracked the issue down to discovery_tcp_scan function which
    fails on offline machines (which is OK) but this error is treated as
    fatal in jaylink_discovery_scan so whole device discovery fails.

    Bohdan

    Sent from sourceforge.net because openocd-devel@lists.sourceforge.net
    is subscribed to https://sourceforge.net/p/openocd/tickets/

    To unsubscribe from further messages, a project admin can change
    settings at https://sourceforge.net/p/openocd/admin/tickets/options.
    Or, if this is a mailing list, you can unsubscribe from the mailing
    list.


    OpenOCD-devel mailing list
    OpenOCD-devel@lists.sourceforge.net
    https://lists.sourceforge.net/lists/listinfo/openocd-devel


    OpenOCD-devel mailing list
    OpenOCD-devel@lists.sourceforge.net
    https://lists.sourceforge.net/lists/listinfo/openocd-devel

     

    Related

    Tickets: #294

  • Antonio Borneo

    Antonio Borneo - 2021-01-21

    Can you please check if this patch for OpenOCD fixes the issue
    http://openocd.zylin.com/6024

    Antonio

     
  • Bohdan Tymkiv

    Bohdan Tymkiv - 2021-01-25

    This ticket can be closed, issue fixed by http://openocd.zylin.com/#/c/6025/

     
  • Antonio Borneo

    Antonio Borneo - 2021-01-25
     

Log in to post a comment.

MongoDB Logo MongoDB