ArthurVasseur / USB-Midi-Android-Plugin

A USB MIDI plugin for Android 6.0 and above
MIT License
9 stars 2 forks source link

No deviceattached or midi messages being detected or displayed #9

Open owlandfox opened 4 months ago

owlandfox commented 4 months ago

App built for Quest 3 - When plugging my Midi controller in I get the prompt menu appear and click OK. Scene opens but the text does not display any device info or incoming midi data info.

Secondly once this is solved I am simply trying to connect the incoming midi messages to trigger buttons, sliders and toggles in the UI. Can you provide steps to do this also? Thanks!

ArthurVasseur commented 4 months ago

Hello,

Can you give me the logs https://developer.android.com/studio/debug/logcat?hl=en

owlandfox commented 4 months ago

Its not possible to get the logs as the only wayt to test if the midi controller is being detected is by plugging into the Quest. Which means it is not connected to the laptop via USB to activate Logcat :/

Unless theres another way? I also see in some of the other MIDI plugins we tried from the store they required us to add some parameters to the androidmanifest. Is this the case here too? If so what would we need to add?

ArthurVasseur commented 4 months ago

You can have the logcat by using wifi instead of USB :

https://docs.unity3d.com/Packages/com.unity.mobile.android-logcat@0.1/manual/index.html

owlandfox commented 4 months ago

Logcat.txt

Would it help for me to filter it by some criterion?

ArthurVasseur commented 4 months ago

Not really the full log is ok

2024/03/11 11:03:40.234 1072 5178 Warn InputManager-JNI Input channel object '499b7c7 com.oculus.os.vrusb/com.oculus.os.vrusb.UsbPermissionActivity (client)' was disposed without first being removed with the input manager!
2024/03/11 11:03:40.234 10860 10860 Info Unity Device Attached /dev/bus/usb/001/002
2024/03/11 11:03:40.234 10860 10860 Info Unity Midi.MidiEventHandler:DeviceAttached(String)
2024/03/11 11:03:40.234 10860 10860 Info Unity System.Reflection.RuntimeMethodInfo:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo)
2024/03/11 11:03:40.234 10860 10860 Info Unity UnityEngine.AndroidJavaProxy:Invoke(String, Object[])
2024/03/11 11:03:40.234 10860 10860 Info Unity UnityEngine.AndroidJavaProxy:Invoke(String, IntPtr)
2024/03/11 11:03:40.234 10860 10860 Info Unity UnityEngine._AndroidJNIHelper:InvokeJavaProxyMethod(AndroidJavaProxy, IntPtr, IntPtr)

You need to have the usb permissoin in the manifest file

owlandfox commented 4 months ago

Yes I had a feeling it was something extra needed in the manifest. Can you confirm what exactly needs adding as I did already add android.hardware.usb.host

Do we need to add the full snippet from here - https://developer.android.com/develop/connectivity/usb/host

<manifest ...>

<uses-sdk android:minSdkVersion="12" />
...
<application>
    <activity ...>
        ...
        <intent-filter>
            <action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
        </intent-filter>

        <meta-data android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
            android:resource="@xml/device_filter" />
    </activity>
</application>

ArthurVasseur commented 4 months ago

Maybe <uses-feature android:name="android.hardware.usb.host" />

ArthurVasseur commented 4 months ago

Did it work? Can I close the issue ? @owlandfox

owlandfox commented 3 months ago

Nope still trying to get some detection for plugged in controllers

owlandfox commented 3 months ago

From what I can see its because we also need to declare intent filters https://developer.android.com/develop/connectivity/usb/host

But im not sure where we would need to create the xml file as this seems very specific to Android file structure rather than Unity.

ArthurVasseur commented 3 months ago

You need to have the android manifest file in unity : https://docs.unity3d.com/2023.2/Documentation/Manual/android-manifest.html

Add <uses-feature android:name="android.hardware.usb.host"/> into the manifest file

owlandfox commented 3 months ago

Yep tried this multiple times, no success :/