Skip to content
Anton Bondarev edited this page Aug 20, 2020 · 11 revisions

Embox supports some USB host controllers for QEMU:

  • echi-pci
  • ohci-pci.

You have to add to the config file

  • include embox.driver.usb.hc.ehci_pci
  • include embox.driver.usb.hc.ohci_pci

respectively to enable one of them. './scripts/qemu/auto_qemu' script recognizes it while starting and adds appropriate qemu options.

Use image as a usb-mass-storage

If you want to enable USB storage on 'qemu' you can just call ./scripts/qemu/auto_qemu_with_usb_storage. It creates image disk, formats one to vfat and adds it to qemu.

You can check that it works correctly with follow:

In Embox shell:

root@embox:/#lsusb

Bus 001 Device 001 ID 46f4:0001

root@embox:/#ls /dev

/dev/sda

root@embox:/#mkdir -v mnt

root@embox:/#mount -t vfat /dev/sda mnt

root@embox:/#touch mnt/21.txt

root@embox:/#umount mnt

Stop qemu and in host shell: $ mkdir tmp

$ sudo mount -t vfat usbdisk.img ./tmp

$ ls tmp/

21.TXT

$ sudo umount ./tmp

$ rmdir tmp

USB hubs

You can try USB hub with ./scripts/qemu/auto_qemu_with_usb_hub (only OHCI hubs supported in QEMU). All the things will be working like with ./scripts/qemu/auto_qemu_with_usb_storage, but additional hub device appears.

USB mouse

You can verify usb mouse on OHCI in the following way:

  • Add to x86/qemu:
    @Runlevel(1) include embox.arch.x86.boot.multiboot(video_mode_set=1, video_width=800, video_height=600, video_depth=16)
    @Runlevel(1) include embox.driver.video.bochs
    @Runlevel(1) include embox.driver.video.fb
    @Runlevel(1) include embox.driver.usb.class.hid
    @Runlevel(3) include embox.init.GraphicMode
    include embox.cmd.testing.input.mouse_fb_test
  • Run ./scripts/qemu/auto_qemu -device usb-mouse
  • mouse_fb_test usb-mouse. Then go to qemu graphical window, press there and move your mouse.

USB-NET

You can use usb-net with qemu. Add to x86/qemu:

@Runlevel(1) include embox.driver.net.usbnet

Then run as usual with ./scripts/qemu/auto_qemu. Now you can use ping, telnet, httpd and so on.

Using real devices

To enable USB-device on qemu start one with following flags:

./scripts/qemu/auto_qemu -device usb-host,hostbus=n,hostaddr=m

where:

hostbus && hostaddr - usb device place which you want to connect. You can show devices list with 'lsusb' command on the host

To format usb-drive follow command: sudo mkfs.msdos -n EmboxFAT -F 12 /dev/sdb 65536 -I can be used

Overview

GSoC

Demos

Supported platforms

Examples

Development

Libraries

Subsystems

Misc

Mybuild - build system

Contributing

Clone this wiki locally