VirtualBox with GenyMotion and Android

Discussions about using non Windows and Linux guests such as FreeBSD, DOS, OS/2, OpenBSD, etc.
Post Reply
dreadlocks
Posts: 1
Joined: 12. Jun 2016, 13:29

VirtualBox with GenyMotion and Android

Post by dreadlocks »

Hello,

I have written a WINDOWS program using Visual C/C++ that uses the low level LIBUSB functions to write raw data to a flash thumb drive. The result is that the flash drive now contains only raw data. Windows doesnt even assign a drive number to it because it no longer contains any recognizable file system (which is the goal).

I have also written a "reader" program for Windows that can read and make sense of this raw data, but only my program knows the format (which is again the goal).

This "reader" program works in Windows, I have to write this same "reader" program for Android. So in order to do this (to debug the USB host on Android), I installed VirtualBox and GenyMotion android Emulator that supports Android USB Host.

In VirtualBox I set the USB filter to the device and product ID of the USB flash drive I was using (that same flash thumb drive that contains only data and no file system).

VirtualBox can see the vendorID and deviceID when the flash drive is plugged into Windows, but when I run the Android program in Android Studio, The Android API doesnt see the drive when I try to get a list of USB devices.

I dont know if its because there is no file system on there, but I thought mass storage does NOT care if you have a file system or not, it just read and writes what you tell it?

I tried using a normal flash drive that contains a real file system, and the Android API can see that perfectly fine, but for some reason it can NOT see the flash drive containing the raw data and no file system, even thought VirtualBox can see it when I click on the USB settings in VistualBox and try to set the USB filter, it already has the vendorID and DeviceID listed of the drive containing just the raw data and no file system.

Here is my code, it simply tries to get a device list, and tries checking the deviceID and vendorID, but it never returns any information about my custom flash drive, so the loop below never runs because the list contains no elements, except when i use a regular flash drive it works.

public void InitTheUSBStuff()
{
UsbManager usbManager = (UsbManager) getSystemService(Context.USB_SERVICE);
HashMap<String, UsbDevice> usbDevices = usbManager.getDeviceList();
if (!usbDevices.isEmpty()) {
for (Map.Entry<String, UsbDevice> entry : usbDevices.entrySet()) {
device = entry.getValue();
int productID = device.getProductId();
int deviceVID = device.getVendorId();
if (deviceVID == 0x2341)//Arduino Vendor ID
{
PendingIntent pi = PendingIntent.getBroadcast(this, 0, new Intent(ACTION_USB_PERMISSION), 0);
usbManager.requestPermission(device, pi);
}
}
}
}
Anybody have any idea why Android API cant see the drive? Is it because there is no file system on it? I thought a mass storage drive doesn't care what file system is on the drive, it just reads and writes data that you tell it. So why cant it see my raw data drive?

Thanks for any help!
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: VirtualBox with GenyMotion and Android

Post by mpack »

Not a "Using VirtualBox" question. Moved to "Other Guests".

Please post a VM log file. With the VM fully shut down, right click it in GUI. Select "Show Log" and save "VBox.log" (ONLY) to a zip file. Attach the zip here.
Post Reply