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

Fix for libusb_kernel_driver_active & error handling for st.st_size #1210

Merged
merged 8 commits into from
Jan 23, 2022

Conversation

hydroconstructor
Copy link
Collaborator

@hydroconstructor hydroconstructor commented Jan 5, 2022

According to libusb API documentation, function libusb_kernel_driver_active is not available on Windows. So I think it will be useful not to compile it on Windows platform.

(Closes #1211) (Closes #1214)

There are 2 calls _stlink_usb_exit_dfu_mode In usb.c (at lines 1284 and 1293) and no single call _stlink_usb_exit_debug_mode. Apparently typo on line 1293
@hydroconstructor
Copy link
Collaborator Author

There is one more change, typo on line 1293 (see second commit)

There is no enironment variable "STLINK_DEVICE" in user system, and program do not set it. So I removed all code which works with it.
@Nightwalker-87
Copy link
Member

Looking at this more closely, I think we can merge it to develop as it does not conflict with the chipid_cleanup branch.

@Nightwalker-87 Nightwalker-87 changed the title Update usb.c Fix for libusb_kernel_driver_active & error handling for st.st_size Jan 9, 2022
Error in file size comparizon.
Due to type casting, instead of compare file size with max. singed int value, it compares with -1. Then function returns with error message.
In stlink-org#1210 from codebase was removed functionality to specify ST-LINK by environment variable. This still mentioned in documentation, so I updated it.
doc/man/st-util.1 Outdated Show resolved Hide resolved
src/common.c Outdated Show resolved Hide resolved
src/stlink-lib/usb.c Show resolved Hide resolved
src/stlink-lib/usb.c Show resolved Hide resolved
@Nightwalker-87
Copy link
Member

@hydroconstructor Please address the remaining points.

hydroconstructor and others added 2 commits January 23, 2022 23:22
Comment was:
removing the MAX_FILE_SIZE ifdef/define/endif,
replacing the st.st_size > (off_t)SSIZE_MAX test with st.st_size > (intmax_t) SIZE_MAX,
perhaps removing the sizeof(st.st_size) != sizeof(size_t) test as well.
done here
Co-authored-by: Grzegorz Szymaszek <gszymaszek@short.pl>
@Nightwalker-87 Nightwalker-87 merged commit 66f35d1 into stlink-org:develop Jan 23, 2022
@Nightwalker-87
Copy link
Member

Thanks @hydroconstructor 👍

@stlink-org stlink-org locked as resolved and limited conversation to collaborators Jan 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
No open projects
Status: Done
4 participants