Skip to content

Open input blocks and never completed #92

@Daniel63656

Description

@Daniel63656

I try to receive messages from a connected usb MIDI device.

val midiAccess = AndroidMidiAccess(this)
val midiInput = runBlocking {
     midiAccess.openInput(midiAccess.inputs.first().id)
 }
midiInput.setMessageReceivedListener(this@MainActivity)

However, the app becomes unresponsive whenever calling openInput, indicating that no input can be established. This happens on google pixel 7 (android-version 14). The code only continues (setting listener) as soon as I unplug the Midi cable again.
I know this is caused by runBlocking and this only helps to make clear that no input can be established.
I noticed this did not happen on my older Samsung galaxy S9 (same code).

After some digging I found that the issue is this line in the MidiDevice.java file:
FileDescriptor fd = mDeviceServer.openInputPort(token, portNumber);
Somehow calling openInputPort on the IMidiDeviceServer blocks until the cable is removed again.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions