You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm porting to PyLink an old Python script that used the JLINKARM.dll directly. Sometimes J-Link selection by serial number is important, the script should report an error and quit if the specific J-Link it should use does not seem to be connected. I thought that could be done at JLink object creation time, but that is not happening. The serial_no argument passed to JLink.__init__() seems to be discarded, if a J-Link with a different serial number is connected to the PC it will be used with no warning whatsoever.
Environment
Windows 10 Pro Version 21H2, Python 2.7.18, JLink 7.20a and PyLink 0.14.3
Right now it looks like the only method to actually select a J-Link by serial number is passing the serial_no parameter to the JLink.open() function. For example, if at step 5 something like the following is used:
5*. dbg.open(serial_no=600115433)
an error will be reported and my script will be able to exit with an error code as expected.
The text was updated successfully, but these errors were encountered:
Looks like the passed parameter for the constructor is only used for the context manager, and not for the open(). I think maybe we could document this better, or possibly we should retain this value when .open() is called as well. What do you think would be the better option for your use case? I could see the argument to be made that if the argument passed to the constructor is different than the one passed to .open() that the latter should take priority, so it could be a simple change where we check is None, and then set it to the __serial_no.
I think you should either remove the serial number from the parameter list passed to the constructor or use it when .open() is called without any arguments. From a user's perspective it does not make much sense to pass a J-Link serial number to the object constructor if this number is not going to be used in subsequent user operations. Then like you said, if a different serial number is passed to the .open() function the latter should take precedence, that makes sense.
As it is right now, this feature is rather confusing.
Hello,
I'm porting to PyLink an old Python script that used the JLINKARM.dll directly. Sometimes J-Link selection by serial number is important, the script should report an error and quit if the specific J-Link it should use does not seem to be connected. I thought that could be done at JLink object creation time, but that is not happening. The
serial_no
argument passed toJLink.__init__()
seems to be discarded, if a J-Link with a different serial number is connected to the PC it will be used with no warning whatsoever.Environment
Windows 10 Pro Version 21H2, Python 2.7.18, JLink 7.20a and PyLink 0.14.3
Steps to reproduce
1. import pylink
2. dbg = pylink.jlink.JLink(serial_no=600115433)
3. dbg.num_connected_emulators()
Output: 1
4. dbg.connected_emulators()
Output: [JLinkConnectInfo(J-Link PLUS <Serial No. 600115434>, Conn. USB)]
5. dbg.open()
6. dbg.serial_number
Output: 600115434
Right now it looks like the only method to actually select a J-Link by serial number is passing the
serial_no
parameter to theJLink.open()
function. For example, if at step 5 something like the following is used:5*. dbg.open(serial_no=600115433)
an error will be reported and my script will be able to exit with an error code as expected.
The text was updated successfully, but these errors were encountered: