Toon2 USB serial port

Forum about Toon hardware, both versions 1 and 2 of Toon

Moderators: marcelr, TheHogNL, Toonz

Post Reply
TheHogNL
Forum Moderator
Forum Moderator
Posts: 2125
Joined: Sun Aug 20, 2017 8:53 pm

Toon2 USB serial port

Post by TheHogNL »

For the owner of a rooted Toon 2 you can now connect to a serial port on the Toon 2. However it is a simulated serial port over the USB connection. The only reason I can think of to use this is to test some wifi functions. But then again, maybe there are other reasons.

Code: Select all

#use the update script to enable the VPN to allow opkg downloads
sh update-rooted.sh -o

#update the opkg database
opkg update

#install necessary modules
opkg install kernel-module-usb-f-acm kernel-module-ci-hdrc-imx

#enable the modules
modprobe usb_f_acm
modprobe ci_hdrc_imx

#mount configfs
mount -t configfs none /sys/kernel/config

#create the usb gadget
mkdir -p /sys/kernel/config/usb_gadget/g.1
cd /sys/kernel/config/usb_gadget/g.1

# configure USB params
echo 0x066F > idVendor
echo 0x37FF > idProduct
mkdir -p strings/0x409
cat /proc/device-tree/chosen/quby/sn > strings/0x409/serialnumber

# create the configuration (idempotent)
mkdir -p configs/c.1
echo 120 > configs/c.1/MaxPower

# create the function (idempotent)
mkdir -p functions/acm.0

# associate the function (idempotent)
ln -sf functions/acm.0 configs/c.1

# disable the USB gadget (idempotent)
if [ -n "$(cat UDC)" ]; then
        echo "" >UDC
fi

# enable the USB gadget
echo "ci_hdrc.0" >UDC


#connect your pc via a normal USB cable to the toon (you need a USB-A to USB-A, or if you have a USB-C port on your computer you could use a USB-A to USB-C)
#start getty manually:
su root -c "/sbin/getty 38400 ttyGS0" &

#connect to the toon2 with putty on the com-port which your computer created and use baud 38400
This is not boot-proof. To make it boot proof you need to make some boot scripts. However it is only working after this script, so during boot this USB serial port is useless.

Proof:
unknown.png
unknown.png (23.8 KiB) Viewed 8224 times
Member of the Toon Software Collective
Post Reply

Return to “Toon Hardware”