New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qvm-usb: Device attach failed for Android 6 in Debugging mode #2202

Closed
grote opened this Issue Jul 27, 2016 · 6 comments

Comments

Projects
None yet
4 participants
@grote

grote commented Jul 27, 2016

Qubes OS version

R3.2

Affected TemplateVMs

fedora-23

Expected behavior:

qvm-usb -a dev sys-usb:3-2 attaches USB device to AppVM 'dev'.

Actual behavior:

USB is not attached. This error is shown: ERROR: Device attach failed
stderr and stdout of the call make by qubesutils.py is empty and None.

Steps to reproduce the behavior:

  1. Attach Android 6.0.1 device with activated ADB mode to USB port
  2. Call qvm-usb to see where it got attached
  3. Call qvm-usb -a dev sys-usb:3-2 to attach it to running 'dev' AppVM
  4. See how attaching fails without any helpful error messages.

General notes:

This happens with an Android 6.0.1 device running CyanogenMod. Please note that attaching an old LG phone in Android debugging mode works just phone. I don't have other phones here at the moment to do more tests.

If I switch debugging mode off, the device attaches just fine. However, when I activate debugging mode on the device, it gets detached from the VM again. dmesg in sys-usb shows this:

[ 8525.456374] usbip-host 3-2: usbip-host: register new device (bus 3 dev 45)
[ 8525.466994] usbip-host 3-2: stub up

Now I activate Android debugging mode on the device.

[ 8539.612454] usbip-host 3-2: USB disconnect, device number 45
[ 8539.612926] usbip-host 3-2: recv a header, 0
[ 8539.612954] usbip-host 3-2: lock for reset
[ 8539.948110] usb 3-2: new high-speed USB device number 46 using xhci_hcd

Of course, I also tried rebooting the phone, using other USB cables, etc.
The phone was working just fine before using QubesOS on the same hardware.

Help for debugging this further would be greatly appreciated as I need to attach this device for work.

@andrewdavidwong

This comment has been minimized.

Show comment
Hide comment
@andrewdavidwong

andrewdavidwong Jul 27, 2016

Member

We closed #1375 on the grounds that Android devices are not block devices and therefore not among the supported device types for USB attachment.

Does toggling "debugging mode" affect whether the device appears as a USB mass storage device?

Member

andrewdavidwong commented Jul 27, 2016

We closed #1375 on the grounds that Android devices are not block devices and therefore not among the supported device types for USB attachment.

Does toggling "debugging mode" affect whether the device appears as a USB mass storage device?

@grote

This comment has been minimized.

Show comment
Hide comment
@grote

grote Jul 27, 2016

Hi @andrewdavidwong,

thanks for answering so quickly. I read #1375 before opening this one, but it is unrelated. This is not about block devices, mass storage mode, MTP or PTP.

This is about an Android USB device failing to attach to a different AppVM when USB debugging or the Android Debug Brigde is activated. This is used by Android developers to test their apps on real hardware.

grote commented Jul 27, 2016

Hi @andrewdavidwong,

thanks for answering so quickly. I read #1375 before opening this one, but it is unrelated. This is not about block devices, mass storage mode, MTP or PTP.

This is about an Android USB device failing to attach to a different AppVM when USB debugging or the Android Debug Brigde is activated. This is used by Android developers to test their apps on real hardware.

@marmarek

This comment has been minimized.

Show comment
Hide comment
@marmarek

marmarek Jul 27, 2016

Member

I bet it was already reported some time ago, but can't find it just now. The result of debugging was that Android trigger device disconnect as soon as driver is detached from the device. Which is part of the process of attaching the device using qvm-usb. So, it won't fly, unfortunately.
But you can use ADB over TCP.

Member

marmarek commented Jul 27, 2016

I bet it was already reported some time ago, but can't find it just now. The result of debugging was that Android trigger device disconnect as soon as driver is detached from the device. Which is part of the process of attaching the device using qvm-usb. So, it won't fly, unfortunately.
But you can use ADB over TCP.

@grote

This comment has been minimized.

Show comment
Hide comment
@grote

grote Jul 27, 2016

So, it won't fly, unfortunately.

:(

But you can use ADB over TCP.

Ok thank you very much, I will look into this then.

grote commented Jul 27, 2016

So, it won't fly, unfortunately.

:(

But you can use ADB over TCP.

Ok thank you very much, I will look into this then.

@grote

This comment has been minimized.

Show comment
Hide comment
@grote

grote Jul 28, 2016

Just in case other people stumble upon this:

ADB over TCP works nicely. To activate, go to Developer Options in Settings -> Debugging - > Activate "ADB over network" and note the IP:port (e.g. 192.168.0.1:5555) that shows up below the setting.

In your development AppVM type the following:

adb connect IP:port

Then your device should show up in Android Studio.

This is not a fix for this issue, but a workaround.

grote commented Jul 28, 2016

Just in case other people stumble upon this:

ADB over TCP works nicely. To activate, go to Developer Options in Settings -> Debugging - > Activate "ADB over network" and note the IP:port (e.g. 192.168.0.1:5555) that shows up below the setting.

In your development AppVM type the following:

adb connect IP:port

Then your device should show up in Android Studio.

This is not a fix for this issue, but a workaround.

@rustybird

This comment has been minimized.

Show comment
Hide comment
@rustybird

rustybird Oct 6, 2016

In my experience with Android 6 (CM13 on a Nexus 7), attaching works iff at least one of the following conditions is satisified before calling qvm-usb --attach:
1. ADB is enabled on the device and the screen is unlocked
2. The adb daemon is running (as root) on the target VM

Never mind - at some point in the CM13 release cycle, it broke for me too.

rustybird commented Oct 6, 2016

In my experience with Android 6 (CM13 on a Nexus 7), attaching works iff at least one of the following conditions is satisified before calling qvm-usb --attach:
1. ADB is enabled on the device and the screen is unlocked
2. The adb daemon is running (as root) on the target VM

Never mind - at some point in the CM13 release cycle, it broke for me too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment