Skip to content

Commit b2f4e24

Browse files
committed
usb: device: remove loopback function in favor of new device stack
This function is used for testing purposes only, there is no real use for it in a user application. Remove in favor of implementation in new device stack. Also remove the part of the documentation that depends on loopback. Documentation on how to implement your own USB device function using the new USB device support will follow during the documentation rework. Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
1 parent 3b1f1be commit b2f4e24

File tree

6 files changed

+2
-256
lines changed

6 files changed

+2
-256
lines changed

doc/connectivity/usb/device/usb_device.rst

Lines changed: 2 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -389,61 +389,6 @@ BOS descriptor and handled by the stack.
389389

390390
See :zephyr:code-sample:`legacy-webusb` sample for reference.
391391

392-
Implementing a non-standard USB class
393-
*************************************
394-
395-
The configuration of USB device is done in the stack layer.
396-
397-
The following structures and callbacks need to be defined:
398-
399-
* Part of USB Descriptor table
400-
* USB Endpoint configuration table
401-
* USB Device configuration structure
402-
* Endpoint callbacks
403-
* Optionally class, vendor and custom handlers
404-
405-
For example, for the USB loopback application:
406-
407-
.. literalinclude:: ../../../../subsys/usb/device/class/loopback.c
408-
:language: c
409-
:start-after: usb.rst config structure start
410-
:end-before: usb.rst config structure end
411-
:linenos:
412-
413-
Endpoint configuration:
414-
415-
.. literalinclude:: ../../../../subsys/usb/device/class/loopback.c
416-
:language: c
417-
:start-after: usb.rst endpoint configuration start
418-
:end-before: usb.rst endpoint configuration end
419-
:linenos:
420-
421-
USB Device configuration structure:
422-
423-
.. literalinclude:: ../../../../subsys/usb/device/class/loopback.c
424-
:language: c
425-
:start-after: usb.rst device config data start
426-
:end-before: usb.rst device config data end
427-
:linenos:
428-
429-
430-
The vendor device requests are forwarded by the USB stack core driver to the
431-
class driver through the registered vendor handler.
432-
433-
For the loopback class driver, :c:func:`loopback_vendor_handler` processes
434-
the vendor requests:
435-
436-
.. literalinclude:: ../../../../subsys/usb/device/class/loopback.c
437-
:language: c
438-
:start-after: usb.rst vendor handler start
439-
:end-before: usb.rst vendor handler end
440-
:linenos:
441-
442-
The class driver waits for the :makevar:`USB_DC_CONFIGURED` device status code
443-
before transmitting any data.
444-
445-
.. _testing_USB_native_sim:
446-
447392
Interface number and endpoint address assignment
448393
************************************************
449394

@@ -508,6 +453,8 @@ prevent you from implementing a hardware-clone firmware. Instead, if possible,
508453
the host driver implementation should be fixed to use values from the interface
509454
and endpoint descriptor.
510455

456+
.. _testing_USB_native_sim:
457+
511458
Testing over USBIP in native_sim
512459
********************************
513460

subsys/usb/device/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ config USB_REQUEST_BUFFER_SIZE
9595
range 8 65536
9696
default 256 if USB_DEVICE_NETWORK_RNDIS
9797
default 266 if (USB_DEVICE_BLUETOOTH && USB_DEVICE_BLUETOOTH_BIG_BUF)
98-
default 1024 if USB_DEVICE_LOOPBACK
9998
default 128
10099

101100
config USB_MAX_ALT_SETTING

subsys/usb/device/class/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
zephyr_sources_ifdef(CONFIG_USB_CDC_ACM cdc_acm.c)
44
zephyr_sources_ifdef(CONFIG_USB_MASS_STORAGE msc.c)
55
zephyr_sources_ifdef(CONFIG_USB_DEVICE_BLUETOOTH bluetooth.c)
6-
zephyr_sources_ifdef(CONFIG_USB_DEVICE_LOOPBACK loopback.c)
76

87
add_subdirectory_ifdef(CONFIG_USB_DEVICE_AUDIO audio)
98
add_subdirectory_ifdef(CONFIG_USB_DEVICE_NETWORK netusb)

subsys/usb/device/class/Kconfig

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ source "subsys/usb/device/class/Kconfig.msc"
99

1010
source "subsys/usb/device/class/Kconfig.bt"
1111

12-
source "subsys/usb/device/class/Kconfig.test"
13-
1412
source "subsys/usb/device/class/netusb/Kconfig"
1513

1614
source "subsys/usb/device/class/hid/Kconfig"

subsys/usb/device/class/Kconfig.test

Lines changed: 0 additions & 15 deletions
This file was deleted.

subsys/usb/device/class/loopback.c

Lines changed: 0 additions & 182 deletions
This file was deleted.

0 commit comments

Comments
 (0)