My goal is to pass a tty device from the host to guest in Qemu.
I'm trying to emulate a ARM64 linux device using Qemu that has a USB-CDC device plugged into it. So far, I have emulated said USB-CDC device by passing simulated data via UDP to a pts device on my host machine like so:
sudo socat -d -d UDP-L:14550 pty,link=/dev/ttyFAKEACM0,raw,echo=0
I can use minicom on the host machine to read ttyACM0 and I get the data I expect.
I want to pass /dev/ttyFAKEACM0 on the host machine to the guest Qemu and have it show up as a tty on the guest. I have attempted to use -chardev like so:
qemu-system-aarch64 \
-m 4G \
-smp 4 \
-cpu cortex-a57 \
-M virt -nographic \
-kernel ${IMGDIR}/Image \
-initrd ${IMGDIR}/uInitrd-5.7.0 \
-append "root=/dev/vda1 serial=tty0 ubootpart=00000000-01 console=ttyAMA0,115200n8 rootwait init=/sbin/init rw earlyprintk rootfstype=ext4" \
-drive if=none,id=mmc0,file=${IMGDIR}/edge-rootfs.img,index=1,format=raw \
-device virtio-blk-device,drive=mmc0 \
-chardev tty,path=/dev/ttyFAKEACM0,id=facm \
-device pci-serial,chardev=facm
When i start Qemu ttyFAKEACM0 does not show up at all in the guest. Am I misunderstanding how chardev works? How can pass a character device from the host to guest?
Thanks