Android bulkTransfer return -1 when read data but there is really some data in the buffer

前端 未结 2 1199
死守一世寂寞
死守一世寂寞 2021-01-18 01:13

I write a app in galaxy tab p7300 to communicate with a key (scsi device) via otg cable. I can read data first time with bulkTransfer(),but can not the next time . Then I u

2条回答
  •  说谎
    说谎 (楼主)
    2021-01-18 01:50

    Its too late to post a solution , but in case in future someone needs help about it can get an answer from here.

    I faced the same issue. I was using Android (Samsung galaxy s3) as usb host device. I figured out about the read endpoint and write endpoint not trasferring data using USB BulkTransfer. I tried to switch the endpoints for host mode case, it recognized and successfully write/read the data.

     mReadEndpoint = mDataInterface.getEndpoint(0);// tweaking endpoints // 1 was for read and 0 was for write
     mWriteEndpoint = mDataInterface.getEndpoint(1);
    

    P.S there is an application available for android named "USB device info". It helped me a lot in understanding interfaces and endpoints of my usb device.

提交回复
热议问题