-
Notifications
You must be signed in to change notification settings - Fork 392
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
Implement hid_error
#690
base: master
Are you sure you want to change the base?
Implement hid_error
#690
Commits on Sep 7, 2024
-
hid: define utf8 to wchar_t conversion function
Most if not all libusb functions return UTF-8 encoded data but hidapi functions typically take and return wide character strings. Adapt one of the existing algorithms in the code base into a general conversion function.
Configuration menu - View commit details
-
Copy full SHA for 1f1d55e - Browse repository at this point
Copy the full SHA 1f1d55eView commit details -
hid: define wchar_t libusb error function variant
Returns libusb error names and strings converted to wide character strings.
Configuration menu - View commit details
-
Copy full SHA for 69db339 - Browse repository at this point
Copy the full SHA 69db339View commit details -
hid: add error data to hid_device structure
Store libusb error code so it can be retrieved later. Includes the original error code as well as a context-specific message which the libusb documentation sometimes specifies for each function. Code which uses those functions are meant to set the contextual message whenever possible. The code is initialized to a success state which implies no errors yet. The contextual error message is initialized to NULL and is not freed when the device is closed. It is meant to point at string literals.
Configuration menu - View commit details
-
Copy full SHA for 277cac9 - Browse repository at this point
Copy the full SHA 277cac9View commit details -
hid: define easy error data setter function
Sets all error data, including an optional contextual error message which is supposed to be a non-freeable constant string such as a string literal. Contextual error messages are meant to be used in the cases the libusb documentation goes into detail as to what happened. Passing NULL will produce a message with just the libusb_error_name and the libusb_strerror results. Passing a string literal will produce a message that contains the additional context in addition to the error name and message.
Configuration menu - View commit details
-
Copy full SHA for 9cc5ac0 - Browse repository at this point
Copy the full SHA 9cc5ac0View commit details -
hid: set error data in send_feature_report
Set error data when send_feature_report fails, including custom messages for the situations especially outlined in the libusb documentation for the libusb_control_transfer function.
Configuration menu - View commit details
-
Copy full SHA for ec4d74a - Browse repository at this point
Copy the full SHA ec4d74aView commit details -
Compute a formatted error string containing the libusb error name, the error message as well as any contextual information. Return NULL if there are no errors or if memory allocation failed.
Configuration menu - View commit details
-
Copy full SHA for 9b6bef5 - Browse repository at this point
Copy the full SHA 9b6bef5View commit details