devices – Control: ConfiguraJon, status, and control commands • Always one per device called “endpoint 0” – Interrupt: Small, High-priority control commands – Bulk: Data transfer – Isochronous: Real-Jme data transfer • Interface: CollecJon of zero or more endpoints – Represents a “logical” device class. • ConfiguraJon: CollecJon of one or more interfaces – Only one can be acJve at a Jme • Device Class/Subclass/Protocol – USB.org SpecificaJon for device funcJonality – Special Device Class Codes • Human Interface Device (HID) (Class 0x03) • Mass Storage (Class 0x08) • 0x00 = Per-Interface (Composite) • 0xFF = Vendor-Specific 4 ConfiguraJon 0 Interface 1 Interface 0 Endpoint 0 Endpoint Interrupt IN Endpoint 0 Endpoint Bulk IN Endpoint Bulk OUT
Size Type 1 0x02 Total Length 2 Total Length of response Interface Count 1 Number of interfaces Value 1 SelecJon Index String Index 1 String Descriptor of Name Abributes 1 Power Type, Remote Wakeup Max Power 1 Power ConsumpJon (2mA units) Device Field Size Descrip@on Length 1 Descriptor Size Type 1 0x01 USB Spec 2 USB SpecificaJon Version Class 1 Class Code SubClass 1 SubClass Code Protocol 1 Protocol Code Max Packet Size 1 Packet size for EP0: 8, 16, 32, 64 VendorID 2 USB.org Vendor ID ProductID 2 Usb.org Product ID Device Release 2 Device Release Number Manufacturer 1 Manufacturer String Descriptor Product 1 Product String Descriptor Serial Number 1 Serial Number String Descriptor Config Count 1 Number of configuraJons
Size Type 1 0x04 Value 1 SelecJon Index Alternate Seeng 1 Endpoint Count 1 Number of endpoints Class 1 Interface Class Code Subclass 1 Interface Subclass Code Protocol 1 Interface Protocol Code String Index 1 String Descriptor of Name Endpoint Field Size Descrip@on Length 1 Descriptor Size Type 1 0x05 Address 1 Number and DirecJon Abributes 1 Type and SynchronizaJon Max Packet Size 2 Max bytes capable of RX/TX Interval 1 Interval for polling, in frames String Field Size Descrip@on Length 1 Descriptor Size Type 1 0x03 String N Unicode Characters
– Some 2.3.4+ devices have Add-On library (com.android.future.usb) – CommunicaJon with apps only • AddiJonal features added in 4.1 – CommunicaJon directly with OS • Android Open Accessory (AOA) Protocol – Google custom protocol • Accessory is a USB Host – Responsible for power, enumerate, iniJate • Accessory responsible for configuring Android device in accessory mode 8
2.3.4) – Single interface to communicate with an Android applicaJon • Bulk data transfer between applicaJon and accessory • AOA v2.0 – Android 4.1 – Adds Audio Support • Android device may send audio to accessory (only currently supported mode) – Adds Accessory HID • Accessory may act as one or more USB Devices implemenJng a standard HID device class • AOA acts as a thin proxy to pass data directly to Android Input System 9
libraries for OpenAccessory on the following: – Arduino Mega Based (AVR) ADK2011 • USB Host added – Arduino Due Based (ARM) ADK2012 • Bluetooth added – Microchip PIC24F Kits – SparkFun IOIO – FTDI Vinculum-II • ADK DocumentaJon – hbp://developer.android.com/tools/adk/index.html • All schemaJcs for ADK boards and demo shields – hbp://source.android.com/tech/accessories/index.html • Step by step guide to implemenJng OpenAccessory manually
Common on tablets, emerging on phones • Communicate with any standard USB Device – Protocol-level, few high-level funcJons • Android device responsible for power, enumerate, iniJate • High-power device support uncommon – Typically OTG circuitry – <1 power unit typical (<100mA) 17
Synchronous • UsbDeviceConnecJon.bulkTransfer() – IniJate a bulk transfer on a specific UsbEndpoint – Synchronous • UsbRequest.iniJalize() -> UsbRequest.queue() – Create request on a specific UsbEndpoint – Bulk or Interrupt endpoints – Asynchronous 20