bkerler / edl

Inofficial Qualcomm Firehose / Sahara / Streaming / Diag Tools :)
GNU General Public License v3.0
1.47k stars 354 forks source link

Increase max usb bulk buffer size #517

Closed bongbui321 closed 3 months ago

bongbui321 commented 3 months ago

@bkerler This is the max usb bulk buffer size --> improve writing speed by a lot

bkerler commented 3 months ago

Did you test if writing really writes that data by fully erasing and rewriting the data ? Because using a larger packetsize than usb supports may lead to package data being dropped.

bongbui321 commented 3 months ago

yes I did. Not sure if my method was a good test. Tested on Linux 20.04 usb 2.0 and 3.0 cable

  1. I ./edl e system partition
  2. try to turn on device --> bricked
  3. ./edl w system.img system
  4. turn on device --> works

I was trying to find a way to speed up the writing speed, and found these: https://learn.microsoft.com/en-us/dotnet/api/android.hardware.usb.usbdeviceconnection.bulktransfer?view=net-android-34.0 https://developer.android.com/reference/android/hardware/usb/UsbDeviceConnection

all have max usb bulk transfer size of 16384, and tried it out and it works. I guess this is what bulk means, maybe it has some buffer? Not entirely sure, but through my tests it seem to work. Also the writing speed on usb 2.0 is 25MB and around 56MB usb 3.0 on my ubuntu 20.04 machine

bkerler commented 3 months ago

Ok, thanks. I did changes of the bulk transfer size before as well but I always had issues with older devices that would only support a max of 4096. Let's see if anyone reports issues, until then, merged :)