Android Emulator USB Passthrough Won't Connect
Asked Answered
I

0

7

The standard Android Emulator that comes with Android Studio is a derivative of the QEMU CPU emulator. QEMU supports USB passthrough. I.e. you can connect a USB device to your computer and the Android emulator should pick up that device as though it were connected to the emulated phone. I need to get this working so that I can debug transfer to a USB device ( Trezor hardware wallet ) via the Android emulator.

Apparently, we can pass QEMU command line args to the Android emulator with the -qemu parameter. I pieced together this call which I think is correct:

emulator -avd pixel_2_pie_9_0_-_api_28 -qemu -usb -device usb-host,vendorid=4617,productid=21441

But, I get these errors:

C:\Program Files (x86)\Android\android-sdk\emulator>emulator -avd pixel_2_pie_9_0_-_api_28 -qemu -usb -device usb-host,vendorid=4617,productid=21441 Failed to open /qemu.conf, err: 2 Windows Hypervisor Platform accelerator is operational C:\Program Files (x86)\Android\android-sdk\emulator\qemu\windows-x86_64\qemu-system-x86_64.exe: libusb_kernel_driver_active: -12 [NOT_SUPPORTED] C:\Program Files (x86)\Android\android-sdk\emulator\qemu\windows-x86_64\qemu-system-x86_64.exe: libusb_kernel_driver_active: -12 [NOT_SUPPORTED] C:\Program Files (x86)\Android\android-sdk\emulator\qemu\windows-x86_64\qemu-system-x86_64.exe: libusb_kernel_driver_active: -12 [NOT_SUPPORTED] C:\Program Files (x86)\Android\android-sdk\emulator\qemu\windows-x86_64\qemu-system-x86_64.exe: libusb_kernel_driver_active: -12 [NOT_SUPPORTED] C:\Program Files (x86)\Android\android-sdk\emulator\qemu\windows-x86_64\qemu-system-x86_64.exe: libusb_kernel_driver_active: -12 [NOT_SUPPORTED] C:\Program Files (x86)\Android\android-sdk\emulator\qemu\windows-x86_64\qemu-system-x86_64.exe: libusb_kernel_driver_active: -12 [NOT_SUPPORTED] C:\Program Files (x86)\Android\android-sdk\emulator\qemu\windows-x86_64\qemu-system-x86_64.exe: libusb_kernel_driver_active: -12 [NOT_SUPPORTED] C:\Program Files (x86)\Android\android-sdk\emulator\qemu\windows-x86_64\qemu-system-x86_64.exe: libusb_kernel_driver_active: -12 [NOT_SUPPORTED] C:\Program Files (x86)\Android\android-sdk\emulator\qemu\windows-x86_64\qemu-system-x86_64.exe: libusb_kernel_driver_active: -12 [NOT_SUPPORTED] C:\Program Files (x86)\Android\android-sdk\emulator\qemu\windows-x86_64\qemu-system-x86_64.exe: libusb_kernel_driver_active: -12 [NOT_SUPPORTED] C:\Program Files (x86)\Android\android-sdk\emulator\qemu\windows-x86_64\qemu-system-x86_64.exe: libusb_kernel_driver_active: -12 [NOT_SUPPORTED] C:\Program Files (x86)\Android\android-sdk\emulator\qemu\windows-x86_64\qemu-system-x86_64.exe: libusb_kernel_driver_active: -12 [NOT_SUPPORTED] C:\Program Files (x86)\Android\android-sdk\emulator\qemu\windows-x86_64\qemu-system-x86_64.exe: libusb_kernel_driver_active: -12 [NOT_SUPPORTED] C:\Program Files (x86)\Android\android-sdk\emulator\qemu\windows-x86_64\qemu-system-x86_64.exe: libusb_kernel_driver_active: -12 [NOT_SUPPORTED] C:\Program Files (x86)\Android\android-sdk\emulator\qemu\windows-x86_64\qemu-system-x86_64.exe: libusb_kernel_driver_active: -12 [NOT_SUPPORTED] C:\Program Files (x86)\Android\android-sdk\emulator\qemu\windows-x86_64\qemu-system-x86_64.exe: libusb_kernel_driver_active: -12 [NOT_SUPPORTED] emulator: Saving state on exit with session uptime 51341 ms

The reason I think that this is correct is that if I unplug the device, or specify the incorrect vid/pid, I get a very different message with no errors:

C:\Program Files (x86)\Android\android-sdk\emulator>emulator -avd pixel_2_pie_9_0_-_api_28 -qemu -usb -device usb-host,vendorid=4617,productid=21441 Failed to open /qemu.conf, err: 2 Windows Hypervisor Platform accelerator is operational

In other words, I think that it is erroring because it recognises the device, tries to perform the passthrough, but can't. This might be a libusb error, but I do know that libusb does support this device. I've used it many times on this device. Also, I know that this device works with Android because I've written apps for it.

Does anyone have USB passthrough working on the Android emulator? If you've got it working with vanilla QEMU, that would also be very helpful. What am I doing wrong? Do I need to create the device with any special properties?

Itch answered 27/12, 2020 at 21:37 Comment(3)
Please help me for the question #65473566Proliferation
Hi Christian, did you ever get this working for QEMU/Android Emulator on Windows?Reber
No I didn't ...Itch

© 2022 - 2024 — McMap. All rights reserved.