Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 19f083cd authored by Robert Wu's avatar Robert Wu Committed by Android (Google) Code Review
Browse files

Merge "Don't call setInterface when querying protocol"

parents 5c0a8f51 4c6239b1
Loading
Loading
Loading
Loading
+5 −6
Original line number Diff line number Diff line
@@ -218,14 +218,13 @@ public final class UsbUniversalMidiDevice implements Closeable {
            if (doesInterfaceContainInput
                    && doesInterfaceContainOutput) {
                UsbDeviceConnection connection = manager.openDevice(mUsbDevice);
                if (!connection.claimInterface(interfaceDescriptor.toAndroid(mParser), true)) {
                    Log.d(TAG, "Can't claim control interface");
                    continue;
                }

                // The ALSA does not handle switching to the MIDI 2.0 interface correctly
                // and stops exposing /dev/snd/midiC1D0 after calling connection.setInterface().
                // Thus, simply use the control interface (interface zero).
                int defaultMidiProtocol = mMidiBlockParser.calculateMidiType(connection,
                        interfaceDescriptor.getInterfaceNumber(),
                        0,
                        interfaceDescriptor.getAlternateSetting());

                connection.close();
                return defaultMidiProtocol;
            }