When it runs, if you chose to install graphical desktop environment, you will be able to click on its icon and use it as if it were, for example, the storage space of a connected smartphone. We will create an MTP device with cmtp-responder. From this moment on gadgets can be composed, for example with the gt. Thanks to the enabled USB gadget, and the presence of our virtual UDC, /sys/kernel/config should now contain usb_gadget directory. As recent Debian releases come by default with systemd, your ConfigFS should be automatically mounted by /lib/systemd/system/sys-kernel-coonfig.mount unit under /sys/kernel/config. We have chosen to enable ConfigFS support. Once dummy_udc.0 is there, your PC is ready to emulate USB gadget hardware! ConfigFS If it is not, verify that all the previous steps have succeeded. To confirm, do this: ls -l /sys/class/udcĭummy_udc.0 should be there. Thanks to the fact that we enabled the relevant bits of the kernel, we should have dummy_hcd up and running now. Let's fix it! The kernelĮnsure the following options are set in the kernel config: CONFIG_CONFIGFS_FS=y # ConfigFS supportĬONFIG_USB_GADGET=y # USB gadget frameworkĬONFIG_USB_DUMMY_HCD=y # dummy_hcd, our emulated USB host and deviceĬONFIG_USB_CONFIGFS=y # composing USB gadgets with ConfigFSĬONFIG_USB_CONFIGFS_F_FS=y # make FunctionFS a component for creating USB gadgets with ConfigFSĬompile and install the kernel your favorite way. Unfortunately, the default kernel has neither ConfigFS nor dummy_hcd support turned on. Once complete, you can then install libusbgx and gt. Run this: apt-get install gcc g++ libconfig-dev cmake git autoconf libtool asciidoc-base libncurses-dev flex bison build-essential fakeroot libelf-dev libssl-dev bc libglib2.0-dev libsystemd-dev usbutils # gt and cmtp-responder use cmake to generate Makefiles # to satisfy cmake the easy way, but otherwise not used) The description will be Debian-based, so for other systems you need to adjust it accordingly.
Of course we also need some gadget to run, so why don't we use cmtp-responder? You might also want to read about USB gadgets here and here. In other words, this means you can play with USB gadgets even if you don't have the appropriate hardware, because your PC can act as both a USB host and a USB device.
#Lsusb apt get how to
In this article, I promised to tell you how to use dummy_hcd, which consists of a software-emulated host controller and a UDC chip.