hanwen / go-mtpfs

Mount MTP devices over FUSE
Other
680 stars 85 forks source link

Question about libusb_bulk_transfer speed #136

Closed kh31202 closed 4 years ago

kh31202 commented 5 years ago

I'm currently developing MTP feature by using go-mtpfs.

During developmenet, I found the a issues about libusb_bulk_tranfer speed.

To receive and send MTP data between MTP device and Host, I use lib_usb_bulk_transfer like this.

func (h DeviceHandle) BulkTransfer(endpoint byte, data []byte, timeout int) (actual int, err error) { var ptr byte if len(data) > 0 { ptr = &data[0] }

    var n C.int
    e := C.libusb_bulk_transfer(h.me(), C.uchar(endpoint), (*C.uchar)(ptr),
            C.int(len(data)), &n, C.uint(timeout))
    return int(n), toErr(e)

}

Issue point is as follows.

If scan a folder containing a lot of files by using getObjectHandles, it takes about 5~10 seconds. generally, it takes within one second to send a request and receive a response from MTP device.

this is issue or natural situation?

hanwen commented 4 years ago

this sounds natural. If you have a large directory, the phone may have to scan the entire directory to be able to respond to the request.