USB: gadget: composite: Use separate switches for connected and confi…
…g state

Also remove disconnect debouncing, which didn't actually work on some platforms

Change-Id: I41d89ec9ffa0409615ed094ddaf66837c6b69942
Signed-off-by: Mike Lockwood <lockwood@android.com>
USB: gadget: f_accessory: New gadget driver for android USB accesories

Change-Id: I8036f187b90002ba5c76b33e443bab5e57e61afb
Signed-off-by: Mike Lockwood <lockwood@android.com>
USB: gadget: f_accessory: Misc improvements and cleanup:

- Add URI string

- Replace type string with a description string

- Add a control call to retrieve accessory protocol version (currently 1)

- Driver read() and write() calls now fail after USB disconnect until
  driver file is closed and reopened.

- Misc cleanup work

Signed-off-by: Mike Lockwood <lockwood@android.com>
USB: gadget: f_accessory: Clear accessory strings when USB is disconnected

Signed-off-by: Mike Lockwood <lockwood@android.com>
USB: gadget: f_accessory: Clear previous strings on ACCESSORY_GET_PROTOCOL

Clearing strings on disconnect does not work since we may receive
a disconnect on some devices when transitioning into accessory mode.
We require an accessory to send ACCESSORY_GET_PROTOCOL before
sending any strings, so any strings from a previous session will be cleared.

Signed-off-by: Mike Lockwood <lockwood@android.com>
USB: gadget: f_accessory: Clear disconnected flag when driver file is opened

Fixes a race condition that can occur when entering accessory mode.

Signed-off-by: Mike Lockwood <lockwood@android.com>
USB: gadget: f_accessory: Add string for accessory's unique serial number

Signed-off-by: Mike Lockwood <lockwood@android.com>
USB: gadget: f_accessory: Set bNumEndpoints to correct value of 2

Signed-off-by: Mike Lockwood <lockwood@android.com>
usb: gadget: Fixed Android gadget function discovery & product matching

- Don't bind until all required functions have registered
- Consider multi-instance functions when matching products

Change-Id: I6fa10567db71d49cd81968c01d75e326ff9a17c8
Signed-off-by: John Michelau <john.michelau@motorola.com>
USB: gadget: android Fix gadget descriptor compliance for IAD's

USB-IF core team mandates that composite devices containing
IAD's must use bDeviceClass=0xEF, bDeviceSubClass=0x02, &
bDeviceProtocol=0x01 instead of the usual 0x00 in all fields.
This is not a problem currently on Linux hosts, but it is a
problem when connecting to Windows hosts. Without this change
the default Microsoft composite driver will not group
interfaces properly, which is what allows child function
drivers with IAD's to load correctly.

Change-Id: I619d2d26a748cf66309a8cda1e1cf6f4347c8212
Signed-off-by: Mike Lockwood <lockwood@android.com>
USB: gadget: android: Support switching vendor ID when configuration …
…changes

Based on the list of enabled USB functions, we can now switch the vendor ID
as well as the product ID.

Change-Id: I7fdddab9685c5e9a8383c1db59fb8be1bef510a8
Signed-off-by: Mike Lockwood <lockwood@android.com>
USB: gadget: android: Fix problem switching vendor IDs

We need to update the vendor ID in the composite driver as well

Signed-off-by: Mike Lockwood <lockwood@android.com>