History log of /fuchsia/zircon/system/dev/usb/usb-bus/usb-device.c
Revision Date Author Comments
# 79c8b30e 26-Sep-2018 Ruchira Ravoori <ravoorir@google.com>

[zircon][usb-request-cleanup]Remove bti_handle from usb-request

The bti_handle is used only during the physmap which is used only at the
usb infrastructure level and not by the client drivers. This change removes
the bti handle from usb_request_t, and also removes the need for it beeing needed
during the usb_request_alloc. In a later changeset, clients will be using
the usb_request_alloc directly from the usb-request library and not via
the protocol op. This changeset is in preparation for that to work.

Test: Full build. Netbooting on vim2. Plugged in a usb-mass-storage
device and verified lsusb works as expected.

Change-Id: I158917a9cfec1c3b0f2b9ec905c17dbfcc6ecbc7


# 05b27e38 18-Sep-2018 Mike Voydanoff <voydanoff@google.com>

[usb] Add new USB composite protocol

Move two APIs from the USB protocol to the new USB composite protocol.
These two APIs are only implemented in the usb-composite driver,
so should not be in the main USB protocol.

TEST: USB works as expected on NUC. Tested USB audio and CDC ethernet.

Change-Id: If33a1de86e8ff0dfdd0d4e802548f97a5d99ae5d


# 1bd969c8 18-Sep-2018 Mike Voydanoff <voydanoff@google.com>

[usb] Add protocol accessors for current configuration and configuration descriptor.

TEST: USB works as expected on NUC. USB audio works.

Change-Id: Id6df0be6fa1ece4872f653c46c757c641d4a2e72


# 1be83d34 12-Sep-2018 Mike Voydanoff <voydanoff@google.com>

[dev][usb-bus] Refactor usb-bus driver

Previously the usb-bus driver not only managed all USB devices for a USB controller
but also managed creating devmgr devices for each interface on each device.
Now the usb-bus driver only creates devmgr devices for each USB device.
The functionality of creating devmgr devices for USB interfaces is handled by
a new driver called usb-composite, which binds to the devices created by the
usb-bus driver.

We add a new protocol ZX_PROTOCOL_USB_DEVICE to represent a USB device
(the existing ZX_PROTOCOL_USB protocol is used to represent a USB interface).
For now ZX_PROTOCOL_USB_DEVICE and ZX_PROTOCOL_USB both share the same protocol
interface (defined in ddk/protocol/usb.h), but this protocol will be refactored
in an upcoming CL.

The combination of the new usb-bus and usb-composite drivers implement
the same functionality as the old usb-bus driver, so no changes are needed
for existing USB drivers. However drivers have the option of binding directly
to the ZX_PROTOCOL_USB_DEVICE protocol in cases where the driver needs full control
of the USB device. For example, a USB device might have several interfaces that
all need to be accessed by the same driver. In this case, we do not want the
usb-composite driver to create devices for each interface.
To avoid this, the driver can bind to the ZX_PROTOCOL_USB_DEVICE device provided
by the usb-bus driver instead of the usb-composite driver.
The usb-composite driver is marked as a fallback driver to allow that to happen.

Drivers that bind directly to usb-bus with the ZX_PROTOCOL_USB_DEVICE protocol
must do some additional work that is usually handled by usb-composite.
In particular, they must call usb_enable_endpoint() to enable the endpoints
they are using.

In addition to the above, there are some changes to the ioctl interface for USB.
/dev/class/usb-device now contains files for all the USB devices created by the
usb-bus driver. Tools like lsusb should now use this directory instead of
/dev/class/usb.

The devices representing USB interfaces no longer support ioctl. To support that change,
some calls to device_ioctl() have been replaced with protocol calls.
IOCTL_USB_GET_CURRENT_FRAME is replaced by a new usb_get_current_frame() function in the USB protocol.

To help test this new functionality, the usb-hub driver now binds to ZX_PROTOCOL_USB_DEVICE
rather than ZX_PROTOCOL_USB. This means the usb-hub driver binds directly to usb-bus,
with no usb-composite support in between.

TEST: USB on NUC and VIM2 is working as expected. Tested keyboards, USB 2.0 and 3.0 hubs,
mass storage and USB audio.

Change-Id: Ib9f5aa09f8c0ae7ae2e7378f6996181fce5afb11


# cc1b998c 10-Sep-2018 Mike Voydanoff <voydanoff@google.com>

[dev][usb-bus] Fix ioctl_usb_get_config_desc

out_actual was not being set, causing sadness in lsusb

ZX-2596 #done

TEST: ran lsusb -v -d <some device> on VIM2
Change-Id: I08d82a7a220cf0781cb365fbd5ce1f0eb0f7dc50


# 696add84 31-Jul-2018 Ruchira Ravoori <ravoorir@google.com>

[zircon][ulib] Move usb out of driver ulib

This changeset moves usb.c out of the driver ulib and adds a separate
library for itself. In a later changeset some of the usb-request.c
functionality will move in into this library.

Test: Build. Sanity test of usb on vim2

Change-Id: I4807a3327943a71b5b88b22ab5c49756b042d969


# d5ff594f 01-Jun-2018 John Grossman <johngro@google.com>

[usb] Tweak USB string descriptor access.

++ Cache a LANGID string descriptor table, but lazily initialize it.
++ Extend the ioctl API to allow a user to specify a desired LANGID
++ If the user's desired LANGID is not available, default to the first LANGID in
the devices language ID table.
++ Add the ability to fetch string descriptors from the usb interface's DDK
protocol.

Change-Id: I30737d581b31cfadb690c496456c23ec5e7ecfba


# 7837c25b 19-Apr-2018 Ruchira Ravoori <ravoorir@rodete-desktop-imager.corp.google.com>

[zircon][xhci] Initialize TT fields for all the low/full speed devices

The transaction translator fields should be set for all the low/full
speed devices. Currently our code only sets it if the parent is a high
speed hub and does not pass on the TT fields to children of a full speed
or a low speed hub which is connected to a high speed hub. Without this,
the xhc generates errors for the SET_ADDRESS command and the device does
not initialize properly. This changeset does the following:
1. Passes on the TT fields as required.
2. Add a sleep between Address Device and Get Descriptor commands.
Without this, the Get Descriptor command fails on Razer Megalogon headset.
3. Provides error handling for legacy devices that might expect Get
Descriptor request before SET_ADDRESS request.
ZX-1933 #done ZX-1975 #done

Change-Id: I80045a2569ba108f697034dd8c85229a8960bea9


# 58e1f3cc 13-Mar-2018 Mike Voydanoff <voydanoff@google.com>

[ddk][usb] Add support for allocating USB requests to the USB protocol

We will transition to this so we can use the USB controller's BTI in USB requests.

Change-Id: I61a04f57713c55134b005f9ee632561c48baa7ec


# f4b2ff04 23-Oct-2017 Brian Swetland <swetland@google.com>

[ddk] rename dprintf() to zxlogf() to avoid conflicts

dprintf is still defined by ddk/debug.h but with a deprecation warning

Change-Id: I00b34803571c468007e069c1da6a292feba2bc3c


# 7dba1882 16-Oct-2017 Jocelyn Dang <jocelyndang@google.com>

[dev][usb] Finish migrating usb-bus folder to usb_request.

Add .request_queue to usb_hci_protocol_ops_t

Change-Id: Ic21edb57331bfe63da2073f931180b1d70cb5f0d


# db019e05 18-Sep-2017 Mike Voydanoff <voydanoff@google.com>

[dev][usb-bus] Fix bugs in driver unbind path

Change-Id: Icd0c4d7b03faeb19393d0f476d6cd74c2edf8d94


# e9a26dbc 15-Sep-2017 Mike Voydanoff <voydanoff@google.com>

[dev][usb-bus] Handle stalls while reading string descriptors

Some devices don't seem to handle retrieving the language list,
and now we can recover from that.

Change-Id: I879342f2c9731a768eaa4450430f9540fc22f8f9


# dacc1d80 12-Sep-2017 Mike Voydanoff <voydanoff@google.com>

[dev] Rename "mxdev" to "zxdev" in ddktl and various drivers.

Change-Id: I000e42c26d9f8379de40447690694a35f6be93e2


# f3e2126c 12-Sep-2017 Roland McGrath <mcgrathr@google.com>

[zx] Magenta -> Zircon

The Great Renaming is here!

Change-Id: I3229bdeb2a3d0e40fb4db6fec8ca7d971fbffb94


# c1f5c118 07-Sep-2017 Mike Voydanoff <voydanoff@google.com>

[dev][usb-bus] Switch to new DDK dprintf() logging calls

Change-Id: Ia8d967dcea84935467f9950f637963ff534de1d1


# 90f33bb1 05-Sep-2017 Jocelyn Dang <jocelyndang@google.com>

[dev][usb-device] Add functions for claiming interfaces.

Removes special casing for usb-audio and usb-cdc-ecm.

Those drivers will instead call usb_claim_additional_interfaces,
indicating what additional interfaces they require.

usb_claim_additional_interfaces will request the list of
descriptors following the interface's existing descriptor list,
and then check whether to claim the interface.

Claiming an interface appends the descriptors to the descriptor list,
and removes any existing child device.

There can be a race condition between a device being created for a child
interface, and an interface claiming that same interface, so there is a
interface mutex and we track the current availability of an interface
via the interface_statuses array.

Change-Id: I3a9599f21c76b85e9a21f561eb259415bde97308


# 97565d35 03-Aug-2017 Mike Voydanoff <voydanoff@google.com>

[dev][usb-bus] Group CDC Data descriptors with their containing comm descriptor

Change-Id: I094cdde89e526158a5fee48a0aa63cf418974ee5


# f725cfa1 03-Aug-2017 Mike Voydanoff <voydanoff@google.com>

[dev][usb-bus] Add support for overriding default configuration based on VID/PID

By default, we create devices for interfaces on the USB device's first configuration
This change adds a hard coded list of VID/PID pairs to specify using a different
configuration instead. This is just a short term fix until we have a better solution
for dealing with devices with multiple configurations.

Also switch to configuration 2 for a particular Realtek ethernet dongle so we can
use its CDC interface instead of the vendor proprietary interface.

Change-Id: Ife2025a7ac91e39284bc36d678fc2ec64b9893cc


# fa5319e6 06-Jul-2017 Mike Voydanoff <voydanoff@google.com>

[ddk][usb] Remove USB driver support code from the DDK library

Most of the functionality in ddk/common/usb.c has been moved to the USB protocol.
The remainder (usb_iotxn_alloc() and the USB descriptor iterator support) is now
in libdriver.

Function names remain the same, but now take a usb_protocol_t* instead of a
mx_device_t* as its primary argument.

Change-Id: I36d4074eeea5b0c53028636a73dd3910476415af


# 11b5375a 05-Jul-2017 Mike Voydanoff <voydanoff@google.com>

[ddk][usb] Add inline wrappers for USB protocol ops

Change-Id: I925b09dd4d8cbd4dae88b0c4bd9246105a1b4de8


# 053dab5a 14-Jun-2017 Brian Swetland <swetland@google.com>

[ddk][usb-hci] new protocol support (4 of n)

Migrate PROTOCOL_USB_HCI providers and consumers.

Change-Id: I73e25b1caccf5c75d46006facb2b5163d9398077


# b2d14526 09-Jun-2017 Tim Kilbourn <tkilbourn@google.com>

[dev][usb] Use new magenta error names

Change-Id: Ie4901fe957ee96cf7c7d425a948c1b66a0d3a0f3


# 0bc8d058 07-Jun-2017 Brian Swetland <swetland@google.com>

[udev][usb-bus] rename udev/usb-bus to dev/usb/usb-bus

Change-Id: I972a5821eadc4d9d859b8f30998e151c0d0d85e0