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

Commit b56fdfd1 authored by Daniel Jacob Chittoor's avatar Daniel Jacob Chittoor
Browse files

Fix duplicate condition, add missing protocolCode check

getInOutEndpoints() checks interfaceSubclass twice instead of checking
all three USB interface attributes. The WebUsbDeviceFilter defines
classCode, subclassCode, and protocolCode, but protocolCode was never
validated.

Replace the duplicate interfaceSubclass check with interfaceProtocol
to properly filter USB interfaces matching the ADB protocol
(class=0xff, subclass=0x42, protocol=1).
parent 0793a5a6
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -100,9 +100,9 @@ export class Recovery extends Device {
      for (const interface_ of configuration.interfaces) {
        for (const alternate of interface_.alternates) {
          if (
            alternate.interfaceSubclass === WebUsbDeviceFilter.subclassCode &&
            alternate.interfaceClass === WebUsbDeviceFilter.classCode &&
            alternate.interfaceSubclass === WebUsbDeviceFilter.subclassCode
            alternate.interfaceSubclass === WebUsbDeviceFilter.subclassCode &&
            alternate.interfaceProtocol === WebUsbDeviceFilter.protocolCode
          ) {
            if (
              ((_a = this.adbDaemonWebUsbDevice.configuration) === null ||