Skip to content

Commit

Permalink
sim/usb: add sim usb device
Browse files Browse the repository at this point in the history
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
  • Loading branch information
zhangyuan21 authored and acassis committed Mar 3, 2023
1 parent 699c930 commit c61c694
Show file tree
Hide file tree
Showing 14 changed files with 2,700 additions and 0 deletions.
30 changes: 30 additions & 0 deletions arch/sim/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -605,4 +605,34 @@ config SIM_UART3_NAME

endmenu

config SIM_USB_DEV
bool "Linux USB Device"
select USBDEV
---help---
Build in support for simulated usb device

if SIM_USB_DEV

config SIM_USB_RAW_GADGET
bool "Simulated USB Raw Gadget Dev"
default n
depends on HOST_LINUX
---help---
Use USB Raw Gadget and Dummy HCD/UDC to set up virtual
USB Device and Host controller that connected to each
other inside the kernel.

Get Raw Gadget:
Get Raw Gadget code at https://github.com/xairy/raw-gadget.

Make Raw Gadget:
Run make in the raw_gadget and dummy_hcd directory. If raw_gadget
build fail, you need to check which register interface meets your
kenel version, usb_gadget_probe_driver or usb_gadget_register_driver.

Install Raw Gadget:
Run ./insmod.sh in the raw_gadget and dummy_hcd directory.

endif

endif # ARCH_SIM
7 changes: 7 additions & 0 deletions arch/sim/src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,13 @@ ifeq ($(CONFIG_SIM_SPI_LINUX),y)
HOSTSRCS += sim_linuxspi.c
endif

ifeq ($(CONFIG_SIM_USB_DEV),y)
CSRCS += sim_usbdev.c
ifeq ($(CONFIG_SIM_USB_RAW_GADGET),y)
HOSTSRCS += sim_rawgadget.c
endif
endif

ifeq ($(CONFIG_RPTUN),y)
CSRCS += sim_rptun.c
endif
Expand Down
Loading

0 comments on commit c61c694

Please sign in to comment.