/**
* Finds and builds all possible {@link UsbSerialDriver UsbSerialDrivers}
* from the currently-attached {@link UsbDevice} hierarchy. This method does
* not require permission from the Android USB system, since it does not
* open any of the devices.
*
* @param usbManager
* @return a list, possibly empty, of all compatible drivers
*/
@Keep
public List<UsbSerialDriver> findAllDrivers(final UsbManager usbManager) {
final List<UsbSerialDriver> result = new ArrayList<UsbSerialDriver>();
HashMap<String, UsbDevice> deviceList = usbManager.getDeviceList();
Iterator<UsbDevice> deviceIterator = deviceList.values().iterator();
while (deviceIterator.hasNext()) {
UsbDevice usbDevice = deviceIterator.next();
UsbSerialDriver driver = probeDevice(usbDevice);
if (driver != null) {
result.add(driver);
}
}
return result;
}
UsbSerialProber.java 文件源码
java
阅读 36
收藏 0
点赞 0
评论 0
项目:usb-with-serial-port
作者:
评论列表
文章目录