Coder Social home page Coder Social logo

Comments (7)

ainodalok avatar ainodalok commented on September 10, 2024 2

@j13u11fr09 @xyzz
This is related to this 3497b81 specific commit which was pushed to the latest stable release published on Google Play Store recently.

If the app targets Android Q (10) (targetSDK 29) it is required to get permission to read from USB device otherwise security exception is thrown.

SDL 2.0.14 in its HIDDeviceUSB.java particularly in one of the latest commits (libsdl-org/SDL@eea450b) addresses this issue by implementing exception handling in the getSerialNumber() method so that the app wouldn't crash, but I suppose requesting permission is up to app's developer himself.

Here is an error log I get on my MIUI 12 Android 10 device when I connect either mouse or Dualshock 3:

java.lang.RuntimeException: Unable to start activity ComponentInfo{is.xyz.omw/ui.activity.GameActivity}: java.lang.SecurityException: User has not given 10249/is.xyz.omw permission to access device /dev/bus/usb/001/002
 at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3312)
 at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3461)
 at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
 at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
 at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2048)
 at android.os.Handler.dispatchMessage(Handler.java:107)
 at android.os.Looper.loop(Looper.java:227)
 at android.app.ActivityThread.main(ActivityThread.java:7582)
 at java.lang.reflect.Method.invoke(Native Method)
 at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)
 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:953)
Caused by: java.lang.SecurityException: User has not given 10249/is.xyz.omw permission to access device /dev/bus/usb/001/002
 at android.os.Parcel.createException(Parcel.java:2074)
 at android.os.Parcel.readException(Parcel.java:2042)
 at android.os.Parcel.readException(Parcel.java:1990)
 at android.hardware.usb.IUsbSerialReader$Stub$Proxy.getSerial(IUsbSerialReader.java:123)
 at android.hardware.usb.UsbDevice.getSerialNumber(UsbDevice.java:143)
 

at org.libsdl.app.HIDDeviceUSB.getSerialNumber(HIDDeviceUSB.java:56)

at org.libsdl.app.HIDDeviceManager.connectHIDDeviceUSB(HIDDeviceManager.java:362) at org.libsdl.app.HIDDeviceManager.handleUsbDeviceAttached(HIDDeviceManager.java:324) at org.libsdl.app.HIDDeviceManager.initializeUSB(HIDDeviceManager.java:228) at org.libsdl.app.HIDDeviceManager.(HIDDeviceManager.java:152) at org.libsdl.app.HIDDeviceManager.acquire(HIDDeviceManager.java:36) at org.libsdl.app.SDLActivity.onCreate(SDLActivity.java:252) at ui.activity.GameActivity.onCreate(GameActivity.kt:106) at android.app.Activity.performCreate(Activity.java:7893) at android.app.Activity.performCreate(Activity.java:7880) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1307) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3287) ... 11 more Caused by: android.os.RemoteException: Remote stack trace: at com.android.server.usb.UsbUserSettingsManager.checkPermission(UsbUserSettingsManager.java:177) at com.android.server.usb.UsbSerialReader.getSerial(UsbSerialReader.java:96) at android.hardware.usb.IUsbSerialReader$Stub.onTransact(IUsbSerialReader.java:84) at android.os.Binder.execTransactInternal(Binder.java:1021) at android.os.Binder.execTransact(Binder.java:994)

from openmw-android.

xyzz avatar xyzz commented on September 10, 2024 1

Okay I've applied this patch (it doesn't seem the serial number is actually used anywhere), once this build completes - https://github.com/xyzz/openmw-android/actions/runs/610780501 - could you please confirm whether it fixes the problem.

from openmw-android.

ainodalok avatar ainodalok commented on September 10, 2024 1

Oh, suddenly it just works without any permission requests on my end! Both for dualshock 3 and keyboard/mouse combo through usb hub.

Hopefully this resolves issue for @j13u11fr09, though removing the logging itself as in next libsdl-org/SDL@68e1731 commit might be a good idea to improve performance since SDL developers themselves don't consider it useful at all.

from openmw-android.

j13u11fr09 avatar j13u11fr09 commented on September 10, 2024 1

I installed the omw-debug-b2a6ae7-arm64 version linked above and the usb device now works correctly: openmw doesn't crash. This fixed the problem.

from openmw-android.

licaon-kter avatar licaon-kter commented on September 10, 2024

Related to https://www.xda-developers.com/android-11-trouble-getting-games-recognize-their-controllers/ ?

from openmw-android.

j13u11fr09 avatar j13u11fr09 commented on September 10, 2024

No, the controller works fine otherwise. As stated, the controller works in the stable build of OpenMW. Only crashes there nightly build of OpenMW.

from openmw-android.

j13u11fr09 avatar j13u11fr09 commented on September 10, 2024

Did a little bit of digging, installing older versions of the nightly (0.47.0) build: the issue starts at version 0.47.0-40. I'm able to use version 0.47.0-39 with the controller just fine.

from openmw-android.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.