You need to use -M raspi2 (or -M raspi3 for 64-bit kernels) to enable
the Raspberry Pi emulation. And you need version 5.1 or newer of Qemu to
get the dwc2 USB emulation. I don't think any Linux distributions
provide that new of a Qemu, so you might have to build it yourself.

Here is the command line I use to run the Raspbian image 2019-09-26
-raspbian-buster.img. I extracted bcm2709-rpi-2-b.dtb and kernel7.img
from the FAT partition inside the image file.

qemu-system-arm -M raspi2 -drive file=2019-09-26-raspbian-
buster.img,format=raw,if=sd -dtb bcm2709-rpi-2-b.dtb -kernel kernel7.img
-append 'rw earlycon=pl011,0x3f201000 console=ttyAMA0 loglevel=8
root=/dev/mmcblk0p2 fsck.repair=yes net.ifnames=0 rootwait memtest=1
dwc_otg.fiq_fsm_enable=0' -serial stdio -no-reboot -netdev user,id=net0
-usb -device usb-kbd -device usb-tablet -device usb-net,netdev=net0

That should give you a graphical emulation with working keyboard, mouse
and networking. Mass-storage also works, but I left that out for
simplicity.

But note that if you absolutely must pass-through a USB device from the
host, it probably won't work. That's because the dwc2 controller
emulation is connected through a full-speed hub emulation, so unless
your USB device is connected at full-speed on the host, it probably
won't work.

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1772165

Title:
  arm raspi2/raspi3 emulation has no USB support

Status in QEMU:
  Confirmed

Bug description:
  Using Qemu 2.12.0 on ArchLinux.

  Trying to emulate arm device with `qemu-system-arm` and attach usb
  device for unput using

  ` -usb -device usb-host,bus=001,vendorid=0x1d6b,productid=0x0002 `

  # lsusb returns

  Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
  Bus 001 Device 014: ID 13d3:3487 IMC Networks 
  Bus 001 Device 004: ID 0457:11af Silicon Integrated Systems Corp. 
  Bus 001 Device 003: ID 0bda:57e6 Realtek Semiconductor Corp. 
  Bus 001 Device 002: ID 0bda:0129 Realtek Semiconductor Corp. RTS5129 Card 
Reader Controller
  Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

  # qemu returns
  qemu-system-arm: -device usb-host,bus=001,vendorid=0x1d6b,productid=0x0002: 
Bus '001' not found

  
  Tried with connecting external usb keyboard but that didn't seem to work 
either.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1772165/+subscriptions

Reply via email to