# Raspberry as Serial Gadget - USB Console



## weberjn (Sep 11, 2022)

This Tutorial shows how you can a turn a raspberry pi into a serial gadget, plug in an usb cable and access the raspbian console with e.g. putty from Windows. I tried with a zero 2 w, it worked.
An important step is activating the getty@ttyGS0.service to tie the port to a console.

Can you do that with FreeBSD, too? Connect a raspberry running FreeBSD via USB to a Laptop and access the FreeBSD console over USB? If yes, does this work with any device, not only a raspberry?


----------



## covacat (Sep 11, 2022)

it works for pi zero. the device should support usb OTG for this to be possible


----------



## Phishfry (Sep 12, 2022)

weberjn said:


> If yes, does this work with any device, not only a raspberry?


I dunno about any, but many Arm boards OTG over USB works. I have used both USB3c-connector and microB.
The usb gadget driver has to support it.
cu -s 1500000 -l /dev/ttyU0
No different then a serial console except the device node name.
Beaglebone had different modes where it showed USB Gadget or Mass Storage Device for the MMC.
So you could flash the eMMC via OTG USB.


----------



## SirDice (Sep 12, 2022)

weberjn said:


> Can you do that with FreeBSD, too?


27.6. Setting Up the Serial Console


----------

