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

Added return value to sendState() #86

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

virtmedia
Copy link

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:

The return value can be useful to detect, if USB host is active, or if
it only supply power to the device.
@MHeironimus
Copy link
Owner

I like the idea!

In reviewing the USB_Send function defined in the USBCore.cpp module, it appears it returns the following:

  • -1 if 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

@virtmedia
Copy link
Author

virtmedia commented May 9, 2018 via email

@MHeironimus
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants