Android ADK with PC as USB Host with libusb, bulk transfer error

前端 未结 2 587
刺人心
刺人心 2021-01-30 15:21

I\'m trying to make my PC the USB Host for Android 2.3.4 devices in order to be able to develop APIs without needing actual \"accessories\". To do this, I need to establish the

2条回答
  •  别那么骄傲
    2021-01-30 15:55

    Initial problem is that the original connection to the device in order to tell it to go into accessory mode is never closed. The USB subsystem and/or libusb do not throw an error if you then reopen and claim an interface while the original device is still left open. You only get an IO or NOT FOUND error when you actually try to write to/from an endpoint.

    By adding:

    libusb_close(handle);
    

    within the if statement where the initial interface is released from initial connection the libusb side of the issue is resolved.

    The next issue that prevents data to pass in this particular combination of softwares, is that the Android side is waiting for a larger segment of bytes before it accepts the read which results in a timeout (haven't worked out due to which side yet) and so if you set the buffer to match the libusb side (64), you will get an initial set of bytes written from the PC to the Android device. The software will still break after that since the PC/libusb side then tries to read data but the Android side isn't writing any, but that is simply unfinished software and not within the scope of the question.

提交回复
热议问题