-
Notifications
You must be signed in to change notification settings - Fork 435
Added return value to sendState() #86
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
Conversation
The return value can be useful to detect, if USB host is active, or if it only supply power to the device.
I like the idea!
In reviewing the USB_Send function defined in the USBCore.cpp module, it appears it returns the following:
-1if an error occurs- length of the buffer if the buffer was successfully sent
Having the Joystick.sendState() function return the length of the internal _hidReportSize variable exposes some implementation details I might want to modify in a future version, but I do like the idea of the function returning a bool to indicate if the function worked correctly or not.
If we modify Joystick.sendState() function, should we modify the other functions that call sendState() internally as well? For example, if initAutoSendState is set to true, functions like setXAxis, pressButton, etc. all call sendState. These functions could be modified to return the result of the sendState() (or true if initAutoSendState is set to false). Thoughts?
Do you want to modify your Pull Request as indicated above (and also update the README.md documentation accordingly) or you would prefer for me to make the change (after I decide what should be done with all of the functions that call sendState)?
Thanks again for your contribution,
Matt
I agree with your reasoning on only updating the sendState. I am going to keep the PR open until I have had a chance to update the code with your change. I will let you know when the update has been made.
Thanks again for your contribution,
Matt
The return value can be useful to detect, if USB host is active, or if
it only supply power to the device.
Fixes # or Enhancement #
Changes proposed in this pull request:
Contributors: