Skip to content

Commit

Permalink
ANDROID: usb: gadget: f_accessory: Add Android Accessory function
Browse files Browse the repository at this point in the history
USB accessory mode allows users to connect USB host hardware
specifically designed for Android-powered devices. The accessories
must adhere to the Android accessory protocol outlined in the
http://accessories.android.com documentation. This allows
Android devices that cannot act as a USB host to still interact with
USB hardware. When an Android device is in USB accessory mode, the
attached Android USB accessory acts as the host, provides power
to the USB bus, and enumerates connected devices.

Signed-off-by: Mike Lockwood <lockwood@android.com>
[AmitP: Folded following android-4.9 commit changes into this patch
        ceb2f0a ("ANDROID: usb: gadget: accessory: Fix section mismatch")
        Parts of e275439 ("ANDROID: usb: gadget: Fixes and hacks to make android usb gadget compile on 3.8")
        1b07ec7 ("ANDROID: drivers: usb: gadget: 64-bit related type fixes")]
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
[astrachan: Folded the following changes into this patch:
            9d5891d516e2 ("ANDROID: usb: gadget: f_accessory: Add ACCESSORY_SET_AUDIO_MODE control request and ioctl")
            dc66cfce9622 ("ANDROID: usb: gadget: f_accessory: Add support for HID input devices")
            5f1ac9c2871b ("ANDROID: usb: gadget: f_accessory: move userspace interface to uapi")
            9a6241722cd8 ("ANDROID: usb: gadget: f_accessory: Enabled Zero Length Packet (ZLP) for acc_write")
            31a0ecd5a825 ("ANDROID: usb: gadget: f_accessory: check for accessory device before disconnecting HIDs")
            580721fa6cbc ("ANDROID: usb: gadget: f_accessory: Migrate to USB_FUNCTION API")
            7f407172fb28 ("ANDROID: usb: gadget: f_accessory: Fix for UsbAccessory clean unbind.")
            ebc98ac5a22f ("ANDROID: usb: gadget: f_accessory: fix false disconnect due to a signal sent to the reading process")
            71c6dc5ffdab ("ANDROID: usb: gadget: f_accessory: assign no-op request complete callbacks")
            675047ee68e9 ("ANDROID: usb: gadget: f_accessory: Move gadget functions code")
            b2bedaa5c7df ("CHROMIUM: usb: gadget: f_accessory: add .raw_request callback")]
Signed-off-by: Alistair Strachan <astrachan@google.com>
Signed-off-by: rickyniu <rickyniu@google.com>
  • Loading branch information
benoitgoby authored and intel-lab-lkp committed Oct 12, 2020
1 parent b2c586e commit 5ede414
Show file tree
Hide file tree
Showing 5 changed files with 1,533 additions and 0 deletions.
10 changes: 10 additions & 0 deletions drivers/usb/gadget/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,9 @@ config USB_F_PRINTER
config USB_F_TCM
tristate

config USB_F_ACC
tristate

# this first set of drivers all depend on bulk-capable hardware.

config USB_CONFIGFS
Expand Down Expand Up @@ -369,6 +372,13 @@ config USB_CONFIGFS_F_FS
implemented in kernel space (for instance Ethernet, serial or
mass storage) and other are implemented in user space.

config USB_CONFIGFS_F_ACC
bool "Accessory gadget"
depends on USB_CONFIGFS
select USB_F_ACC
help
USB gadget Accessory support

config USB_CONFIGFS_F_UAC1
bool "Audio Class 1.0"
depends on USB_CONFIGFS
Expand Down
2 changes: 2 additions & 0 deletions drivers/usb/gadget/function/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,5 @@ usb_f_printer-y := f_printer.o
obj-$(CONFIG_USB_F_PRINTER) += usb_f_printer.o
usb_f_tcm-y := f_tcm.o
obj-$(CONFIG_USB_F_TCM) += usb_f_tcm.o
usb_f_accessory-y := f_accessory.o
obj-$(CONFIG_USB_F_ACC) += usb_f_accessory.o

0 comments on commit 5ede414

Please sign in to comment.