You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
HID_SendReport (USBAPI.h and HID.cpp) does not return any value, although the underlying implementation uses USBSend which returns the number of bytes or -1 if failed. I suggest changing the signature of HID_SendReport to return an int value to enable consumers to detect error conditions.
I'd be willing to do the change in a pull request. Unfortunately I can't discuss that on the mailing list as I do not have a Google account (and I am not willing to get one ;-)).
The text was updated successfully, but these errors were encountered:
I'd say its not really needed. This only increases ram. The return value might be needed for other libs like cdc (not sure) because the usb function is more general. You can simply test if in this case the usb function would ever return -1, i believe it wont. Maybe if the decice is disconnected (havent actually looked in the code again).
I am working on a lot of USB updates. I am just searching through all issues and pull requests and collect and implement them all together. If you want to help, let me know.
The reason why I am asking is the following: I am trying to implement digital rotary knobs, which, due to the receiving application, must be implemented as joystick buttons. On turning these knobs fast, generating more than 20 updates per second, Windows chokes on the events silently dropping some of the updates. The events are definitely being sent by the Arduino however I'd like to check whether the number of bytes sent have really the expected value. Therefore I not only need the -1 (which might be helpful anyway) but also the exact number of bytes sent.
I am not too familiar with C(++) therefore it is not exactly clear to me how this would waste RAM if you don't check the value. The compiler should drop the value in this case (i.e. not put it on the stack).
USB HID can send up to 1000 reports / second. more isnt possible. and as far as i know the sending always flushes and the bytes sent is ALWAYS the size of the report + report ID. Cause you can only send a full USB bank, not a half. The sending of the bank could fail but well i dont think this will happen. just set an led when it would return -1 and simply test it.
HID_SendReport (USBAPI.h and HID.cpp) does not return any value, although the underlying implementation uses USBSend which returns the number of bytes or -1 if failed. I suggest changing the signature of HID_SendReport to return an int value to enable consumers to detect error conditions.
I'd be willing to do the change in a pull request. Unfortunately I can't discuss that on the mailing list as I do not have a Google account (and I am not willing to get one ;-)).
The text was updated successfully, but these errors were encountered: