kdrag0n / fastboot.js

WebUSB implementation of the Android fastboot protocol
MIT License
410 stars 72 forks source link

getvar timeout could be more generous #15

Open cedws opened 3 years ago

cedws commented 3 years ago

I used the web installer for GrapheneOS at https://grapheneos.org/install/web and was getting Timeout of 10000 ms exceeded at a particular step. I think it was the Unpacking system step or something.

The browser on my XPS laptop was getting overwhelmed at this step and couldn't complete it in the deadline. I located the timeout in the minified JS file and bumped the timeout from 1e4 to 1e5. After that the installation completed without a hitch.

https://github.com/kdrag0n/fastboot.js/blob/87b210122d2f4abf12c040bd7c4577b1f3135690/src/fastboot.ts#L19

Thanks for this project by the way! It's really cool and makes the process a breeze for someone like me not very familiar with Android systems.

kdrag0n commented 3 years ago

Which device are you installing to? The getvar timeout is used when waiting for the device to respond to a simple "get variable" command, so it doesn't have anything to do with the speed of your laptop.

Normally, devices should respond to such a simple command instantly, but some bootloaders respond immediately to slower actions and then hang on getvar until previous command completes.

cedws commented 3 years ago

Which device are you installing to?

Pixel 5.

The getvar timeout is used when waiting for the device to respond to a simple "get variable" command

Yes, getvar isn't the problem here, I increased the timeout as a workaround for the actual problem.

At the unpack step I mentioned, my browser was freezing up completely for more than 10000ms. This task is presumably happening at the same time as getvar calls, and this would make sense since the code uses a lot of async. By the time the unpack had completed, the deadline for getvar had been reached.

The handset always responded within the 10000ms deadline. Up until this step which is around halfway through the installation there were no issues. It's on the browser end I'm quite sure.