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

Tell USB bus and address when ftdi open fails. #353

Merged
merged 1 commit into from
Jul 29, 2023

Conversation

inkdot7
Copy link
Contributor

@inkdot7 inkdot7 commented Jul 10, 2023

Idea is to give user some more hints when open failed.

@trabucayre
Copy link
Owner

It's a good idea, but this piece of code is used when _bus and _addr are provided by user, but also when both aren't. So, in latter case this may introduce difficulties for user.
It's maybe required here to duplicate message to adapt content.

@inkdot7
Copy link
Contributor Author

inkdot7 commented Jul 19, 2023

I think I also were looking for that info when _bus and _addr had been set automatically. The extra info might make it easier to figure out what went wrong also in the automatic case.

@inkdot7
Copy link
Contributor Author

inkdot7 commented Jul 20, 2023

Though, my original problem then turned out to be #354, so when giving them explicitly.

How about changing the message from (USB bus %d addr %d) to (at USB bus %d addr %d)? That would more indicate what failed to open.

@trabucayre
Copy link
Owner

_bus and _addr have a value != 0 only when:

  • user provides both informations --busdev-num
  • user select a device --device /dev/ttyUSBx

So I think it's required to replace the common message by two according to the presence/absence of these informations.

@inkdot7
Copy link
Contributor Author

inkdot7 commented Jul 29, 2023

Oh, now I see. Yes, with just 0 and 0, it would be more confusing.

I tried to make some formatting that mimicked how the device is opened and noticed that when nothing is specified on the command line, most values (vid, pid, serial, index) are all 0. So printing them instead would not be helpful.

Though what I made now looks rather clumsy.

Perhaps it is better if, at higher verbosity level, it tells what it tries to open and how.

@trabucayre trabucayre merged commit 65b6c73 into trabucayre:master Jul 29, 2023
16 checks passed
@trabucayre
Copy link
Owner

Applied thanks @inkdot7

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.

2 participants