Package: android-tools-fastboot
Version: 4.2.2+git20130529-5.1
Severity: important


Dear Maintainer,

   * What led up to the situation?
root@debian-rn1# fastboot flash recovery 407recov.img
sending 'recovery' (3660 KB)...
FAILED (command write failed (Bad file descriptor))
finished. total time: 0.000s
oot@debian-rn1# fastboot reboot
rebooting...

finished. total time: 0.002s
root@debian-rn1# 

   * What exactly did you do (or not do) that was effective (or
     ineffective)?
I looked into the source and found that "usb_close()" is called before the 
write command thus starting with NULL file handel.
The reason "fastboot reboot" works is that it is done in one command. It 
doesn't arrive at
the point where it tries to use the usb connection again.

   * Here is the fix which I applied to protocol.c

diff protocol.c ../../../orig/android-tools/core/fastboot/protocol.c 
64c64
<         if((r > 0) && (r < 4)) {
---
>         if(r < 4) {
102c102
< //        usb_close(usb);
---
>         usb_close(usb);

This avoids premature closing of the file handle to the usb connection.
0 return value of usb_read() is legid.
The "unknown status code" is probably not necessarily a reason to stop and 
close the handle.

Interestingly enough: usb_osx.c does nothing, hence a primature close of the 
handle doesn't harm.
I guess this is the reason why osx users never found that issue.


   * What was the outcome of this action?
"fastboot flash" and "fastboot reboot" both work as expected.


-- System Information:
Debian Release: 8.2
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.16.0-4-amd64 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages android-tools-fastboot depends on:
ii  libc6        2.19-18+deb8u1
ii  libselinux1  2.3-2
ii  zlib1g       1:1.2.8.dfsg-2+b1

android-tools-fastboot recommends no packages.

android-tools-fastboot suggests no packages.

-- no debconf information

Reply via email to