OSDN Git Service

ANDROID: fix false disconnect due to a signal sent to the reading process
authorkeunyoung <keunyoung@google.com>
Wed, 29 Jan 2014 20:41:50 +0000 (12:41 -0800)
committerDmitry Shmidt <dimitrysh@google.com>
Fri, 27 Jan 2017 21:51:17 +0000 (13:51 -0800)
commit6427ac4392362500d832713fa6090d5b12702398
treed45201e3efbfaffe4baff0fa850447bb18a15161
parente45c769fa7af7cc4e5d55b8eafd24a65fee32116
ANDROID: fix false disconnect due to a signal sent to the reading process

- In the current implementation, when a signal is sent to the reading process,
  read is cancelled by calling usb_ep_dequeue, which lead into calling
  acc_complete_out with ECONNRESET, but the current logic treats it as
  disconnection, which makes the device inaccessible until cable is actually
  disconnected.
- The fix calls disconnect only when ESHUTDOWN error is passed.
- If data has already arrived while trying cancelling, the data is marked
  as available, and it will be read out on the next read. This is necessary
  as USB bulk is assumed to guarantee no data loss.

Signed-off-by: keunyoung <keunyoung@google.com>
drivers/usb/gadget/function/f_accessory.c