libusb_set_configuration возвращает LIBUSB_ERROR_BUSY - PullRequest
0 голосов
/ 20 апреля 2020

Apple iPhone имеет конфигурацию, которая устанавливает интерфейс для HID.
Моя цель - подключиться к нему и настроить отчеты HID для конечной точки на этом интерфейсе.
Используемое мной устройство iPhone 6S.
Мой код перебирает все доступные конфигурации и их интерфейсы, пока не обнаружит, что HID-интерфейс (это конфигурация 1 с интерфейсом 2).
Вот некоторая диагностика c информация о нем:

 Configuration #2
--------------------------------------------------------------------------------
    Total length: 149   Interface count: 3
    Configuration value: 2
    Configuration index: 6
    Attributes: 0xc0
    Max. power: 250

    Interface #1

        Setting #1
            Interface number: 0
            Alternate setting: 0
            Endpoint count: 0
            Interface class: Audio
            Interface sub-class: Audio
            Interface protocol: 0
            Interface index: 0



    Interface #2

        Setting #1
            Interface number: 1
            Alternate setting: 0
            Endpoint count: 0
            Interface class: Audio
            Interface sub-class: Communcation
            Interface protocol: 0
            Interface index: 0


        Setting #2
            Interface number: 1
            Alternate setting: 1
            Endpoint count: 1
            Interface class: Audio
            Interface sub-class: Communcation
            Interface protocol: 0
            Interface index: 0


            Endpoint 00
                Endpoint Address: 0x81
                Attributes: 0x1
                Max. packetsize: 192
                Interval: 4
                Refresh: 0
                Sync. Address: 0


    Interface #3

        Setting #1
            Interface number: 2
            Alternate setting: 0
            Endpoint count: 1
            Interface class: Human Interface Device
            Interface sub-class: Interface Specific
            Interface protocol: 0
            Interface index: 0


            Endpoint 00
                Endpoint Address: 0x83
                Attributes: 0x3
                Max. packetsize: 64
                Interval: 1
                Refresh: 0
                Sync. Address: 0

Теперь, когда я пытаюсь установить интерфейс:

int err = libusb_set_configuration(handle, i);

, я получаю LIBUSB_ERROR_BUSY.

Как я могу это исправить? Что не так?

...