| | |
| | | return 0; |
| | | } |
| | | |
| | | public int tryAgain(Context context){ |
| | | mUsbManager = (UsbManager) context.getSystemService(USB_SERVICE); |
| | | |
| | | /* Object deviceInfo = null; |
| | | |
| | | if (null != (deviceInfo = acceptOTGDeviceInfo(mUsbManager))) { |
| | | //满足 即当前存在OTG设备插入 OTG设备类型 |
| | | // initOTGDeviceModule(context, (UsbDevice) deviceInfo); |
| | | acceptLicense(context, deviceInfo); |
| | | }*/ |
| | | |
| | | ArrayList<UsbDevice> devices = acceptOTGDeviceInfo(mUsbManager); |
| | | if (devices==null || devices.size()==0){ |
| | | Log.i("fwup","tryAgain devices==null"); |
| | | return 1; |
| | | } |
| | | for (UsbDevice dev: devices) { |
| | | acceptLicense(context, dev); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | //<<<--------------------------------------- Usb 相关处理-------------------------------------------- |
| | | /** |
| | | * 获取符合信息的OTG设备 |
| | |
| | | ArrayList<UsbDevice> devices = new ArrayList<>(); |
| | | //拿到OTG设备列表 |
| | | HashMap<String, UsbDevice> deviceList = usbManager.getDeviceList(); |
| | | |
| | | if (deviceList==null || deviceList.size()==0){ |
| | | Log.d("fwup","deviceList为空 "); |
| | | } |
| | | for (UsbDevice usbDevice : deviceList.values()) { |
| | | int productId = usbDevice.getProductId(); |
| | | // if (productId != 36940) { |