Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase max usb bulk buffer size #517

Merged
merged 1 commit into from
Mar 20, 2024
Merged

Conversation

bongbui321
Copy link
Contributor

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

@bkerler
Copy link
Owner

bkerler commented Mar 19, 2024

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
Copy link
Contributor Author

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 bkerler merged commit d52d83b into bkerler:master Mar 20, 2024
1 check passed
@bkerler
Copy link
Owner

bkerler commented Mar 20, 2024

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 :)

@bongbui321 bongbui321 deleted the packet_size branch March 20, 2024 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants