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

Use getopt for option parsing #18

Open
dagon666 opened this issue Jan 4, 2016 · 3 comments
Open

Use getopt for option parsing #18

dagon666 opened this issue Jan 4, 2016 · 3 comments

Comments

@dagon666
Copy link

dagon666 commented Jan 4, 2016

Hi,

This is more of a question than an issue. How do you feel about using getopt() for option parsing ? It would make the code much cleaner and easier to maintain. It would have to be compiled under cygwin for Windows though. The use of cygwin on Windows would allow to use a unified USB communication library in the code as well, which in my opinion would be generally beneficial.

Let me know what do you think. I already have a getopt change ready. I could provide some more changes if you agree that this is a good idea.

@PaulStoffregen
Copy link
Owner

Kinda seems like overkill. There's only 39 lines now for parse_options().

I really do want to preserve the ability to build with MinGW. Anything that forces use of Cygwin really needs to be a very compelling feature.

@dagon666
Copy link
Author

dagon666 commented Jan 7, 2016

There's libusb-win32 for MingW http://www.libusb.org/wiki/libusb-win32 which would allow to preserve a single portable implementation ang get rid of the Windows specific USB code.

The current option parsing code maybe is pretty short but at the same time it's pretty sloppy. Being precise you should take into account the parse_flag() function as well. Have a look on my branch. That change is already available: dagon666/teensy_loader_cli@e1800804de3b7fb23efd8b5d34c9c4e11cdba2fd

I can create the PR for this change and take care about usb code as well.

@PaulStoffregen
Copy link
Owner

There's libusb-win32 for MingW

Can it properly detach the Windows HID driver, like it does for RawHID on Linux? When I looked years ago, it couldn't. Without that feature, it's worthless (for a HID device like Teensy).

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

No branches or pull requests

2 participants