I would like to turn my computer into an Android accessory using my application. Therefore, instead of specialized equipment, it will be only a PC that switches the phone to accessory mode, thus launching some Java application on the phone connected to the host equipment and creating a communication channel.
I found a code sample (plus some Java Android app) to do this on Linux using libusb. It works when you "open" the phone using standard VID and PID. He then sends a command to enable accessory mode , as well as metadata such as model, version, etc.
If the phone supports accessory mode, it will turn off and restart with a different PID. Then the sample code checks to see if it succeeded and opens a new device.
However, I am trying to run this on Windows. I found several USB libraries, for example LibUsbDotNet , but they all need a device using the WinUSB / libusb driver. I used the tool in LibUsbDotNet to create the libusb driver for my phone by installing it on top of an old universal removable drive. But this means that now I canβt access the phone as a removable disk when I want, so this is not a solution.
Is there a way (preferably a library) that can open any connected USB device based on VID and PID, and then send some raw commands?
After that, the device will reuse another PID, which I can use to create my own WinUSB driver, so this is not a problem. I just need to enter some commands through / around the default driver to enable helper mode.
(I would prefer a .NET solution, but all that Windows is fine and I can write my own interaction shell)
lacop source share