#
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
|
#
9a1a7caa |
|
07-Aug-2018 |
Jocelyn Dang <jocelyndang@google.com> |
[uapp][usb-test-fwloader] Add updating usb-tester. If there is no FX3 device connected, we try to look for a usb-tester device, and set it to fwloader mode. This will cause it to re-enumerate as a FX3 device and we can then load the new firmware. TEST= plug in FX3 device fx shell usb-test-fwloader firmware.img fx shell usb-test-fwloader updated-firmware.img runtests -t usb-test Change-Id: If5ebc75461b14bd07ab911ea59fbc7155b3de336
|
#
da66960a |
|
31-Jul-2018 |
Jocelyn Dang <jocelyndang@google.com> |
[dev][fx3] Loads firmware onto FX3 for usb testing. The usb-test-fwloader app reads the firmware image into a vmo, and passes the vmo to fx3 to load and run. TEST= plug in FX3 board, copy firmware image to zircon and run fx shell usb-test-fwloader firmware.img Change-Id: I472121179c92686574e888c85be026bc5eae081c
|