A700 mounting in Linux using gvfs-gphoto2 - Acer Iconia A700 and A510

I could mount my Gnex under Archlinux using gvfs-gphoto2, but I tried it with the Acer 700 and still have no luck. Have somebody successfully mount the sdcard under Linux using any mtp-file transfer?
In Windows it was no problem, but normally I boot Windows only if I have to, so it would be nice, if someone has a workaround for me

Anyone? I`m now on gentoo and have the same problem. Gnex is mounting fine and Acer doesn`t.
I want to fix the problem now and will collect all the information I need to sort this one out!
Here`s the dmesg output:
[14170.686330] usb 1-1.1: New USB device found, idVendor=0502, idProduct=3376
[14170.686334] usb 1-1.1: New USB device strings: Mfr=2, Product=3, SerialNumber=x
[14170.686336] usb 1-1.1: Product: Acer Iconia Tab A700
[14170.686339] usb 1-1.1: Manufacturer: Acer
[14170.686341] usb 1-1.1: SerialNumber: xxxxxxxxxxxx
lsb output:
gentoo-htpc ~ # lsusb
Bus 001 Device 006: ID 0502:3376 Acer, Inc.
Maybe an udev rule will fix it.
I will search further. If anyone have an idea to fix it, then please post it here in this thread. Big thx
Edit: Ok I`ve made a progress.
I emerged mtpfs, created a udev rule, which looks like this:
/etc/udev/rules.d/51-android.rules
SUBSYSTEM=="usb", ATTR{idVendor}=="0502", MODE="0666"
and add the following line to the /etc/fstab:
mtpfs /media/a700 fuse user,noauto,allow_other 0 0
Now I could see the A700 in nautilus but the Internal storage is empty... Hmmmm
Any suggestions?

Related

[Q] Ubuntu 11.04 in VirtualBox on Win7 host - can't access Infuse using adb

I am trying to set up an Ubuntu environment using VirtualBox on my Win7 host but I'm unable to pass my USB-connected Infuse through from the host to Ubuntu. Running adb devices from Ubuntu just outputs "List of devices attached" with no devices listed (my Infuse DOES show when running this out of my Win7 host).
I followed these directions here to set up my udev rules,
http://forum.xda-developers.com/showthread.php?t=570452g
using the below settings in my /etc/udev/rules.d/51-android.rules file but I'm not able to ever see my Infuse when executing the adb command:
1st failed try:
SUBSYSTEM=="usb", ATTR{idVendor}=="04E8", MODE="0666", GROUP="plugdev"
2nd failed try:
SUBSYSTEMS=="usb", ATTRS{idVendor}=="04E8", ATTRS{idProduct}=="681D", MODE="0666", OWNER="<your user name>" #Mass Storage Samsung Infuse 4G
SUBSYSTEMS=="usb", ATTRS{idVendor}=="04E8", ATTRS{idProduct}=="681C", MODE="0666", OWNER="<your user name>" #Debug Samsung Infuse 4G
3rd failed try:
SUBSYSTEMS=="usb", ATTRS{idVendor}=="80ee", ATTRS{idProduct}=="0021", MODE="0666", OWNER="<your user name>" #Debug Samsung Infuse 4G
I got these various Vendor and Product IDs by hovering over the "SAMSUNG_Android [0400]" USB Device Filter (after clicking the green '+' button in the USB section of the Settings menu in VirtualBox:
When connected in Debug mode:
Vendor ID: 04E8
Product ID: 681C
Revision: 0400
Serial No.: I997********
State: Busy
When connected in Mass Storage mode:
Vendor ID: 04E8
Product ID: 681D
Revision: 0400
Serial No.: I997********
State: Busy
VirtualBox hover over Unknown device 04E8:6877 [0400] when in Kies mode:
Vendor ID: 04E8
Product ID: 6877
Revision: 0400
State: Busy
I got the settings for the 3rd try after running lsusb and getting this output:
lsusb command when connected in Debug mode:
Bus 002 Device 002: ID 80ee:0021
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Any idea what I'm doing wrong?
Thanks

[Q] Linux: pass APX device to VirtualBox guest

Several guides explain how to install APX drivers "on Windows only", and that they are not required on Linux (e.g. this one). Unfortunately I think that I do require such a driver on Linux, because I want to pass the APX device to my VirtualBox guest (where Win7 is running). And I think I can only pass usb devices to the guest that appear in VirtualBox's usb device list - which is a list of devices that have a Linux driver. So here's the question:
How can I pass an APX device to a VirtualBox guest (Win7) on a Linux host?
My APX device is a LG P990. It's based on nvidia tegra, so dmesg says:
Code:
[ 7386.292082] usb 2-1: new high-speed USB device number 13 using ehci_hcd
[ 7386.424943] usb 2-1: New USB device found, idVendor=0955, idProduct=7f20
[ 7386.424954] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 7386.424961] usb 2-1: Product: APX
[ 7386.424967] usb 2-1: Manufacturer: NVIDIA Corp.
And this APX device actually is already being passed to VirtualBox, because an error window pops up (not a Windows window, but a VirtualBox window):
Code:
Failed to attach the USB device NVIDIA Corp. APX [0103] to the virtual machine Win7.
Failed to create a proxy device for the USB device. (Error: VERR_READ_ERROR).
Result Code:
NS_ERROR_FAILURE (0x80004005)
Component:
Console
Interface:
IConsole {db7ab4ca-2a3f-4183-9243-c1208da92392}
Might be a permission problem. However, I don't know how to solve it, because there's no device in /dev that appears when plugging in the LG P990. Google says that my user needs to be in the vboxusers group - but he already is. All the virtualbox devices in /dev are also accessible with my user. So in the end I think that my user should be able to access all devices that are available as a "file" in /dev. But I think there's something missing in /dev. It might be either...
a) /dev/ttyUSB0, which is the device of the usbserial module. It is not being loaded automatically, but I can force it with "sudo modprobe usbserial vendor=0x0955 product=0x7f20". But this doesn't seem to be the correct driver, because it says that the device has been disconnected as soon as the module is loaded. These dmesg entries appear all at once:
Code:
[ 4187.867971] usbcore: registered new interface driver usbserial
[ 4187.867997] usbcore: registered new interface driver usbserial_generic
[ 4187.869407] USB Serial support registered for generic
[ 4187.869436] usbserial_generic 2-1:1.0: The "generic" usb-serial driver is only for testing and one-off prototypes.
[ 4187.869440] usbserial_generic 2-1:1.0: Tell [email protected] to add your device to a proper driver.
[ 4187.869443] usbserial_generic 2-1:1.0: generic converter detected
[ 4187.870237] usb 2-1: generic converter now attached to ttyUSB0
[ 4187.870251] usbserial: USB Serial Driver core
[ 4188.312867] usb 2-1: USB disconnect, device number 7
[ 4188.313295] generic ttyUSB0: generic converter now disconnected from ttyUSB0
[ 4188.313319] usbserial_generic 2-1:1.0: device disconnected
So with the usbserial drivers there's neither /dev/ttyUSB0 nor a USB device in VirtualBox (the APX device that was available without any driver has disappeared).
b) /dev/ttyACM0 is the device of the module cdc_acm, which I think might could also handle the APX device; this is what happens in dmesg when attaching the LG to the USB port while cdc_acm is loaded (and usbserial is not loaded):
Code:
[ 4323.356889] usbcore: registered new interface driver cdc_acm
[ 4323.356895] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
But nothing is happening at all. Again, there's no /dev/ttyACM0. And this time the APX device in VirtualBox is still there (with the VERR_READ_ERROR again). So cdc_acm seems to have no effect at all.
c) loading usbserial AND cdc_acm - the same as if usbserial is loaded without cdc_acm; cdc_acm has no effect, so the same happens as in a)
Now I'm stuck. I don't know how to fix the permission error without a proper device in /dev. My best guess was the usbserial device that should have created /dev/ttyUSB0, but doesn't, and even prevents the APX "raw device" (without driver) to appear in VirtualBox's usb device list.
fyi: I've updated this VirtualBox bug report with my problem.
silly question
thorstenhirsch said:
Several guides explain how to install APX drivers "on Windows only", and that they are not required on Linux (e.g. this one). Unfortunately I think that I do require such a driver on Linux, because I want to pass the APX device to my VirtualBox guest (where Win7 is running). And I think I can only pass usb devices to the guest that appear in VirtualBox's usb device list - which is a list of devices that have a Linux driver. So here's the question:
How can I pass an APX device to a VirtualBox guest (Win7) on a Linux host?
My APX device is a LG P990. It's based on nvidia tegra, so dmesg says:
Code:
[ 7386.292082] usb 2-1: new high-speed USB device number 13 using ehci_hcd
[ 7386.424943] usb 2-1: New USB device found, idVendor=0955, idProduct=7f20
[ 7386.424954] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 7386.424961] usb 2-1: Product: APX
[ 7386.424967] usb 2-1: Manufacturer: NVIDIA Corp.
And this APX device actually is already being passed to VirtualBox, because an error window pops up (not a Windows window, but a VirtualBox window):
Code:
Failed to attach the USB device NVIDIA Corp. APX [0103] to the virtual machine Win7.
Failed to create a proxy device for the USB device. (Error: VERR_READ_ERROR).
Result Code:
NS_ERROR_FAILURE (0x80004005)
Component:
Console
Interface:
IConsole {db7ab4ca-2a3f-4183-9243-c1208da92392}
Might be a permission problem. However, I don't know how to solve it, because there's no device in /dev that appears when plugging in the LG P990. Google says that my user needs to be in the vboxusers group - but he already is. All the virtualbox devices in /dev are also accessible with my user. So in the end I think that my user should be able to access all devices that are available as a "file" in /dev. But I think there's something missing in /dev. It might be either...
a) /dev/ttyUSB0, which is the device of the usbserial module. It is not being loaded automatically, but I can force it with "sudo modprobe usbserial vendor=0x0955 product=0x7f20". But this doesn't seem to be the correct driver, because it says that the device has been disconnected as soon as the module is loaded. These dmesg entries appear all at once:
Code:
[ 4187.867971] usbcore: registered new interface driver usbserial
[ 4187.867997] usbcore: registered new interface driver usbserial_generic
[ 4187.869407] USB Serial support registered for generic
[ 4187.869436] usbserial_generic 2-1:1.0: The "generic" usb-serial driver is only for testing and one-off prototypes.
[ 4187.869440] usbserial_generic 2-1:1.0: Tell [email protected] to add your device to a proper driver.
[ 4187.869443] usbserial_generic 2-1:1.0: generic converter detected
[ 4187.870237] usb 2-1: generic converter now attached to ttyUSB0
[ 4187.870251] usbserial: USB Serial Driver core
[ 4188.312867] usb 2-1: USB disconnect, device number 7
[ 4188.313295] generic ttyUSB0: generic converter now disconnected from ttyUSB0
[ 4188.313319] usbserial_generic 2-1:1.0: device disconnected
So with the usbserial drivers there's neither /dev/ttyUSB0 nor a USB device in VirtualBox (the APX device that was available without any driver has disappeared).
b) /dev/ttyACM0 is the device of the module cdc_acm, which I think might could also handle the APX device; this is what happens in dmesg when attaching the LG to the USB port while cdc_acm is loaded (and usbserial is not loaded):
Code:
[ 4323.356889] usbcore: registered new interface driver cdc_acm
[ 4323.356895] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
But nothing is happening at all. Again, there's no /dev/ttyACM0. And this time the APX device in VirtualBox is still there (with the VERR_READ_ERROR again). So cdc_acm seems to have no effect at all.
c) loading usbserial AND cdc_acm - the same as if usbserial is loaded without cdc_acm; cdc_acm has no effect, so the same happens as in a)
Now I'm stuck. I don't know how to fix the permission error without a proper device in /dev. My best guess was the usbserial device that should have created /dev/ttyUSB0, but doesn't, and even prevents the APX "raw device" (without driver) to appear in VirtualBox's usb device list.
Click to expand...
Click to collapse
I use LG P990, someday i learn how to change GB partition to ICS partition,but it turn that i cant use my NVFlash, so i flash with kdz other country but nothing , what should i do to get my nvflash work?
a bug in vb
Seems that it's a known bug in VirtualBox: unfortunately, after a day of playing around - i took an old laptop and installed XP.
I didn't find workaround for VirtualBox: and I've tried them plenty (running VB as root is one of them).

[Q] Fastboot, how to check if it works?

Hi all, my Infinity is running on CWM and the CROMI. Just to make sure I have a safety net, I am trying to get access with fastboot to the device. Originally I have installed the CWM by dd'ing the image on the device itself. All the PC systems I have access to are running Linux, so Windows is no option for me.
I have the fastboot binary for Linux and my other Android device -a HTC HD2- can be accessed via fastboot. This makes me believe the PC side of the story is ok. Now, when I start my Infinity with the Volume minus key pressed, then hit Volume minus two more times and then Volume plus, there is a message saying "Starting Fastboot USB download protocol". The device is not recognized from my PC though. I checked with
Code:
fastboot devices
.. and simply nothing happens. The command returns without any message or error. When I plug into USB, this are the log messages:
Code:
kernel: [11222.200068] usb 1-1.3: new high-speed USB device number 14 using ehci_hcd
kernel: [11222.286798] usb 1-1.3: New USB device found, idVendor=0b05, idProduct=4daf
kernel: [11222.286808] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
kernel: [11222.286814] usb 1-1.3: Product: Fastboot
kernel: [11222.286818] usb 1-1.3: Manufacturer: ASUSTeK COMPUTER INC.
[11222.286823] usb 1-1.3: SerialNumber: xxxxxxxxxxxxx
mtp-probe: checking bus 1, device 14: "/sys/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.3"
mtp-probe: bus: 1, device: 14 was not an MTP device
Here comes my question. What do I have to expect on the screen of the Infinity when fastboot is active? Is "Starting Fastboot USB download protocol" ok? Taken literally this does not imply it's ready to be used. Do the log messages look ok?
I additionally have tried to enhance my udev rules file. There are a lot of descriptions all over the place, unfortunately they are contradicting in places. Any help is highly appreciated. Thanks!
The message that the fastboot protocol had started was the only thing I ever saw happen on the screen. The rest is in the terminal/command line window.
-that recently remarked that the manufacturer's code was no longer necessary (from JB bootloaders and onwards). You might need to add it in your case. <?> (I always forget what it is, but you can most easily look it up in the recovery flashing threads (esp. the CWM ones). "-i ..."
)
MartyHulskemper said:
The message that the fastboot protocol had started was the only thing I ever saw happen on the screen. The rest is in the terminal/command line window.
-that recently remarked that the manufacturer's code was no longer necessary (from JB bootloaders and onwards). You might need to add it in your case. <?> (I always forget what it is, but you can most easily look it up in the recovery flashing threads (esp. the CWM ones). "-i ..."
)
Click to expand...
Click to collapse
Thanks for replying. Well, maybe I was overly sensitive here because it was not working. However, the message on the Infinity says it's "starting" and not that it "has started".
Encouraged by your reply I tried something different. Instead of trying to check with the "devices" command, I simply tried to re-flash the recovery. To my amazement and pleasure it simply worked Now I feel prepared for any flashing adventure the future may bring! On a lighter note, I find it strange that the devices command doesn't work. To me that seemed to be the most "harmless" command to check the fastboot setup. My HD2 also reacts different on the devices command.
Bottom line, the fastboot devices command seems not to be suitable to do the check I wanted. Thanks for your help!
FordPrefect said:
TBottom line, the fastboot devices command seems not to be suitable to do the check I wanted.
Click to expand...
Click to collapse
It works for me:
Code:
[email protected] ~ $ lsusb|grep ASUS
Bus 002 Device 066: ID 0b05:4daf ASUSTek Computer, Inc. Transformer Pad Infinity TF700 (Fastboot)
[email protected] ~ $ fastboot devices
015e3aabe751ed14 fastboot
[email protected] ~ $ fastboot continue
resuming boot...
OKAY [ 0.000s]
finished. total time: 0.001s
(then the tablet says "Cold Booting Linux" and does exactly that)
Here are my udev rules:
Code:
# Transformer TF700
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0b05", ATTRS{idProduct}=="4c90", GROUP="plugdev", MODE="0660" # normal
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0b05", ATTRS{idProduct}=="4c91", GROUP="plugdev", MODE="0660" # USB Debugging
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0b05", ATTRS{idProduct}=="4daf", GROUP="plugdev", MODE="0660" # Fastboot
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0955", ATTRS{idProduct}=="7030", GROUP="plugdev", MODE="0660" # Tegra APX
_that said:
It works for me:
Code:
[email protected] ~ $ lsusb|grep ASUS
Bus 002 Device 066: ID 0b05:4daf ASUSTek Computer, Inc. Transformer Pad Infinity TF700 (Fastboot)
[email protected] ~ $ fastboot devices
015e3aabe751ed14 fastboot
[email protected] ~ $ fastboot continue
resuming boot...
OKAY [ 0.000s]
finished. total time: 0.001s
(then the tablet says "Cold Booting Linux" and does exactly that)
Here are my udev rules:
Code:
# Transformer TF700
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0b05", ATTRS{idProduct}=="4c90", GROUP="plugdev", MODE="0660" # normal
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0b05", ATTRS{idProduct}=="4c91", GROUP="plugdev", MODE="0660" # USB Debugging
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0b05", ATTRS{idProduct}=="4daf", GROUP="plugdev", MODE="0660" # Fastboot
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0955", ATTRS{idProduct}=="7030", GROUP="plugdev", MODE="0660" # Tegra APX
Click to expand...
Click to collapse
Thanks for supplying your udev rules. I adjusted mine following your example. Still shows nothing with the devices command. Also for flashing I have to supply the manufacturer code, which I have read somewhere wouldn't be needed any more. Anyway, flashing recovery works for me now, and that's what I wanted to achieve.

Ubuntu 12.04 fastboot no devices ASUS MemoPad

After building a system image to root the ASUS MemoPad FHD 10, I am fed up with having to wait almost 15 minutes for Windoze to boot up and shut down so I can run fastboot to flash the image file. So, I've been on a quest to get adb and fastboot working with Ubuntu so I don't have to deal with stupid Windoze.
Using lnusb, tablet has different vendor:device ids when regular booted and usb debug on (adb mode) and when bootloader/recovery booted with fastboot waiting for command.
Tablet mounts using 'go-mtpfs' so I can work with internal/external SDcards.
Tablet displays with 'adb devices' (normal boot) as Medfield9A65CCEC (also shows this with Windoze fastboot devices)
Tablet doesn't display with 'fastboot devices' (bootloader/recovery boot)
51-android.rules file to recognize both vendor ids:
Code:
# ASUS MemoPad FHD 10 32Mb
SUBSYSTEM=="usb", ATTR{idVendor}=="0b05", MODE="0666", GROUP="plugdev", OWNER="Me" # MTP mode with USB debug on
SUBSYSTEM=="usb", ATTR(idVendor}=="8087", MODE="0666", GROUP="plugdev", OWNER="Me" # fastboot mode
Tried downloading a different fastboot binary, same results.
At this point I am stumped why adb works but fastboot does not. fastboot works fine in Windoze.
More Info
After some more research, I found this:
http://packages.ubuntu.com/raring/i386/android-tools-fastboot/filelist
which shows a rules file in /lib/udev/rules.d/70-android-tools-fastboot.rules
so I looked in /lib/udev/rules.d and found the rules file: 51-android-rules.rules with loads of entries
and not /etc/udev/rules.d/51-android-rules.rules as most discussions refer to
so I modified the ASUS section to this:
Code:
# Asus MemoPad FHD 10 (Intel)
SUBSYSTEM=="usb", ATTR{idVendor}=="0b05", ATTR{idProduct}=="521f", SYMLINK+="android_adb"
SUBSYSTEM=="usb", ATTR{idVendor}=="8087", ATTR{idProduct}=="09ef", SYMLINK+="android_fastboot"
#SUBSYSTEM=="usb", ATTR{idVendor}=="0b05", MODE="0660", GROUP="adbusers"
#SUBSYSTEM=="usb", ATTR{idVendor}=="8087", MODE="0660", GROUP="adbusers"
If I comment out the first two lines and use #3&4 syslog shows an error - udevd[3982]: specified group 'adbusers' unknown
If I use the first two lines and comment out #3&4 (as shown above) syslog shows:
Code:
Dec 20 14:45:48 kernel: [25297.608132] usb 2-1: new high-speed USB device number 11 using ehci-pci
Dec 20 14:45:48 kernel: [25297.745240] usb 2-1: New USB device found, idVendor=8087, idProduct=09ef
Dec 20 14:45:48 kernel: [25297.745252] usb 2-1: New USB device strings: Mfr=2, Product=3, SerialNumber=4
Dec 20 14:45:48 kernel: [25297.745260] usb 2-1: Product: Android-Phone
Dec 20 14:45:48 kernel: [25297.745268] usb 2-1: Manufacturer: Android
Dec 20 14:45:48 kernel: [25297.745275] usb 2-1: SerialNumber: Medfield9A65CCEC
Dec 20 14:45:48 mtp-probe: checking bus 2, device 11: "/sys/devices/pci0000:00/0000:00:1d.7/usb2/2-1"
Dec 20 14:45:48 mtp-probe: bus: 2, device: 11 was not an MTP device
There are no errors, so the rules file in /lib/udev/rules.d and not /etc/udev/rules.d is being used
Also interesting is that lsusb shows:
Bus 002 Device 011: ID 8087:09ef Intel Corp.
...which is a different Vendor ID
However, even with the correct rules file set and no syslog errors on USB connect, fastboot still refuses to recognize the device when connected in fastboot mode.
I have also tried fastboot i 0x8087 reboot and fastboot -sMedfield9A65CCEC reboot and it just waits for device.
It may be possible that fastboot doesn't like the Intel and is looking for ARM, not sure - although Windoze version of fastboot works fine.
On Archlinux I have the same problem
sudo adb devices works, fastboot fails with <Waiting for device>
but in fastboot mode nothing works at all
Same problem in Ubuntu 14.04 for Kindle Fire
I know this thread has been dormant for a while, but it's pretty much the only hit that comes up when searching on how to setup the /lib/udev/rules.d/70-android-tools-fastboot.rules to get device to mount in fastboot properly.
I had followed some other guides like the OP that said to put rules in the /etc/udev/rules.d/51-android-devices.rules which didn't work at all. I do not have a file /lib/udev/rules.d/51-android-devices..rules
I am having issues similar to the OP with a Kindle Fire Gen2. Device shows up when in Adb mode, but not in fastboot (using factory "fastboot" cable).
Was there ever a resolution to this issue?
Anybody have a source of documentation on how these config files need to be set up when in fastboot mode to gain access and/or get a trusted connection in MTP?

[GUIDE] Build / Mod AVD Kernel Android [10][11][12][13] rootAVD [Magisk] [USB passthrough] [Linux][Windows][MacOS] [Google Play Store API]

Hello Fellows,
with this Guide I would like to show what is necessary to do,
to get the new USB passthrough Feature,
from the Android Studio since Emulator 30.0.26 (August 16, 2020),
to work with a USB-Serial Device. Unfortunately the announcement "USB passthrough is now available"
needs to be taken literally. It means, just the passing from the host system to the gates of Android are possible.
There is no "taking it from there" implemented in Android nor the Kernel. And this is what this Guide is all about.
Inspired by Alabate and his Guide Use custom USB device with Android emulator by using custom built kernel on Ubuntu 18.04
Three basic steps needed to be done.
[Update 04.05.2021]
Spoiler: Kernel Compilation
A much more easier and reliable way on how to build, mod and update your AVDs Kernel with its modules,
can be found in my [GUIDE] by using the official AOSP Build ENV.
Build the AVD Kernel with the right check at the right place
Convince Linux to actually let go of the USB-Serial Device
Grant Permissions in Android to acknowledge the new plugged in Device
The Development Environment:
Apple Macbook Pro 2011 Dualboot
USB-Serial Device Prolific PL2303 Serial Port
Linux Mint 20 Ulyana
Android Studio 4.1.1 (Software Manager)
KVM -> Cosmic (18.10) or later
Android emulator version 30.2.6.0 (build_id 6962233)
Google APIs Intel x86 Atom_64 System Image Android 10 API 29 (revision: 11)
miscellaneous
1. Build the AVD Kernel with the right check at the right place
### From the shell with the AVD running we can get some Kernel Infos:
uname -r && uname -v
4.14.175-g6f3fc9538452
#1 SMP PREEMPT Wed Apr 8 17:38:09 UTC 2020
### Install the following tools to work with and to build the kernel:
sudo apt-get install -y build-essential libssl-dev kernel-package libncurses5-dev bzip2 lib32z1 bison flex
sudo apt-get install -y libelf-dev libelf-devel or elfutils-libelf-dev
sudo apt-get install -y qt5-default qttools5-dev-tools qttools5-dev
sudo apt-get install -y geany git
### Create a working directory and download the kernel source and its prebuilt gcc:
I choose the latest android-10.0.0_r47 branch and its prebuilt gcc 4.9
Code:
cd ~/ && mkdir avdkernelcompile && cd avdkernelcompile
git clone \
-b android-10.0.0_r47 \
--single-branch https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/x86/x86_64-linux-android-4.9
I also choose the mainline android-goldfish-4.14-dev branch from the goldfish kernel source
Code:
git clone -b android-goldfish-4.14-dev --single-branch https://android.googlesource.com/kernel/goldfish
### Pull the config.gz from the AVD to generate and merge the kernel defconfigs file:
These steps lower the risk of getting build errors. And before you mod the kernel, it could
make sense to start with a build kernel that actually boots your AVD first, and then apply changes to it.
Code:
adb pull /proc/config.gz
gunzip -k config.gz
cd goldfish
cp ../config .config
make savedefconfig
mv defconfig arch/x86/configs/avd_pulled_defconfig
rm .config
./scripts/kconfig/merge_config.sh -m \
./arch/x86/configs/avd_pulled_defconfig \
./arch/x86/configs/x86_64_ranchu_defconfig
make savedefconfig
mv defconfig arch/x86/configs/merged_avd_pulled_defconfig
rm .config
### prepare the kernel with the gcc to be build:
we are now in the goldfish directory
exports must be done every time you open a new terminal
export CROSS_COMPILE=x86_64-linux-android-
export ARCH=x86_64
export PATH=$PATH:$(pwd)/../x86_64-linux-android-4.9/bin
make the just created defconfig file
make merged_avd_pulled_defconfig
If you come back here later, this is the right place to mod your kernel.
I like the GUI Interface because you have a better overview and a search function.
make xconfig
In order to get the USB-Serial recognized by the kernel, make sure the UHCI HCD is checked.
You can find it under: Device Drivers -> USB support -> UHCI HCD (most Intel and VIA) support
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Close and save it.
### build the actually kernel, with the all CPU cores you have, and see afterwards how long it took:
time make -j$(nproc)
The new kernel is placed in:
~/avdkernelcompile/goldfish/arch/x86/boot/bzImage
We leave it there for now. If you are planing to make changes when all is working so far, just jump
to make xconfig . The build time now is much smaller now. If you have to start over,
you can run make mrproper
### Start the AVD with the new kernel from via terminal
To be able to start the emulator and adb from everywhere, add those path in your ~/.bashrc
echo export PATH=~/Android/Sdk/platform-tools:$PATH >> ~/.bashrc
echo export PATH=~/Android/Sdk/emulator:$PATH >> ~/.bashrc
source ~/.bashrc
run the new kernel with:
Code:
emulator \
-netdelay none -netspeed full -avd Pixel_4_XL_API_29 \
-writable-system -no-snapshot-load \
-show-kernel \
-verbose \
-ranchu \
-kernel ~/avdkernelcompile/goldfish/arch/x86/boot/bzImage
If the kernel works proper, you can run the AVD with this even after a Wipe Data from the AVD Manager
Later on, you can get rid of the show-kernel, verbose and ranchu option. If the kernel boots and you
can work with the AVD for your satisfaction, it is time for the mod and the next step.
2. Convince Linux to actually let go of the USB-Serial Device
According to the Emulator Release Notes, one would just need the vendorID and productID from the desired USB Device to pass it through. These are easily obtained by:
lsusb
Bus 002 Device 009: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
To start the AVD with it, and you leave out the verbose stuff, the command changes to:
Code:
emulator \
-netdelay none -netspeed full -avd Pixel_4_XL_API_29 \
-writable-system \
-no-snapshot-load \
-kernel ~/avdkernelcompile/goldfish/arch/x86/boot/bzImage \
-qemu -usb \
-device usb-host,vendorid=0x067b,productid=0x2303
If you keep watching the terminal, you can see the error message:
libusb: error [get_usbfs_fd] libusb couldn't open USB device /dev/bus/usb/001/043, errno=13
libusb: error [get_usbfs_fd] libusb requires write access to USB device nodes
Now to convince Linux to let go of the USB-Serial Device, one must create an UDEV Rule.
You can do this even while the AVD is running an the USB-Serial Device is connected:
echo 'SUBSYSTEM=="usb", ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303", OWNER="libvirt-qemu", GROUP="kvm"' | sudo tee /etc/udev/rules.d/99-usb-android.rules
After this echo command, watch while you unplug and plug it, you will only see the Info Message:
libusb_release_interface: -4 [NO_DEVICE]
And if you also watching the AVD with:
adb root
adb shell
dmesg | grep usb
You will see that the kernel is already recognizing it.
[ 619.670306] usb 1-1: new full-speed USB device number 6 using uhci_hcd
[ 620.071451] usb 1-1: New USB device found, idVendor=067b, idProduct=2303
[ 620.073050] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 620.074698] usb 1-1: Product: USB-Serial Controller
[ 620.075872] usb 1-1: Manufacturer: Prolific Technology Inc.
Btw: If you also want to use this USB-Serial Device without access issues in other tools, for example CoolTerm,
just copy the line from the udev rule and change the SUBSYSTEM to tty.
SUBSYSTEM=="tty", ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303", OWNER="libvirt-qemu", GROUP="kvm"
Side Note: Under Mac OS you will get a similar libusb: error, but unlike Linux, there is no UDEV System, so you
cannot change this situation at all. Also not by unloading a kext. I tried, even with EL Capitan where you actually
still could unload kexts very easily. So this just "prooves" that the Google Developers, never tried to pass an USB
through - even if they hinted it: (This should also have been workng on Linux and macOS already) And it is even
worst, there is actually a very convenient feature built in QEMU, with the -serial keyword, you can attach such devices
in no time. But for some reason, EXACTLY this feature is taken out from the Google Developers - what a bummer.
3. Grant Permissions in Android to acknowledge the new plugged in Device
With the kernel recognizing the USB-Serial Device and Linux let us acces it, the AVD just doesn't know what
to do with it. Or rather, it doesn't have permissions to proceed. To grant these permissions, one must simply
place a file, with this permissions, called android.hardware.usb.host.xml in /system/etc/permissions or
in /vendor/etc/permissions.
For both places we need not only root but also write access to it. Google Play AVD Images can be rooted, with my
rootAVD script, but these partitions can't remounted as writeable, no matter what. At least, not with my skills.
AVD Images with Google APIs on the other hand are capable of beeing rooted and writeable out of the box.
Actually, just the overlay paritions can be writeable. To achive this, one must start the AVD with the -writable-system
option. What we already doing all the time.
When the AVD is up, go with the ADB commands one by one:
adb root
adb shell avbctl disable-verification
adb disable-verity
adb reboot
adb root
adb remount
adb shell
Every command must show a positive result, if you stuck in a bootloop or so afterwards,
one of the two disable commands didn't work. Start over with a Wipe Data.
Once the remount command shows remount succeeded you are good to go.
In the adb shell:
echo '<permissions><feature name="android.hardware.usb.host"/></permissions>' > /system/etc/permissions/android.hardware.usb.host.xml
chmod 644 /system/etc/permissions/android.hardware.usb.host.xml
reboot
After the Reboot, plug in your USB-Serial Device, and If you have Serial USB Terminal installed.
it will finally pop up a message.
If you have USB Device Info installed, It will even show more informations.
If I disable USB Debugging, the 0000 Device will disappear.
That's it for now. The USB Passthrough for USB-Serial Devices can work.
I am currently working on a way to get a mass storage mounted in the AVD.
But I can't figure out the right fstab.ranchu entry for the AVD to auto mount my USB Storage.
I could get the kernel to recognize it:
[ 28.090063] usb 1-1: new full-speed USB device number 2 using uhci_hcd
[ 28.491686] usb 1-1: not running at top speed; connect to a high speed hub
[ 28.499738] usb 1-1: config 1 interface 0 altsetting 0 endpoint 0x2 has invalid maxpacket 512, setting to 64
[ 28.501413] usb 1-1: config 1 interface 0 altsetting 0 endpoint 0x81 has invalid maxpacket 512, setting to 64
[ 28.515287] usb 1-1: New USB device found, idVendor=1f75, idProduct=0917
[ 28.516925] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 28.518772] usb 1-1: Product: PenDrive
[ 28.519699] usb 1-1: Manufacturer: Innostor
[ 28.522417] usb 1-1: SerialNumber: 000000000000000071
[ 28.526804] usb-storage 1-1:1.0: USB Mass Storage device detected
[ 28.528787] scsi host0: usb-storage 1-1:1.0
[ 29.962957] usb 1-1: reset full-speed USB device number 2 using uhci_hcd
But it keeps getting repeated with the last line
It also does show up as block device in:
brw------- 1 root root 8, 0 2021-01-03 23:49 sda
But without sda1, just sda. And the USB Stick was formated via SDCARDFS in a real phone.
Update 06.01.2021:
Modding the Kernel with USB Mass Storage and SCSI support
In order to get an USB Stick announced by the kernel as block device node, one must
activate some additional Supports in the Kernel Config.
Device Drivers
SCSI device support
SCSI device support
SCSI disk support
USB support
USB Mass Storage support
USB Attached SCSI
With these additional features, the kernel is providing the pluged USB Stick under
/dev/block/sd which is needed to get the fstab.ranchu able to pick it up.
Once the kernel is complete, one must tell Qemu where it is supposed to plug in the USB Stick.
This is done with the -device and USB type options:
Code:
-device usb-ehci,id=ehci \
-device usb-host,bus=ehci.0,vendorid=0x8564,productid=0x1000
The EHCI (USB 2.0) driver support is already build in the stock kernel, so if you device can be
"downsqeezed" you can tell it Qemu with these words. Use the device usb.ehci, identify it for me as ehci, and attach my VendorID and ProductID to your usb-host bus ehci.0
(ehci in qemu provides 8 USB ports) With this way, you can also attach multiply USB Devices to the same AVD.
Code:
-device usb-ehci,id=ehci \
-device usb-host,bus=ehci.0,vendorid=0x8564,productid=0x1000 \
-device usb-host,bus=ehci.0,vendorid=0x1f75,productid=0x0917
If you have added USB 3.0 support in your kernel already, you can even use the XHCI driver.
Code:
emulator \
-netdelay none -netspeed full -avd Pixel_4_XL_API_29 \
-writable-system -no-snapshot-load \
-kernel ~/avdkernelcompile/goldfish/arch/x86/boot/bzImage \
-qemu -usb \
-device usb-ehci,id=ehci \
-device usb-host,bus=ehci.0,vendorid=0x8564,productid=0x1000 \
-device qemu-xhci,id=xhci \
-device usb-host,bus=xhci.0,vendorid=0x1f75,productid=0x0917
And with the fstab.ranchu correctly tuned, both USB Stick will pop up systemwide for every app to use.
Spoiler: Root and fstab.ranchu
Modding the fstab.ranchu
Without Magisk on the AVD installed, you can very easly edit the
/vendor/etc/fstab.ranchu just in the adb remounted overlay partitions.
Add this line to it:
/devices/*/block/sd* auto auto defaults voldmanaged=usb:auto
With Magisk on the AVD installed, it gets messy. Due to the fact, that Magisk is mounting a mirror of the orignal read-only partitions, some changes can't be done like before. The only way I could figure out was
to add the fstab.ranchu in my ramdisk.img and let Magisk overlay it during boot time.
Root Directory Overlay System
For this you can use my script rootAVD.sh
Code:
# Set PATCHFSTAB=true if you want the RAMDISK merge your modded fstab.ranchu before Magisk Mirror gets mounted
PATCHFSTAB=false
#PATCHFSTAB=true
# cp the read-only fstab.ranchu from vendor partition and add usb:auto for SD devices
# kernel musst have Mass-Storage + SCSI Support enabled to create /dev/block/sd* nodes
...
How to root the AVD and patch fstab.ranchu:
The script runs in Linux, Darwin MacOS and Windows. It needs the path to the ramdisk.img of the system-image as a parameter.
The AVD needs to be running and accessible via adb shell.
Then just run it and restart, NOT adb reboot, your AVD. It works with
Android 7, Android 10 and Android 11. But not with Android 8 and Android 9.
It also copys every .apk within the Apps Folder to the AVD.
./rootAVD.sh ~/Android/Sdk/system-images/android-30/google_apis_playstore/x86_64/ramdisk.img
To get the fstab.ranchu patched, set PATCHFSTAB=true, make some adjustments, and let the rootAVD script run.
Miscellaneous:
Special Cherrys for Googe Play Store AVD with Stock Kernel:
The EHCI USB Driver is already implemented in the Stock Kernel, even in the Google Play Version AVD.
By adding the android.hardware.usb.host.xml file to its rightful place, a well
written App, like X-plore File Manager, could use its own USB-Driver to access the USB Storage.
But how to get it there? Once Magisk is installed via the rootAVD script. Which are basicly the
original scripts from Magisk, just a bit tuned. You can install my Magisk Module: usbhostpermissons
Don't forget to start the AVD with usb-ehci command. The USB Stick won't pop up systemwide,
but you can still use them within X-plore and copy & paste files with it.
Replace the emulator with a script to pass arguments and run it from the GUI:
Code:
mv ~/Android/Sdk/emulator/emulator ~/Android/Sdk/emulator/emulator-original
cat <<EOF > ~/Android/Sdk/emulator/emulator
#!/bin/bash
~/Android/Sdk/emulator/emulator-original \[email protected] \
-writable-system -no-snapshot-load \
-kernel ~/avdkernelcompile/goldfish/arch/x86/boot/bzImage \
-qemu -usb \
-device usb-ehci,id=ehci \
-device usb-host,bus=ehci.0,vendorid=0x8564,productid=0x1000 \
-device qemu-xhci,id=xhci \
-device usb-host,bus=xhci.0,vendorid=0x1f75,productid=0x0917 \
-device usb-host,bus=usb-bus.0,vendorid=0x067b,productid=0x2303
EOF
chmod +x ~/Android/Sdk/emulator/emulator
If you have your original emulator file renamed, don't forget to change it when you are
calling it manual from the command line.
[Update 15.12.2021]
Spoiler: For Windows Only.
Since Emulator Version 31.1.4, Google re-implemented the USB pass through feature along with
some tools:
prebuilt Windows drivers for USB passthrough
Downloadable directly from the AOSP by clicking the [tgz]
and emulator parameters:
-list-usb
-usb-passthrough
The Windows drivers must be installed from an Adminstrator Command Shell
Code:
Install_Drivers.bat
Installing Android USB Assistant...
call Android_USB_Assistant_Install.bat
Microsoft PnP Utility
Processing inf : Android_USB_Assistant.inf
Successfully installed the driver.
Driver package added successfully.
Published name : oem89.inf
Total attempted: 1
Number successfully imported: 1
Installing Android Emulator USB Passthrough Assistance Driver
SERVICE_NAME: UsbAssist
TYPE : 1 KERNEL_DRIVER
STATE : 1 STOPPED
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x0
[SC] DeleteService SUCCESS
SERVICE_NAME: UsbAssist
TYPE : 1 KERNEL_DRIVER
STATE : 4 RUNNING
(STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x0
PID : 0
FLAGS :
Find your connected USB Devices
Code:
emulator -list-usb
VID:PID 058f:6387 (Bus 1, Port 5.1.1)
Manufacturer:
Product:
SerialNumber: 40A0FE0A
VID:PID 067b:2303 (Bus 1, Port 5.1.2)
Manufacturer: NA
Product: NA
SerialNumber: NA
VID:PID 0403:6001 (Bus 1, Port 5.1.2)
Manufacturer: FTDI
Product: USB-to-Serial
SerialNumber: FT9QIQ6Y
VID:PID 1bcf:284c (Bus 1, Port 5.1.2)
Manufacturer: SunplusIT Inc
Product: 5MP USB webcam
SerialNumber: N2020040701
Now you can use those VID : PID combination to pass it through your AVD
Code:
emulator -netdelay none -netspeed full -avd Pixel_4_API_3 -usb-passthrough vendorid=0x058f,productid=0x6387
Multible VID : PID combinations are also possible
Code:
emulator -netdelay none -netspeed full -avd Pixel_4_API_32 -usb-passthrough vendorid=0x058f,productid=0x6387 -usb-passthrough vendorid=0x067b,productid=0x2303
Unfortunately the emulator will show this Error:
Code:
qemu-system-x86_64.exe: libusb_kernel_driver_active: -12 [NOT_SUPPORTED]
But the Devices are still passed through.
They will not be shown in the AVD nor recognized as a Device in any way.
In order to accomplish this, you must:
root the AVD with Magisk (Canary for 64-Bit only AVDs)
patch the FSTAB to get USB Drives automaticly mounted as a drive
install my USB Host Permissions Magisk Module
This can be done by:
Code:
rootAVD.bat %LOCALAPPDATA%\Android\Sdk\system-images\android-32\google_apis_playstore\x86_64\ramdisk.img PATCHFSTAB GetUSBHPmodZ
The Magisk Module will be put into the local Download folder of the AVD.
AVDs with a Kernel Version lower then 5.4.65 need either a custom build kernel with the
USB features enabled or an updated prebuild Kernel directly from the AOSP.
Code:
rootAVD.bat %LOCALAPPDATA%\Android\Sdk\system-images\android-30\google_apis_playstore\x86_64\ramdisk.img InstallPrebuiltKernelModules PATCHFSTAB GetUSBHPmodZ
[Update 10.10.2022]
Spoiler: For MacOS Only.
Recently I've stumbled across this Question on stackoverflow:
How to use USB with QEMU on a Mac host?
In there is a discussion mentioned, on GitHub, that kind of resolved the issue
with USB Passthrough Feature and LibUSB.
macOS: implement kernel driver detach #911
followed by a very good explanation on what is actually going on with the real reasons behind it.
How to use the new macOS kernel detach feature for non-root user no solution as of now for libuvc users #1014
However, long story short, the USB Passthrough Feature for AVDs works now If you boot the AVD with
root privileges. Here is what I did to get it working.
Install libusb 1.0.26 via Homebrew:
brew install libusb
or check your libusb version first:
Code:
brew list --versions libusb
libusb 1.0.26
I am on MacOs Monterey now:
Code:
[email protected] % sw_vers
ProductName: macOS
ProductVersion: 12.6.1
BuildVersion: 21G217
[email protected] % emulator
INFO | Android emulator version 31.3.13.0 (build_id 9189900) (CL:N/A)
The following examples and devices I've tested so far:
USB Drive 2GB:
Code:
export PID="0x6387"
export VID="0x058f"
sudo emulator \
-netdelay none \
-netspeed full \
-no-snapstorage \
-avd Pixel_4_API_33 \
-qemu -usb \
-device usb-ehci,id=ehci \
-device usb-host,bus=ehci.0,vendorid="$VID",productid="$PID"
Code:
2022-11-10 16:32:14.088 qemu-system-x86_64[9002:323007] vendorID: 0x058f (1423), productID: 0x6387 (25479)
2022-11-10 16:32:14.088 qemu-system-x86_64[9002:323007] Command line USB devices: ("vendorID: 0x58f, productID: 0x6387")
2022-11-10 16:32:14.088 qemu-system-x86_64[9002:323007] Acquiring USB Exclusive access for device: <vendorID: 0x58f, productID: 0x6387>
2022-11-10 16:32:14.092 qemu-system-x86_64[9002:323007] Service authorization failed with error with return code: -536870202
What doesn't work is unplugging and re-plugging. The AVD needs to boot with it. Every time the AVD boots, the Disk Not Ejected Properly Message pops up. Even if it says Service authorization failed with error with return code: -536870202, the device pops up system wide.
USB 3.0 Hard Drive:
Code:
export PID="0x5106"
export VID="0x174c"
sudo emulator \
-netdelay none \
-netspeed full \
-no-snapstorage \
-avd Pixel_4_API_33 \
-qemu -usb \
-device qemu-xhci,id=xhci \
-device usb-host,bus=xhci.0,vendorid="$VID",productid="$PID"
I guess the AVD doesn't like the filesystem on that drive.
USB WebCam (uvc):
Code:
export PID="0x636d"
export VID="0x0c45"
sudo emulator \
-netdelay none \
-netspeed full \
-no-snapstorage \
-avd Pixel_4_API_33 \
-qemu -usb \
-device qemu-xhci,id=xhci \
-device usb-host,bus=xhci.0,vendorid="$VID",productid="$PID"
USB-to-Serial Device:
Code:
export PID="0x6001"
export VID="0x0403"
sudo emulator \
-netdelay none \
-netspeed full \
-no-snapstorage \
-avd Pixel_4_API_33 \
-qemu -usb \
-device qemu-xhci,id=xhci \
-device usb-host,bus=xhci.0,vendorid="$VID",productid="$PID"
Conclusion:
The AVDs/Qemu USB Passthrough Feature paired with libusb on MacOs is still a farce.
Makes me wonder how Parallels Desktop is capable since kajillian years of passing any kind
of USB device through, without any root. And they have literally patch there Tools every Kernel
version.
Thanks for reading
Cheers NewBit
Thanks and Credits to @topjohnwu , Alabate, Google, Qemu and Jitendra
QEMU/Devices/USB/Root
USB Quick Start
USB recommendations for qemu
qemu usb storage emulation
Have you mange to make it work on windows ?
Have you mange to make it work on windows ?
tomek_be said:
Have you mange to make it work on windows ?
Click to expand...
Click to collapse
Sorry for the late response, I didn't get any notice...
No I did not even try it. Did you?
I did but with no luck. Emulator correctly creates USB controller and /sys/kernel/debug/usb/devices contains entries corresponding with command line options but passthrough USB device is not discovered by the kernel. Sometimes emulator produces message on stdout that devices has been attached or detached but it is not repeatable. I tried different hardware accelerations ( HAXM and WHPX ) - nothing . BTW - on linux it worked like a charm - only thing I need to do was creating proper /system/etc/permissions/android.hardware.usb.host.xml. After that non modified kernel picked up usb device.
tomek_be said:
I did but with no luck. Emulator correctly creates USB controller and /sys/kernel/debug/usb/devices contains entries corresponding with command line options but passthrough USB device is not discovered by the kernel. Sometimes emulator produces message on stdout that devices has been attached or detached but it is not repeatable. I tried different hardware accelerations ( HAXM and WHPX ) - nothing . BTW - on linux it worked like a charm - only thing I need to do was creating proper /system/etc/permissions/android.hardware.usb.host.xml. After that non modified kernel picked up usb device.
Click to expand...
Click to collapse
Weird, I still don't get any notice.
So you did try it on Linux with Stock Kernel and permission xml file!? -> it worked
You also tried the same thing on Windows? -> it didn't worked
Is it the same/similar AVD version? Is the syntax on windows different? What commands did you use exactly?
Is your AVD rooted? Did you cross compare the Kernel Configs? Kernel Versions?
What USB Device exactly you are trying to pass through?
Hello fellows, Did you find the way to make it work in Windows ?, It's hard to create apps that need interaction with USB / Bluetooth devices under Windows environment !, I wonder why these guys at Google make it so hard ?
mariodantas said:
Hello fellows, Did you find the way to make it work in Windows ?, It's hard to create apps that need interaction with USB / Bluetooth devices under Windows environment !, I wonder why these guys at Google make it so hard ?
Click to expand...
Click to collapse
It was actually already solved, the same way like on linux. But Google
decided to take out the USB Pass Through Feature on Windows.
Android emulator USB passthrough fails: " 'usb-host' is not a valid device model name"
So the only chance would be to get back to Version 30.5.2 (build_id 7175973) (Feb 27, 2021) to try it out.
Hard to develop apks that need to cope with USB or BT in Windows machines, what's wrong with Google ?
Thanks for your information buddy !
mariodantas said:
what's wrong with Google ?
Click to expand...
Click to collapse
I've stopped wondering since they put this sneaky covid "feature" undetected on my phone.
mariodantas said:
Hard to develop apks that need to cope with USB or BT in Windows machines
Click to expand...
Click to collapse
Yes, totally. But Microsoft is to blame as well, according to Erwin Jansen.
I guess you need to remotely debug your apk directly on your phone/device.
mariodantas said:
Thanks for your information buddy !
Click to expand...
Click to collapse
No problem, If there is any USB update in the Windows Version, I am happily updating this Guide.
Hello newbit,
USB passthrough with (ASUS USB-BT400 USB Adapter USBBT400) on Linux is working fine, Emulator is able to connect to phone with BT dongle mentioned above - followed steps in android link - https://source.android.com/devices/automotive/start/passthrough
But when trying the same in MAC OS, I could see BT dongle is getting detected in Emulator as shown below (0b05:17cb) but BT in emulator not working. So, not able to connect to phone.
1|emulator:/ # lsusb
Bus 004 Device 001: ID 1d6b:0002
Bus 004 Device 002: ID 0b05:17cb
Bus 002 Device 001: ID 1d6b:0002
My question is that, In linux I have Update udev settings to allow the user process (e.g. QEMU) to have read/write permissions:
$ echo 'SUBSYSTEM=="usb", ATTRS{idVendor}=="0b05", ATTRS{idProduct}=="17cb", MODE="0666", GROUP="plugdev"' | sudo tee /etc/udev/rules.d/99-mynew.rules >/dev/null
$ sudo udevadm control --reload
$ sudo udevadm trigger
But in MAC OS I am not sure how to do the same ie Update udev settings to allow user process to have read/write permissions ? I am not sure if this is the problem ? Are you successful with USB passthrough on MAC OS ?
I am currently blocked and any inputs on this regard would be great. Thanks
nrajeevlochan said:
Hello newbit,
USB passthrough with (ASUS USB-BT400 USB Adapter USBBT400) on Linux is working fine, Emulator is able to connect to phone with BT dongle mentioned above - followed steps in android link - https://source.android.com/devices/automotive/start/passthrough
But when trying the same in MAC OS, I could see BT dongle is getting detected in Emulator as shown below (0b05:17cb) but BT in emulator not working. So, not able to connect to phone.
1|emulator:/ # lsusb
Bus 004 Device 001: ID 1d6b:0002
Bus 004 Device 002: ID 0b05:17cb
Bus 002 Device 001: ID 1d6b:0002
My question is that, In linux I have Update udev settings to allow the user process (e.g. QEMU) to have read/write permissions:
$ echo 'SUBSYSTEM=="usb", ATTRS{idVendor}=="0b05", ATTRS{idProduct}=="17cb", MODE="0666", GROUP="plugdev"' | sudo tee /etc/udev/rules.d/99-mynew.rules >/dev/null
$ sudo udevadm control --reload
$ sudo udevadm trigger
But in MAC OS I am not sure how to do the same ie Update udev settings to allow user process to have read/write permissions ? I am not sure if this is the problem ? Are you successful with USB passthrough on MAC OS ?
I am currently blocked and any inputs on this regard would be great. Thanks
Click to expand...
Click to collapse
Hi @nrajeevlochan,
as mentioned above, Mac doesn't have this UDEV feature like Linux has it. Depending on the Mac OS Version,
I had to extract and copy some dylib files from a newer Mac OS Version to my running Version. The Error
output was gone, but the USB Device wasn't passed through. So for now, I cannot provide something useful to get the USB Pass through feature running on Mac OS. The only, non-convenient work around is, to adb remote connect to your Linux AVD. But you need either 2 separate Machines or a virtual Machine running in your Mac. Which will cost you a lot of performance. Is there any error message on the terminal regarding your USB?
newbit said:
Hi @nrajeevlochan,
as mentioned above, Mac doesn't have this UDEV feature like Linux has it. Depending on the Mac OS Version,
I had to extract and copy some dylib files from a newer Mac OS Version to my running Version. The Error
output was gone, but the USB Device wasn't passed through. So for now, I cannot provide something useful to get the USB Pass through feature running on Mac OS. The only, non-convenient work around is, to adb remote connect to your Linux AVD. But you need either 2 separate Machines or a virtual Machine running in your Mac. Which will cost you a lot of performance. Is there any error message on the terminal regarding your USB?
Click to expand...
Click to collapse
Hi newbit,
Thanks for your quick response.
Please see the error I am getting with "dmesg | grep usb" below:
emulator:/ # dmesg | grep usb
[ 205.231407] usb 1-1: new high-speed USB device number 2 using xhci_hcd
[ 205.383241] usb 1-1: config 1 interface 0 altsetting 0 bulk endpoint 0x82 has invalid maxpacket 64
[ 205.384500] usb 1-1: config 1 interface 0 altsetting 0 bulk endpoint 0x2 has invalid maxpacket 64
[ 205.385742] usb 1-1: config 1 interface 2 altsetting 0 bulk endpoint 0x84 has invalid maxpacket 32
[ 205.387163] usb 1-1: config 1 interface 2 altsetting 0 bulk endpoint 0x4 has invalid maxpacket 32
[ 205.392405] usb 1-1: New USB device found, idVendor=0b05, idProduct=17cb, bcdDevice= 1.12
[ 205.393828] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 205.395216] usb 1-1: Product: BCM20702A0
[ 205.395983] usb 1-1: Manufacturer: Broadcom Corp
[ 205.396874] usb 1-1: SerialNumber: 5CF370A4407D
[ 205.405316] usb 1-1: can't set config #1, error -32
[ 205.566482] usb 1-1: usbfs: USBDEVFS_CONTROL failed cmd UsbDeviceHandle rqt 192 rq 51 len 2 ret -110
[ 205.621767] usb 1-1: usbfs: USBDEVFS_CONTROL failed cmd UsbDeviceHandle rqt 192 rq 51 len 2 ret -110
nrajeevlochan said:
Hi newbit,
Thanks for your quick response.
Please see the error I am getting with "dmesg | grep usb" below:
emulator:/ # dmesg | grep usb
[ 205.231407] usb 1-1: new high-speed USB device number 2 using xhci_hcd
[ 205.383241] usb 1-1: config 1 interface 0 altsetting 0 bulk endpoint 0x82 has invalid maxpacket 64
[ 205.384500] usb 1-1: config 1 interface 0 altsetting 0 bulk endpoint 0x2 has invalid maxpacket 64
[ 205.385742] usb 1-1: config 1 interface 2 altsetting 0 bulk endpoint 0x84 has invalid maxpacket 32
[ 205.387163] usb 1-1: config 1 interface 2 altsetting 0 bulk endpoint 0x4 has invalid maxpacket 32
[ 205.392405] usb 1-1: New USB device found, idVendor=0b05, idProduct=17cb, bcdDevice= 1.12
[ 205.393828] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 205.395216] usb 1-1: Product: BCM20702A0
[ 205.395983] usb 1-1: Manufacturer: Broadcom Corp
[ 205.396874] usb 1-1: SerialNumber: 5CF370A4407D
[ 205.405316] usb 1-1: can't set config #1, error -32
[ 205.566482] usb 1-1: usbfs: USBDEVFS_CONTROL failed cmd UsbDeviceHandle rqt 192 rq 51 len 2 ret -110
[ 205.621767] usb 1-1: usbfs: USBDEVFS_CONTROL failed cmd UsbDeviceHandle rqt 192 rq 51 len 2 ret -110
Click to expand...
Click to collapse
My apologies @nrajeevlochan,
I didn't even notice that you've replied to my question.
[ 205.405316] usb 1-1: can't set config #1, error -32
indicates, that the AVD actually detects the device, and can even read some low level information from it.
Like Product, VID, PID etc. But the host system doesn't fully let it go, so this error can't set config #1, error -32 shows up, indicating that state.
I do have some positive updates tho, you might wanna check out the
[Update 10.10.2022]
For MacOS Only.
Cheers NewBit

Categories

Resources