I have a Lollipop based android box. The box has a USB port similarly to micro USB port in Android phones. I want to check if any host is connected to the USB port with the android box in device mode similarly to when a phone is connected to a PC. At the minimum, I just need to check if something is connected to this USB port and at best get some info(manufacturer, model, serial) of the host connected. I don't need any data communication.
I have tried
UsbManager manager = (UsbManager) getSystemService(Context.USB_SERVICE);
manager.getAccessoryList();
but it turns up empty even though I have connected my laptop to it and adb and file transfers are working.
Although on further reading it seems android USB accessories API is limited to special android accessories only.