Skip to content

Claim interface error 87 #27

@Crustus

Description

@Crustus

Hello,

I am trying to use your library, on Windows 10 64bit, but I am getting error 87 when attempt to claim an interface

Exception in thread "main" net.codecrete.usb.windows.WindowsUsbException: claiming interface failed: Parameter not correct. (error code:87)
	at net.codecrete.usb.windows.WindowsUsbException.throwException(WindowsUsbException.java:54)
	at net.codecrete.usb.windows.WindowsUsbException.throwLastError(WindowsUsbException.java:80)
	at net.codecrete.usb.windows.WindowsUsbDevice.claimInteraceSynchronized(WindowsUsbDevice.java:178)
	at net.codecrete.usb.windows.WindowsUsbDevice.claimInterface(WindowsUsbDevice.java:126)

test code in Kotlin

private val VID: Int = 0x067b
    private val PID: Int = 0x23a3
    private val INTERFACE_NO: Int = 0
    private val ENDPOINT_OUT: Int = 2
    private val ENDPOINT_IN: Int = 3


System.setProperty("jextract.trace.downcalls", "true")

        val optionalDevice = Usb.findDevice(VID, PID)
        if (optionalDevice.isEmpty) {
            System.out.printf("No USB device with VID=0x%04x and PID=0x%04x found.%n", VID, PID)
            return
        }

        val device = optionalDevice.get()
        val inter = device.getInterface(INTERFACE_NO)
        println("inter num: ${inter.number}")

        device.open()
        device.claimInterface(INTERFACE_NO)

interface should exist as enumerated here:

 Device:
  VID: 0x067b
  PID: 0x23a3
  Manufacturer:  Prolific Technology Inc.
  Product name:  USB-Serial Controller
  Serial number: EKAFb136G03
  Device class:    0x00 ((Defined at Interface level))
  Device subclass: 0x00
  Device protocol: 0x00

  Interface 0
    Interface class:    0xff (Vendor Specific Class)
    Interface subclass: 0x00
    Interface protocol: 0x00

    Endpoint 1
        Direction: IN
        Transfer type: INTERRUPT
        Packet size: 10 bytes

    Endpoint 2
        Direction: OUT
        Transfer type: BULK
        Packet size: 64 bytes

    Endpoint 3
        Direction: IN
        Transfer type: BULK
        Packet size: 64 bytes

Device descriptor
0000  12 01 00 02 00 00 00 40 7b 06 a3 23 05 03 01 02
0010  03 01

Configuration descriptor
0000  09 02 27 00 01 01 00 a0 32 09 04 00 00 03 ff 00
0010  00 00 07 05 81 03 0a 00 01 07 05 02 02 40 00 00
0020  07 05 83 02 40 00 00

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