cancel
Showing results for 
Search instead for 
Did you mean: 

Configure STLinux as serial USB-gadget?

HMüll.4
Associate III

I'm running a small STM32-board with the original STLinux. This board comes with some kind of USB OTG port. Now I want to configure this port to let it act as serial device, means when I connect it to an other PC via that USB-port, I like to appear it as COM or /dev/ttY* there.

What I have so far is a script which should do the trick:

mkdir -p /sys/kernel/config/usb_gadget/g1
cd /sys/kernel/config/usb_gadget/g1
echo 0x1111 > idVendor
echo 0x2222 > idProduct
mkdir strings/0x409
echo "0DEADBEEF" > strings/0x409/serialnumber
echo "Me, myself and I" > strings/0x409/manufacturer
echo "MyDevice" > strings/0x409/product
mkdir configs/c.1
echo 120 > configs/c.1/MaxPower
modprobe usb_f_acm
mkdir functions/acm.0
ln -s functions/acm.0 configs/c.1
echo 0000:01:00.0 > UDC

The mkdir command works only when I execute this as root and with sudo. But my problem is the last line: It always fails with an

sh: write error: Device or resource busy

Here neither root nor sudo nor both do help. And without that part, the USB-port does not appear as serial device.

So...any idea what is wrong? How can I write to UDC properly? Or is there an other way to configure the USB-port as serial device to the outer world?

Thanks!

0 REPLIES 0