2

I'm using this repo to run MacOS High Sierra on my Arch Linux. All is fine, however cannot seem to get USB passthrough working for my Lego NXT (current Lego Mindstorms software doesn't support NXT 2.0) or any other USB passthrough for that matter.

Here's my basic.sh modified from above repo

#!/bin/bash

OSK="ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc"
VMDIR=$PWD
OVMF=$VMDIR/firmware
#export QEMU_AUDIO_DRV=pa
#QEMU_AUDIO_DRV=pa

qemu-system-x86_64 \
    -enable-kvm \
    -m 2G \
    -machine q35,accel=kvm \
    -smp 4,cores=2 \
    -cpu Penryn,vendor=GenuineIntel,kvm=on,+sse3,+sse4.2,+aes,+xsave,+avx,+xsaveopt,avx2,+bmi2,+smep,+bmi1,+fma,+movbe,+invtsc \
    -device isa-applesmc,osk="$OSK" \
    -smbios type=2 \
    -drive if=pflash,format=raw,readonly,file="$OVMF/OVMF_CODE.fd" \
    -drive if=pflash,format=raw,file="$OVMF/OVMF_VARS-1024x768.fd" \
    -vga qxl \
    -device ich9-intel-hda -device hda-output \
    -usb -device usb-kbd -device usb-mouse \
    -netdev user,id=net0 \
    -device e1000-82545em,netdev=net0,id=net0,mac=52:54:00:c9:18:27 \
    -device ich9-ahci,id=sata \
    -drive id=ESP,if=none,format=qcow2,file=ESP.qcow2 \
    -device ide-hd,bus=sata.2,drive=ESP \
    -drive id=InstallMedia,format=raw,if=none,file=BaseSystem.img \
    -device ide-hd,bus=sata.3,drive=InstallMedia \
    -drive id=SystemDisk,if=none,file=osx-hs.qcow2 \
    -device ide-hd,bus=sata.4,drive=SystemDisk \
    -device qemu-xhci,id=xhci -device usb-host,bus=xhci.0,hostbus=1,hostaddr=11 \

I've tried following the Arch wiki page, by explicitly passing through the device itself, but also passing the bus/address of the USB port as above. None seem to have any impact on the listed USB ports in the MacOS VM.

I've also tried vfio-pci to passthrough a USB controller, however my host system is a Macbook Air 2015, so USB ports are all on the same bus. So when I try modprobe to switch the driver to vfio, Arch logs out of i3 to a terminal and the keyboard stops working (presumably the kb is on the same USB bus). I'm running Arch Linux from USB, don't know if that matters... I figured it should be fairly simple to do a USB device or port passthrough...

Any ideas? Would I have better success with a Windows 10 KVM?

1 Answer 1

2

I just got this to work although the MacOS wasn't the issue. The user I was running qemu with didn't have access to the usb device I was trying to pass trough, e.g.

$ ll /dev/bus/usb/003/014
$ crw-rw-r-- 1 root root 189, 269 Sep 29 21:55 /dev/bus/usb/003/014

Once I did a

sudo chown $(whoami) /dev/bus/usb/003/014

The passthrough worked without problems.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .