2

I would like to use the Android USB Accessory Mode. This allows to open a data connection between an Android app and an app on another USB device, like a Windows machine.

To start this communication, on the Windows machine, an App must start a USB Host mode. For this, it must send some specific data to the Android Accessory Interface, which will be shows as a USB device inside Windows.

Unfortunately, on my Windows machine, this Android Accessory Interface will not be shown. This will be identified by a device instance ID of USB\VID_18D1&PID_2D01&MI_....

To show this device, I updated my Windows 10 Pro installation and all drivers. Additionally, I installed a special USB driver from Samsung for my Galaxy A20e.

How can enable the Android Accessory Interface (USB) for my Samsung Galaxy A20e device?

1
  • 1
    A common mistake is to install the drivers to the wrong device. If ad and/or MTP is active at the same time you should see an USB compound device in device manager in Windows. Select an device that belongs to the Android phone and then switch View -> View by connection then you should see the compound device and below all the devices that belong to the Android phone. As USB accessory mode is designed to connect custom USB devices you may need to emulate a standard USB protocol on Android side or develope a matching Windows USB driver for whatever your app uses on USB level.
    – Robert
    Dec 3, 2022 at 14:17

1 Answer 1

0

To switch to the Android Accessory mode, I enabled the USB debugging inside the settings of my Samsung A20e. After this, I was able to connect from my Windows App to the Android device to start the accessory mode with this procedure:

  1. Get the device ID of the USB adapter (ADB interface) with the GUID f72fe0d4-cbcb-407d-8814-9ed673d0dd6b.
  2. This can be used as the file name to get a file handle with CreateFile (please use FILE_FLAG_OVERLAPPED).
  3. The file handle can be passed to WinUsb_Initialize to get a WinUsb handle.
  4. Now you can request the protocol (51) and send some information (52) like manufacturer, model, etc. to the Samsung device with WinUsb_ControlTransfer.
  5. After this, you can start the accessory mode with command 53.

This will disconnect my Samsung Galaxy from my Windows computer and connect again as Google device (VID of 0x18d1).

After this, I wasn't be able to use MTP or RNDIS furthermore.

2
  • Did it work for the android device to see the Windows machine as accessory? Were you able to obtain bi-directional communication? thx. Mar 25 at 18:21
  • @GoranHoriaMihail: With this solution, the Windows machines see the Android machine.
    – Tahtu
    Mar 27 at 3:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .