Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
g_serial as USB serial console
#/bin/bash
# Enable kernel module
echo "g_serial" >> /etc/modules
nano /etc/inittab
```
::respawn:/sbin/getty -L ttyAM0 115200 vt100
::respawn:/sbin/getty -L ttyGS0 115200 vt100
```
# Add systemd service
mkdir -p /etc/systemd/system/serial-getty@ttyGS0.service.d
nano /etc/systemd/system/serial-getty@ttyGS0.service.d/10-switch-role.conf
```
[Service]
ExecStartPre=-/bin/sh -c "echo 2 > /sys/bus/platform/devices/sunxi_usb_udc/otg_role"
```
# Start service
systemctl --no-reload enable serial-getty@ttyGS0.service
echo "ttyGS0" >> /etc/securetty
reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment