| 
					
				 | 
			
			
				@@ -80,7 +80,6 @@ public class FirmwareUpdate extends AppCompatActivity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private byte[] mSendData = new byte[1024]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private byte[] mConfigData = new byte[1024]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private String[] mVersionShow = new String[16]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-   // byte mSendData[] = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private boolean isReceiverMessage = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private boolean isSendMessage = true; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -117,20 +116,18 @@ public class FirmwareUpdate extends AppCompatActivity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     int FW_DSP_ISP_OFFSET	=	(FW_GWAKE_OFFSET + FW_GWAKE_LENGTH); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private byte mSendGetGt9VersionData[]={ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            0x03,0x00,0x0f,(byte)0x81,0x40,0x00,0x06,0x00, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        0x03,0x00,0x0f,(byte)0x81,0x40,0x00,0x06,0x00, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private Button btn_update; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private Button btn_AutoUpdate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //private RadioGroup rad_group; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private Button search_button; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private TextView edit_search; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -150,7 +147,6 @@ public class FirmwareUpdate extends AppCompatActivity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         public void handleMessage(Message msg) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             StringBuilder stringBuilder = new StringBuilder(""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            StringBuffer resultSb = new StringBuffer(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // for (int i = 1; i < mBytes.length; i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             int checksum = 0 ; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             switch (msg.what) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -192,7 +188,6 @@ public class FirmwareUpdate extends AppCompatActivity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 case DEBUG_MESSAGE_SUCCESS://成功发送数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     //StringBuilder stringBuilder = new StringBuilder(""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    // StringBuffer resultSb = new StringBuffer(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     checksum = 0 ; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     for (int i = 0; i < 216; i++) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -355,42 +350,40 @@ public class FirmwareUpdate extends AppCompatActivity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         mThreadPool.execute(new Runnable() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             public void run() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                SystemClock.sleep(1000); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                PendingIntent pendingIntent = PendingIntent.getBroadcast(mContext, 0, new Intent(ACTION_USB_PERMISSION), 0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                IntentFilter intentFilter = new IntentFilter(USB_ACTION); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                registerReceiver(fwOpenDevicesReceiver, intentFilter); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                while(isNeedFindDevice) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    SystemClock.sleep(100); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    HashMap<String, UsbDevice> deviceList = mUsbManager.getDeviceList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if (deviceList != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        for (UsbDevice usbDevice : deviceList.values()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            //int productId = usbDevice.getProductId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            int vendorId = usbDevice.getVendorId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            if ((vendorId == 0x27C0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    ||(vendorId == 0x222A)    //奕力的VID 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    ||(vendorId == 0x056A))   //8191主动笔和Wacom主动笔 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                if (mUsbManager.hasPermission(usbDevice)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    initDevice(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            SystemClock.sleep(1000); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            PendingIntent pendingIntent = PendingIntent.getBroadcast(mContext, 0, new Intent(ACTION_USB_PERMISSION), 0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            IntentFilter intentFilter = new IntentFilter(USB_ACTION); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            registerReceiver(fwOpenDevicesReceiver, intentFilter); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            while(isNeedFindDevice) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                SystemClock.sleep(100); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                HashMap<String, UsbDevice> deviceList = mUsbManager.getDeviceList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (deviceList != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    for (UsbDevice usbDevice : deviceList.values()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        //int productId = usbDevice.getProductId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        int vendorId = usbDevice.getVendorId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if ((vendorId == 0x27C0)          //之前VID错误了,做兼容 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            ||(vendorId == 0x27C6)    //汇顶的VID 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            ||(vendorId == 0x222A)    //奕力的VID 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            ||(vendorId == 0x056A))   //8191主动笔和Wacom主动笔 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            if (mUsbManager.hasPermission(usbDevice)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                initDevice(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    //String avalue = "S818 IS NOT PERMISSION"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    //mShow.setText(avalue);//输出显示 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    mUsbManager.requestPermission(usbDevice, pendingIntent); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                //String avalue = "S818 IS NOT PERMISSION"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                //mShow.setText(avalue);//输出显示 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                mUsbManager.requestPermission(usbDevice, pendingIntent); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        //mError.setText("请连接USB"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    // } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            }   //ThreadPool 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        });   //ThreadPool 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }   //ThreadPool 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    });   //ThreadPool 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /** 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -404,9 +397,10 @@ public class FirmwareUpdate extends AppCompatActivity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             for (UsbDevice usbDevice : values) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 int vendorId = usbDevice.getVendorId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //if (productId == 0x0818 || productId == 0x0001 ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if ((vendorId == 0x27C0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        ||(vendorId == 0x222A)    //奕力的VID 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        ||(vendorId == 0x056A))   //8191主动笔和Wacom主动笔 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if ((vendorId == 0x27C0)          //之前VID错误了,做兼容 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    ||(vendorId == 0x27C6)    //汇顶的VID 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    ||(vendorId == 0x222A)    //奕力的VID 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    ||(vendorId == 0x056A))   //8191主动笔和Wacom主动笔 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     if (mUsbManager.hasPermission(usbDevice)) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -457,7 +451,6 @@ public class FirmwareUpdate extends AppCompatActivity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     //if(0x80 == mUsbEndpointIn) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     //mlog1.setEnabled(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    //mToggle = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     //isDetached = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     isNeedFindDevice = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     // mSendMessage.setEnabled(true); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -476,8 +469,6 @@ public class FirmwareUpdate extends AppCompatActivity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            // finish(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -546,11 +537,9 @@ public class FirmwareUpdate extends AppCompatActivity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             case R.id.btnAutoUpdate: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-              //  mThreadPool.shutdownNow(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 bottonMode = 3; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 isReceiverMessage = false;  //升级关闭循环接收信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //mSendData = mSendGetGt9VersionData; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -559,7 +548,6 @@ public class FirmwareUpdate extends AppCompatActivity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //mHandler.sendEmptyMessage(UPDATE_FW); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             case R.id.btnUpdate: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                //  mThreadPool.shutdownNow(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 bottonMode = 4; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 isReceiverMessage = false;  //升级关闭循环接收信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //mSendData = mSendGetGt9VersionData; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -574,7 +562,7 @@ public class FirmwareUpdate extends AppCompatActivity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-       while (isSendMessage) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        while (isSendMessage) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				              * 发送数据的地方 , 只接受byte数据类型的数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				              */ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -583,7 +571,6 @@ public class FirmwareUpdate extends AppCompatActivity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //String c_value = "SENDING"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // mShow.setText(c_value);//输出显示 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             j = j +1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if(1000 == j) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 j = 0; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -594,7 +581,7 @@ public class FirmwareUpdate extends AppCompatActivity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // UsbEndpoint 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //int i = mUsbDeviceConnection.controlTransfer(0x21, 0x09, 0x301, 0, mSendGetGt9VersionData, mSendGetGt9VersionData.length, 100); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-           if (null != mUsbEndpointOut) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (null != mUsbEndpointOut) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               //  if ((null != mUsbEndpointOut) && (bottonMode != 1)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //mSendGetGt9ConfigData  mSendGetGt9VersionData 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 int i = -1; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -632,17 +619,9 @@ public class FirmwareUpdate extends AppCompatActivity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //int i =0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                //mlog1.setEnabled(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          //  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-       // }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        // } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     protected void onActivityResult ( int requestCode, int resultCode, Intent data){ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -656,27 +635,27 @@ public class FirmwareUpdate extends AppCompatActivity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private byte iicByteData[]={ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //0    1   2     3    4    5    6 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            0x03,0x00,0x0f,0x00,0x00,0x00,0x01,0x00, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //0    1   2     3    4    5    6 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        0x03,0x00,0x0f,0x00,0x00,0x00,0x01,0x00, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private byte iicWriteData[]={ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //0    1   2     3    4    5    6 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            0x03,0x00,0x0f,0x00,0x00,0x00,0x39,0x00, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //0    1   2     3    4    5    6 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        0x03,0x00,0x0f,0x00,0x00,0x00,0x39,0x00, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -839,13 +818,6 @@ public class FirmwareUpdate extends AppCompatActivity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    private boolean iicTest() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if(isReceiverMessage) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            return false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        return true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     //发送命令,使得S818可以通过IIC向GT9的固定地址读取1byte数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private byte iicByteRead(byte addressHigh,byte addressLow) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         iicByteData[1] = 0x00; //read GT9 command 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1075,7 +1047,7 @@ public class FirmwareUpdate extends AppCompatActivity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    byte[] mGt9FirmwareData = new byte[88*1024+512]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    byte[] mGt9FirmwareData = new byte[88 * 1024 + 512]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public void readFile() throws IOException { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //打开文件输入流 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1240,31 +1212,27 @@ public class FirmwareUpdate extends AppCompatActivity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //return false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //int mOffset = mGt9FirmwareData.length - mDspIsplength; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//mGt9FirmwareData 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-if(true) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    if (mGt9FirmwareData[1] == 0x01 && mGt9FirmwareData[2] == 0x60) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (!iicWrite(maddressHigh, maddressLow, mGt9FirmwareData, FW_DSP_ISP_OFFSET, FW_DSP_ISP_LENGTH)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            // FwUpdateMessage(L"Set boot from sram failed", MSG_ERR); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-           // mError.setText("burn 4k dsp_isp failed"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Update_log = "burn 4k dsp_isp failed"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (mGt9FirmwareData[1] == 0x01 && mGt9FirmwareData[2] == 0x60) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (!iicWrite(maddressHigh, maddressLow, mGt9FirmwareData, FW_DSP_ISP_OFFSET, FW_DSP_ISP_LENGTH)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                // FwUpdateMessage(L"Set boot from sram failed", MSG_ERR); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+               // mError.setText("burn 4k dsp_isp failed"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                Update_log = "burn 4k dsp_isp failed"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            return false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //mError.setText("burn 4k dsp_isp successed"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                Update_log = "burn 4k dsp_isp successed"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //mError.setText("burn 4k dsp_isp successed"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Update_log = "burn 4k dsp_isp successed"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+           // mError.setText("get FW data error, burn 4k dsp_isp failed"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Update_log = "get FW data error, burn 4k dsp_isp failed"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-       // mError.setText("get FW data error, burn 4k dsp_isp failed"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Update_log = "get FW data error, burn 4k dsp_isp failed"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        return false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // if (!recallCheck(maddressHigh, maddressLow, mGt9FirmwareData, FW_DSP_ISP_OFFSET, FW_DSP_ISP_LENGTH)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         maddressHigh = (byte) 0xC0; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1291,42 +1259,37 @@ if(true) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        maddressHigh = (byte) 0x42; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        maddressLow = (byte) 0x18;   //_rRW_MISCTL__BOOT_OPT_B0_   4 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        msubcommand = 0x0f;  //no command 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        mdata = (byte) 0x00; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    maddressHigh = (byte) 0x42; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    maddressLow = (byte) 0x18;   //_rRW_MISCTL__BOOT_OPT_B0_   4 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    msubcommand = 0x0f;  //no command 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    mdata = (byte) 0x00; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    if (!iicByteWrite(maddressHigh, maddressLow, msubcommand, mdata)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //mError.setText("set scramble failed"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Update_log = "set scramble failed"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        return false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!iicByteWrite(maddressHigh, maddressLow, msubcommand, mdata)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //mError.setText("set scramble failed"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Update_log = "set scramble failed"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    maddressHigh = (byte) 0x40; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    maddressLow = (byte) 0x48;   //_bRW_MISCTL__SRAM_BANK   5 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    msubcommand = 0x0f;  //no command 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    mdata = (byte) 0x03; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    if (!iicByteWrite(maddressHigh, maddressLow, msubcommand, mdata)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //mError.setText("select bank3 failed"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Update_log = "select bank3 failed"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        return false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        maddressHigh = (byte) 0x40; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        maddressLow = (byte) 0x48;   //_bRW_MISCTL__SRAM_BANK   5 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        msubcommand = 0x0f;  //no command 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        mdata = (byte) 0x03; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!iicByteWrite(maddressHigh, maddressLow, msubcommand, mdata)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //mError.setText("select bank3 failed"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Update_log = "select bank3 failed"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//return false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     byte[] eraseBuf = new byte[0x800+0x1000]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private boolean eraseBootLoader() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //memset(pBuf, 0xFF, 0x800); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         for (int i = 0; i < 0x1800; i++) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2437,7 +2400,6 @@ if(true) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         mUsbEndpointIn = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         mUsbEndpointOut = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //mToggle = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         isReceiverMessage = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         isNeedFindDevice = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         mThreadPool.shutdownNow(); 
			 |