We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 4776 - Android: Alert dialog (Couldn't load hidapi: hidapi.so) is displayed when SDL is compiled with disabled hidapi
Summary: Android: Alert dialog (Couldn't load hidapi: hidapi.so) is displayed when SDL...
Status: NEW
Alias: None
Product: SDL
Classification: Unclassified
Component: joystick (show other bugs)
Version: 2.0.10
Hardware: ARM Android (All)
: P2 blocker
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-08-29 19:58 UTC by ZZ
Modified: 2019-08-29 19:59 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ZZ 2019-08-29 19:58:35 UTC
In connection to this: https://bugzilla.libsdl.org/show_bug.cgi?id=3918#c23

If SDL on Android is compiled with hidapi disabled an alert dialgo is displayed informing about missing hidapi.so

private HIDDeviceManager(final Context context) {
        mContext = context;

        // Make sure we have the HIDAPI library loaded with the native functions
        try {
            SDL.loadLibrary("hidapi");
        } catch (Throwable e) {
            Log.w(TAG, "Couldn't load hidapi: " + e.toString());

            AlertDialog.Builder builder = new AlertDialog.Builder(context);
            builder.setCancelable(false);
            builder.setTitle("SDL HIDAPI Error");
            builder.setMessage("Please report the following error to the SDL maintainers: " + e.getMessage());
            builder.setNegativeButton("Quit", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {


I suggest that there is some option for the user to easily disable the use of hidapi in SDLActivity.java I created a custom variable that I can set in a class that inherits from SDLActivity so that I don't have to modify SDLs own source code:

        if (isHIDAPIEnabled)
        {
            mHIDDeviceManager = HIDDeviceManager.acquire(this);
        }
Or maybe some other method could be employed like the Java code could query SDL for hidapi support and disable the above code automatically.