square / pylink

Python Library for device debugging/programming via J-Link
https://pylink.readthedocs.io/en/latest/
Other
346 stars 127 forks source link

Support device selection dialogue box #196

Closed luckpi closed 5 months ago

luckpi commented 6 months ago

If no chip name is given, then we will use the SelectDialog.

CLAassistant commented 6 months ago

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

hkpeprah commented 6 months ago

Thanks for the contribution! Could you give an example of the use-case for this? My assumption is that users who want to allow selection from all available chips would use the supported_device() and num_supported_devices() to build their own UI. E.g.

num_devices = jl.num_supported_devices()
devices = list(jl.supported_device(i) for i in range(num_devices))

# Use `devices` to show custom UI, or for terminal completion.
luckpi commented 6 months ago

Through JLINK_ARM_DEVICE_SelectDialog(), device selection can be achieved without additional code

2024-04-03 091534

hkpeprah commented 6 months ago

Sorry, I should have elaborated bit more. I'm trying to think of a use case where a developer would want the SDK's GUI to pop up from their Python script. The GUI isn't available in all versions of the SDK or on all platforms, so calling it could fail in a way that isn't intuitive to the caller in a way in which not specifying the device is. Similarly, if the caller accidentally forgets to pass a device on a server without X11 forwarding, their process would stall AFAIK. So the user of the embedded GUI is non-universal.

I think if a user is building something that allows for the end user to select from a variety of devices, they would have their own UI already in order to do the various non-target specific things.