Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added extra info for Kvaser dongles #1763

Closed
wants to merge 3 commits into from

Conversation

FedericoSpada
Copy link

Changed Kvaser auto-detection function to return additional info regarding the found dongles, such as Serial Number, Name and Dongle Channel number.
In this way it's possible to discern between different physical dongles connected to the PC and if they are Virtual Channels or not.

Changed Kvaser auto-detection function to return additional info regarding the dongles found, such as Serial Number, Name and Dongle Channel number.
In this way it's possible to discern between different physical dongles connected to the PC and if they are Virtual Channels or not.
Copy link
Owner

@hardbyte hardbyte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Thanks for the contribution.

return f"{name_decoded}, S/N {serial.value} (#{number.value + 1})"

return {
"name": name.value.decode("ascii", errors="replace"),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"name": name.value.decode("ascii", errors="replace"),
"device_name": name.value.decode("ascii", errors="replace"),

Changed "name" into "device_name" as suggested by python-can owner.
@@ -471,6 +471,7 @@ def __init__(
log.info("Found %d available channels", num_channels)
for idx in range(num_channels):
channel_info = get_channel_info(idx)
channel_info = f"{channel_info["device_name"]}, S/N {channel_info["serial"]} (#{channel_info["dongle channel"]})"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double quotes inside of double quotes is a syntax error in older Python versions.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I just started using Python last year with the latest version and I'm unaware of these retrocompatibility issues. Can I change it using single quotes for the f-string but maitain the dict indexing inside it with double quotes? Thanks in advance

Changed " with ' for retrocompatibility problem with older Python versions.
@FedericoSpada FedericoSpada deleted the branch hardbyte:main April 21, 2024 12:55
@FedericoSpada FedericoSpada deleted the main branch April 21, 2024 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants