usb: session renewal & new client API

Replace the USB session API by one that provides a devices ROM only,
which contains information about all USB devices available for this client,
as well as methods to acquire and release a single device.

The acquisition of an USB device returns the capability to a device session
that includes a packet stream buffer to communicate control transfers
in between the client and the USB host controller driver. Moreover,
additional methods to acquire and release an USB interface can be used.

The acquisition of an USB interface returns the capability to an interface
session that includes a packet stream buffer to communicate either
bulk, interrupt, or isochronous transfers in between the client and the
USB host controller driver.

This commit implements the API changes in behalf of the Genode C API's
USB server and client side. Addtionally, it provides Usb::Device,
Usb::Interface, and Usb::Endpoint utilities that can be used by native
C++ clients to use the new API and hide the sophisticated packet stream API.

The adaptations necessary target the following areas:

* lx_emul layer for USB host and client side
* Linux USB host controller driver port for PC
* Linux USB client ports: usb_hid_drv and usb_net_drv, additionally
  reduce the Linux tasks used inside these drivers
* Native usb_block_drv
* black_hole component
* Port of libusb, including smartcard and usb_webcam driver depending on it
* Port of Qemu XHCI model library, including vbox5 & vbox6 depending on it
* Adapt all run-scripts and drivers_interactive recipes to work
  with the new policy rules of the USB host controller driver

Fix genodelabs/genode#5021
This commit is contained in:
Stefan Kalkowski
2023-09-14 10:55:11 +02:00
committed by Christian Helmuth
parent 6e437674f7
commit 7ec08af6d9
98 changed files with 6937 additions and 9053 deletions

View File

@ -113,7 +113,7 @@ set config {
<provides> <service name="Usb"/> </provides>
<config bios_handoff="no">
<report devices="yes"/>
<policy label_prefix="usb_hid_drv" class="0x3"/>
<policy label_prefix="usb_hid_drv"><device class="0x3"/></policy>
</config>
<route>
<service name="Report"> <child name="drivers_reports"/> </service>
@ -123,7 +123,6 @@ set config {
<start name="usb_hid_drv" caps="140">
<resource name="RAM" quantum="10M"/>
<config use_report="yes"/>
<route>
<service name="ROM" label="report"> <child name="drivers_reports"/> </service>
<service name="Event"> <child name="event_filter" label="usb"/> </service>

View File

@ -79,7 +79,7 @@ install_config {
</start>
<start name="test-smartcard" caps="150">
<resource name="RAM" quantum="4M"/>
<resource name="RAM" quantum="5M"/>
<config>
<vfs>
<dir name="dev">
@ -106,7 +106,7 @@ install_config {
append usb_config {
<config bios_handoff="yes">
<report devices="yes"/>
<policy label="test-smartcard -> usb_device" vendor_id="} [smartcard_vendor_id] {" product_id="} [smartcard_product_id] {"/>
<policy label="test-smartcard -> "><device vendor_id="} [smartcard_vendor_id] {" product_id="} [smartcard_product_id] {"/></policy>
</config>}
set fd [open [run_dir]/genode/usb_host_drv.config w]
puts $fd $usb_config

View File

@ -87,7 +87,7 @@ append config {
</start>
<start name="platform_drv" caps="100" managing_system="yes">
<resource name="RAM" quantum="1M"/>
<resource name="RAM" quantum="2M"/>
<provides>
<service name="Platform"/>
</provides>
@ -108,8 +108,9 @@ append config {
<!-- <resource name="CPU" quantum="10"/> -->
<provides><service name="Usb"/></provides>
<config bios_handoff="no">
<policy label_suffix="usb_webcam -> usb_device"
vendor_id="} [libuvc_vendor_id] {" product_id="} [libuvc_product_id] {"/>
<policy label_suffix="usb_webcam -> ">
<device vendor_id="} [libuvc_vendor_id] {" product_id="} [libuvc_product_id] {"/>
</policy>
</config>
<route>
<any-service> <parent/> <any-child/> </any-service>
@ -161,7 +162,7 @@ append config {
<service name="Capture"/>
</parent-provides>
<start name="} $test_binary {" caps="100">
<resource name="RAM" quantum="8M"/>
<resource name="RAM" quantum="15M"/>
<config period_ms="20" width="640" height="480"> }
append config $test_vfs_config
append config {
@ -200,7 +201,7 @@ append config {
<start name="webcam" priority="-1" caps="800">
<binary name="init"/>
<resource name="RAM" quantum="64MB"/>
<resource name="RAM" quantum="64M"/>
<route>
<service name="ROM" label="config"> <parent label="usb_webcam.config"/> </service>
<service name="Timer"> <child name="timer"/> </service>