Unable to capture Android phone (USB)
-
- Posts: 29
- Joined: 28. Jan 2020, 06:24
Unable to capture Android phone (USB)
When I capture an Android phone (USB), the phone shows the question "Allow access to phone data ?". If I answer yes, the capture is lost, and the USB phone returns to the host.
I tried to setup a filter, but then it just goes into a loop, with the same steps :
- USB phone is captured by the VM
- phone asks me to allow
- I allow, and the VM loses the USB connection
- and a second later the cycle repeats : USB is captured, phone asks me to allow, I allow, USB capture is lost
Virtualbox 6.1.36
Host & guest : Debian 11
Phone : Samsung Galaxy S20FE
I tried to setup a filter, but then it just goes into a loop, with the same steps :
- USB phone is captured by the VM
- phone asks me to allow
- I allow, and the VM loses the USB connection
- and a second later the cycle repeats : USB is captured, phone asks me to allow, I allow, USB capture is lost
Virtualbox 6.1.36
Host & guest : Debian 11
Phone : Samsung Galaxy S20FE
-
- Site Moderator
- Posts: 39134
- Joined: 4. Sep 2008, 17:09
- Primary OS: MS Windows 10
- VBox Version: PUEL
- Guest OSses: Mostly XP
Re: Unable to capture Android phone (USB)
Complex phones usually appear as composite devices, so don't define the USB filter too narrowly.
Can I ask why you need to connect a phone directly to your PC using USB? I have a Samsung phone (S10), which I access quite easily over home WiFi. E.g. installing the "Sweech" app on the phone gives me pretty much full access.
Can I ask why you need to connect a phone directly to your PC using USB? I have a Samsung phone (S10), which I access quite easily over home WiFi. E.g. installing the "Sweech" app on the phone gives me pretty much full access.
-
- Posts: 29
- Joined: 28. Jan 2020, 06:24
Re: Unable to capture Android phone (USB)
Thanks, never heard of "Sweech", I'll try it.mpack wrote: I have a Samsung phone (S10), which I access quite easily over home WiFi. E.g. installing the "Sweech" app on the phone gives me pretty much full access.
It was more of a theoretical question, it's not a "need" per se, I can do without. I just noticed that I was unable to capture it from within a VM, and was wondering why.mpack wrote: Can I ask why you need to connect a phone directly to your PC using USB?
I just removed everything from the filter, except Samsung's vendor ID (04e8). Same behavior (loop).mpack wrote:Complex phones usually appear as composite devices, so don't define the USB filter too narrowly.
-
- Site Moderator
- Posts: 39134
- Joined: 4. Sep 2008, 17:09
- Primary OS: MS Windows 10
- VBox Version: PUEL
- Guest OSses: Mostly XP
Re: Unable to capture Android phone (USB)
Frankly, I'm of the opinion that managing any kind of physical interface from a virtual machine may be asking for trouble. That's why I almost never do it. I rely on networking APIs instead.
-
- Posts: 29
- Joined: 28. Jan 2020, 06:24
Re: Unable to capture Android phone (USB)
I agree, at least for smartphones, their many connection modes makes it tricky. But it's usually OK for printers, usb sticks and hard disk drives (although I prefer AirPrint for printers now, it works fine from within VMs).mpack wrote:Frankly, I'm of the opinion that managing any kind of physical interface from a virtual machine may be asking for trouble. That's why I almost never do it. I rely on networking APIs instead.
Anyway, thanks for Sweech, a really nice software I've never heard of before.
-
- Site Moderator
- Posts: 39134
- Joined: 4. Sep 2008, 17:09
- Primary OS: MS Windows 10
- VBox Version: PUEL
- Guest OSses: Mostly XP
Re: Unable to capture Android phone (USB)
I have no way to know that those things are "usually OK". People only post here about the problem cases.HulkySulky wrote:But it's usually OK for printers, usb sticks and hard disk drives
But in many of those cases a direct connection is neither necessary nor wise:
- Printer sharing is a standard feature of modern OS's, there is simply no reason or benefit to connect the printer to one VM using a physical API - depriving the host plus every other VM of access.
- USB sticks: can be accessed more reliably as shared folders, regardless the level of guest support for USB.
- Hard disk drives: you can't directly access hard disk drives anyway. Shared folders is the only option here. If you meant "raw disk access" then again that is not direct access, you are still using a virtual controller, it's just that the drive is accessed at sector level instead of at file level. Raw disks will be slower than normal disks since they bypass caches, so again it is rarely beneficial to use them. The only valid scenarios I know about is when the disk is formatted using a filesystem the host OS doesn't support, or you intend to format the drive from inside the guest. In both scenarios the performance loss will be secondary.
-
- Posts: 29
- Joined: 28. Jan 2020, 06:24
Re: Unable to capture Android phone (USB)
Interesting thoughts,which prompted me to do some tests, and I have to say that I disagree on some points. Performance wise, capturing a USB HDD or USB stick is much better than using a shared folder.
So, I plugged a USB HDD, and did 3 tests : copy from HDD to host, copy from HDD to guest through a shared folder, and copy from HDD to guest through a USB capture.
I believe all tests have been done in similar conditions (I emptied RAM cache on both host and guest before each test).
Dataset is a folder of 34.000 files, totaling 13 Gib.
Hardware is a Dell XPS 13 with 3.2 USB, but HDD is a rather old USB 3.0 disk.
Both host and guest are Debian 11 with Gnome. Copy operations have been done with Nautilus, Gnome's file manager.
Test results :
Sorry, I meant USB HDDmpack wrote: Hard disk drives: you can't directly access hard disk drives anyway.
So, I plugged a USB HDD, and did 3 tests : copy from HDD to host, copy from HDD to guest through a shared folder, and copy from HDD to guest through a USB capture.
I believe all tests have been done in similar conditions (I emptied RAM cache on both host and guest before each test).
Dataset is a folder of 34.000 files, totaling 13 Gib.
Hardware is a Dell XPS 13 with 3.2 USB, but HDD is a rather old USB 3.0 disk.
Both host and guest are Debian 11 with Gnome. Copy operations have been done with Nautilus, Gnome's file manager.
Test results :
- Copy from USB HDD to host : 2'58"
- Copy from USB HDD to guest through a shared folder : 5'12"
- Copy from USB HDD to guest through a USB capture : 3'04"
-
- Site Moderator
- Posts: 39134
- Joined: 4. Sep 2008, 17:09
- Primary OS: MS Windows 10
- VBox Version: PUEL
- Guest OSses: Mostly XP
Re: Unable to capture Android phone (USB)
I you review my comment on shared folders you should note that I said "more reliably", not "faster". Performance isn't a very important factor for me because I copy files so infrequently. I need it to work, but I don't always need it to work fast.
Also, I assume you refer to Guest Additions Shared folders (as indeed did I). But if I cared about performance I wouldnt be using that since that too is designed for infrequent convenience, not performance. Instead I would configure a true network share.
Also, I assume you refer to Guest Additions Shared folders (as indeed did I). But if I cared about performance I wouldnt be using that since that too is designed for infrequent convenience, not performance. Instead I would configure a true network share.
-
- Posts: 29
- Joined: 28. Jan 2020, 06:24
Re: Unable to capture Android phone (USB)
I set up a NFS share between the USB disk and the guest. Results are catastrophic : 9'00".mpack wrote:Instead I would configure a true network share.
Now, there's maybe some fine tuning that could be done to get better performances, or maybe SMB/CIFS would perform better (I don't want to install Samba just for that test), but those methods are rather cumbersome to conveniently and quickly transfer files between a USB disk and a VB guest.
I did some additional tests, with 1 big 16 GiB file. It's interesting to note that all methods result in the same performance (e.g. guest additions shared folder, NFS shared folder, and USB capture), almost the same performance as natively on the host
What exactly makes you say that USB capture is not reliable ? I am using it to transfer files for over a decade now, and I never experienced any problem with itmpack wrote:I you review my comment on shared folders you should note that I said "more reliably", not "faster".
For me, USB capture remains the "best" way to transfer data from a USB drive to a guest. By "best" I mean that it's very easy and convenient to set up, very fast in all circumstances, including with a bunch of small files, and, as far as I know, perfectly reliable. And unless I have some proof or some experience that it can be unreliable, I have no reason not to stick to it for data transfer.
-
- Site Moderator
- Posts: 39134
- Joined: 4. Sep 2008, 17:09
- Primary OS: MS Windows 10
- VBox Version: PUEL
- Guest OSses: Mostly XP
Re: Unable to capture Android phone (USB)
I don't really want to rehash USB discussions that I've had a zillion times before. Try Googling for "busy previous request site:forums.virtualbox.org", for coverage of just one common USB problem.
-
- Posts: 29
- Joined: 28. Jan 2020, 06:24
Re: Unable to capture Android phone (USB)
Interesting...
Like I said, transferring data through USB captured disks never caused me any trouble, and it's something I do quite often, and for many years now, so I'll just stick with it until I have a good reason not to.
I noticed that in all the links of your Google search (I opened the 10 first ones), the host OS is always Windows. Maybe a Linux host (which I use) is more reliable when it comes to USB captured disks.
Anyway, thanks for your time, it was an interesting read and I learned a few things along the way
Like I said, transferring data through USB captured disks never caused me any trouble, and it's something I do quite often, and for many years now, so I'll just stick with it until I have a good reason not to.
I noticed that in all the links of your Google search (I opened the 10 first ones), the host OS is always Windows. Maybe a Linux host (which I use) is more reliable when it comes to USB captured disks.
Anyway, thanks for your time, it was an interesting read and I learned a few things along the way
-
- Site Moderator
- Posts: 39134
- Joined: 4. Sep 2008, 17:09
- Primary OS: MS Windows 10
- VBox Version: PUEL
- Guest OSses: Mostly XP
Re: Unable to capture Android phone (USB)
MacOS users get it a lot too, perhaps more so than Windows users in recent years. I don't specifically recall it being a problem on Linux hosts, I'm not sure (*): but fundamentally it's a fact that USB does not allow sharing, therefore host and guest can't be using the same device at the same time using USB directly, and if you try then you'll get some kind of error response even if not worded per the above.HulkySulky wrote: I noticed that in all the links of your Google search (I opened the 10 first ones), the host OS is always Windows.
(*) Actually I do recall people trying to use USB-LPT adapters to talk to printers, and having problems because the host kernel started a printer queuing service. It's been a while though, since in 2022 a printer would have to be VERY old to offer an LPT port.
-
- Posts: 29
- Joined: 28. Jan 2020, 06:24
Re: Unable to capture Android phone (USB)
Of course ! I am surprised you even mention that possibility to use the same device at the same time on both host and guest ! I was always talking about capturing a USB disk exclusively in the guest.mpack wrote:therefore host and guest can't be using the same device at the same time using USB directly, and if you try then you'll get some kind of error response
I never tried otherwise, and don't even see how this could be done. In Linux once the disk is captured by the guest it's automatically unmounted in the host (it still appears in lsusb results, but the device /dev/sdX is removed, thus the disk cannot be mounted in the host anymore). And it is automatically mounted in the guest once captured.
I have very few experience with other OSes, but I doubt that a USB disk can be mounted in both the host and guest at the same time.
-
- Site Moderator
- Posts: 39134
- Joined: 4. Sep 2008, 17:09
- Primary OS: MS Windows 10
- VBox Version: PUEL
- Guest OSses: Mostly XP
Re: Unable to capture Android phone (USB)
I already said that it can't. But people often expect otherwise.HulkySulky wrote:but I doubt that a USB disk can be mounted in both the host and guest at the same time.
You seem to be keen to debate the ills of USB, but what I asked you to consider was: what is the upside of restricting access to a device one VM when that isn't necessary?
In the end, I have offered opinions based on my experience but you are of course entitled to manage your PC in your own way.
-
- Posts: 29
- Joined: 28. Jan 2020, 06:24
Re: Unable to capture Android phone (USB)
I guess it depends on your workflow. My need is to plug a USB disk in order to transfer some data between that disk and a VM, and I have no need to access that same disk from another VM or from the host. So in that case, capturing the USB port has the following upsides :mpack wrote:what is the upside of restricting access to a device one VM when that isn't necessary?
- It's convenient, quick and easy to do (no network or VB shares to configure)
- And, per my tests, it's faster than through a share (at least with small files)
Again, the use case here is that I don't need to access that particular USB disk from the host or from another VM. The reasoning would of course be different if I wanted to share the USB disk between several VMs and/or the host, in which case a shared folder would be the chosen solution.