The Raspberry Pi Zero USB port may be used as an USB serial port. Here is how I did it.
Modify /boot/config.txt
One will first add a device tree overlay (see Using SPI displays with a Raspberry PI). By adding dtoverlay=dwc2
in /boot/config.txt,
one loads a device tree overlay which modifies the USB OTG configuration to make it more suitable to our needs.
Modify /boot/cmdline.txt
We will then modify the kernel command line and add modules-load=dwc2,g_serial
at its end. This loads the serial gadget.
Starting a getty on the newly created serial port
Simply type sudo systemctl enable This email address is being protected from spambots. You need JavaScript enabled to view it.
. You will then be able to connect a standard USB cable and the host will see a serial device through which you may get a login prompt.
Wait, there's more!
The Raspberry Pi Zero (and of course the Zero W) may appear as many other USB devices. See this Gist: https://gist.github.com/gbaman/50b6cca61dd1c3f88f41 and have fun!
Come back, there's even more!
http://isticktoit.net/?p=1383 has a very complete article on the subject of USB Gadgets. The kernel documentation is of course also a good read!