Hi,
I do a lot of Android hardware development and to do this I frequently upload a modified library to my device, and then reboot it so it will load. Long story short, this drops the connection to the device, so after the device boots, I have to click "Devices->USB Devices->Android [0228]". I have to do this hundreds of times per day and it's really annoying!
Is there any command I could issue via a command prompt (Terminal) to connect to this USB device?
Thanks!
Connect USB device via Terminal?
-
- Site Moderator
- Posts: 34369
- Joined: 6. Sep 2008, 22:55
- Primary OS: Linux other
- VBox Version: OSE self-compiled
- Guest OSses: *NIX
Re: Connect USB device via Terminal?
You can always create a filter for it in the guest settings and it will always be attached when the guest is running.
Or if you really want the command line
By the way you can see all of the VBoxManage commands in your users guide.
Or if you really want the command line
Code: Select all
VBoxManage controlvm <uuid|vmname> usbattach <uuid>|<address> |
Re: Connect USB device via Terminal?
Thank you! Appreciate it. But, how do I get the uuid or address? If I do "VBoxManage list usbhost", it says "<none>". However I am definitely connected - the Devices->USB Devices->Android [0228] is checked, and I can successfully execute "adb devices" or "adb shell".
I've actually tried creating a filter, several times, but it causes the device to be considered attached when it is not.
For instance, if I do:
VirtualBox will show the device as connected, but adb devices will list nothing. I will not be able to shell into the device.
Worse, if I reflash the device (which causes it to become "Android [0100]" instead of "Android [0228]" until the flash is complete), the filter will cause the USB device to be permanently in use or something...I forget the exact error. At that point, the only solution is to restart VirtualBox entirely.
I've actually tried creating a filter, several times, but it causes the device to be considered attached when it is not.
For instance, if I do:
Code: Select all
adb root
Worse, if I reflash the device (which causes it to become "Android [0100]" instead of "Android [0228]" until the flash is complete), the filter will cause the USB device to be permanently in use or something...I forget the exact error. At that point, the only solution is to restart VirtualBox entirely.
-
- Site Moderator
- Posts: 34369
- Joined: 6. Sep 2008, 22:55
- Primary OS: Linux other
- VBox Version: OSE self-compiled
- Guest OSses: *NIX
Re: Connect USB device via Terminal?
I honestly can't say. I don't have an android device. Perhaps someone else will. I was just answering your original question on how to attach it.
Re: Connect USB device via Terminal?
OK, I understand. I'm not sure why the filters don't work, but the VBoxManage would be a great workaround.
Still a little stuck with the VBoxManage method though. I did find the Android USB uuid by running VBoxManage in my Windows host. I also found the uuid of the VM.
Then, in my Ubuntu guest, I tried:
Attempt 1:
Attempt 2: Here I also provided my VM uuid
Still a little stuck with the VBoxManage method though. I did find the Android USB uuid by running VBoxManage in my Windows host. I also found the uuid of the VM.
Then, in my Ubuntu guest, I tried:
Attempt 1:
Code: Select all
VBoxManage controlvm usbattach f9d3e8f8-a909-40e1-96c2-5de68af5cfde
VBoxManage: error: Could not find a registered machine named 'usbattach'
VBoxManage: error: Details: code VBOX_E_OBJECT_NOT_FOUND (0x80bb0001), component VirtualBox, interface IVirtualBox, callee nsISupports
VBoxManage: error: Context: "FindMachine(Bstr(a->argv[0]).raw(), machine.asOutParam())" at line 95 of file VBoxManageControlVM.cpp
Code: Select all
VBoxManage controlvm 71be104f-530c-4c74-b546-3bb16fc35931 usbattach f9d3e8f8-a909-40e1-96c2-5de68af5cfde
VBoxManage: error: Could not find a registered machine with UUID {71be104f-530c-4c74-b546-3bb16fc35931}
VBoxManage: error: Details: code VBOX_E_OBJECT_NOT_FOUND (0x80bb0001), component VirtualBox, interface IVirtualBox, callee nsISupports
VBoxManage: error: Context: "FindMachine(Bstr(a->argv[0]).raw(), machine.asOutParam())" at line 95 of file VBoxManageControlVM.cpp
-
- Site Moderator
- Posts: 34369
- Joined: 6. Sep 2008, 22:55
- Primary OS: Linux other
- VBox Version: OSE self-compiled
- Guest OSses: *NIX
Re: Connect USB device via Terminal?
VBoxManage is operated from the host. You can't use it in the guest.