Skip to content

libftdi: handle ftdi_new failing - #228

Merged
Andrey1994 merged 1 commit into
brainflow-dev:masterfrom
xloem:libftdi-detection-when-libusb-fails
Feb 11, 2021
Merged

libftdi: handle ftdi_new failing#228
Andrey1994 merged 1 commit into
brainflow-dev:masterfrom
xloem:libftdi-detection-when-libusb-fails

Conversation

@xloem

@xloem xloem commented Feb 10, 2021

Copy link
Copy Markdown
Contributor

Adds code to handle the edge case of ftdi_new returning 0, which happens when libusb_init fails.

@Andrey1994
Andrey1994 merged commit c9bb21c into brainflow-dev:master Feb 11, 2021
@xloem

xloem commented Feb 11, 2021

Copy link
Copy Markdown
Contributor Author

Note: I'm learning the insides of libftdi a little, and it looks like a cleaner solution to this would be to use ftdi_init/ftdi_deinit instead of ftdi_new/ftdi_free. This preserves libftdi's internal error messages when initialisation fails, and also saves a minor heap allocation.

@Andrey1994

Copy link
Copy Markdown
Member

Since I already merged it lets do it in another PR

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