Android USB manager only sees devices after they are re-attached -
the function usbmanager.getdevicelist()
should return list of attached devices. however, list empty upon startup of application until attached usb devices first physically removed , re-attached. after this, function correctly returns list of connected devices.
function use call it:
public static map<string, usbdevice> getavailabledevices(context context) { usbmanager usbmanager = (usbmanager) context.getsystemservice(context.usb_service); map<string, usbdevice> availableusbdevices = new hashmap<string, usbdevice>(); availableusbdevices = usbmanager.getdevicelist(); return availableusbdevices; }
the documentation of function usbmanager.getdevicelist()
says gives remoteexception (which does) if no devices attached, or if usb host mode inactive or unsupported. don't means though since devices attached , usb host supported. (since works fine after devices re-attached)
edit: on closer inspection using debugger problem lies in function mservice.getdevicelist(bundle)
within usbmanager.getdevicelist()
. if re-attach usb devices before mservice.getdevicelist(bundle)
gets called devices detected appropriately. must have system configuration..
any idea what's up?
thanks in advance
Comments
Post a Comment