Skip to content

JLink probe open fails by serial number when jlink.non_interactive is set #1970

@jwp01

Description

@jwp01

Summary

When jlink.non_interactive is true (the default), pyocd calls disable_dialog_boxes() before open(serial_number_int) in jlink_probe.py. This causes open() to fail with:

No emulator with serial number <SN> found.

even though the probe is visible and pyocd list shows it correctly.

Reproduction

import pylink

j = pylink.JLink()
j.disable_dialog_boxes()   # pyocd calls this when jlink.non_interactive=True
j.open(682962484)           # fails: No emulator with serial number 682962484 found

Without disable_dialog_boxes():

import pylink

j = pylink.JLink()
j.open(682962484)           # succeeds

Environment

  • pyocd 0.44.0
  • pylink-square 1.7.0
  • JLinkARM.dll v9.24.01 (C:\Program Files\SEGGER\JLink\)
  • Probe: Segger J-Link OB-SAM3U128-V2-NordicSem (Nordic nRF52 on-board J-Link)
  • Windows 11 Pro 10.0.26200
  • Python 3.9.x

Root cause

disable_dialog_boxes() in pylink-square calls a function in JLinkARM.dll that has the side effect of resetting or disabling USB emulator enumeration state, breaking the subsequent EMU_SelectByUSBSN call that open(serial_no) relies on.

Workaround

Add a pyocd.yaml to the project with:

jlink.non_interactive: false

Suggested fix

Reorder the calls in jlink_probe.py so that disable_dialog_boxes() is called after open(), not before. Since disable_dialog_boxes affects UI behavior during the debug session rather than probe discovery, this should be safe:

# jlink_probe.py, open() method
self._link.open(self._serial_number_int)   # open first
self._is_open = True

if self.session.options.get('jlink.non_interactive'):
    self._link.disable_dialog_boxes()      # then suppress dialogs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions