Commit d90ca4a
committed
feat: Enhance transports, response parsing, and tests
Multiple improvements across fastboot transports, protocol handling, USB behavior, and tests:
- Tests: add many unit tests and test helpers (MockTransport, ProtocolDownloadCaptureTransport, DelegatingTransport) covering packed frames, DATA parsing, download/upload edge cases, UDP behaviors, and GetVar caching.
- UDP: refactor UdpTransport constructor to accept timeout and max attempts, enforce timeouts, validate packet sizes, implement proper continuation handling, sequence tracking, out-of-turn data/error detection, and clearer error reporting.
- TCP: add connect/read/write timeouts and use ConnectAsync with a timeout to avoid hangs during handshake.
- USB: align host behavior with AOSP by avoiding forced host-side ZLPs (Linux, macOS, WinUSB), and add IO timeouts for legacy Windows device reads/writes using tasks to prevent blocking.
- FastbootUtil: reduce OnceSendDataSize to 512KB for better compatibility, avoid caching transient getvar failures, clamp sparse download logic, ensure SparseFile is disposed, and add validation for download sizes and stream EOF handling.
- HandleResponse: make response parsing more robust for packed INFO/TEXT frames, fragmented prefixes, DATA size validation (hex/length checks), and better timeout handling.
These changes improve reliability, timeout behavior, and correctness when communicating with various fastboot implementations and increase test coverage for edge cases.1 parent d6a0264 commit d90ca4a
File tree
14 files changed
+894
-173
lines changed- FirmwareKit.Comm.Fastboot.Tests
- FirmwareKit.Comm.Fastboot
- Backend
- Network
- Usb
- Linux
- Windows
- macOS
- Command
14 files changed
+894
-173
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
196 | 196 | | |
197 | 197 | | |
198 | 198 | | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
199 | 277 | | |
200 | 278 | | |
0 commit comments