| 
					
				 | 
			
			
				@@ -85,10 +85,13 @@ public class Config extends AppCompatActivity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private UsbEndpoint mUsbEndpointIn; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private int iProductId; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private byte byProductType = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private static final byte CHIP_TYPE_UNKNOW = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private static final byte GT9 = 0x01; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    private static final byte GT7 = 0x02; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    private static final byte GT29336 = 0x03; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    private static final byte GT2931 = 0x04; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private static final byte GT9P = 0x02; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private static final byte GT738x = 0x03; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private static final byte GT29336 = 0x04;  //CHIP_TYPE_BERLINB 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private static final byte GT989x = 0x05;   //CHIP_TYPE_BERLINA 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private static final byte GT2931 = 0x06;   //CHIP_TYPE_BERLIND 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private Button mReadCfg; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private Button mSendCfg; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private byte[] mBytes = new byte[2048]; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -375,6 +378,8 @@ public class Config extends AppCompatActivity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     //mError.setText(""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     mReadCfg.setEnabled(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     mSendCfg.setEnabled(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    iicRead32Bits((byte)0x01, (byte)0x00, (byte)0x14, (byte)47, mBytes, 2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    byProductType = mBytes[1]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 case RECEIVER_MESSAGE_SUCCESS://成功接受到数据 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2019,22 +2024,7 @@ public class Config extends AppCompatActivity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             mUsbDeviceConnection.claimInterface(mUsbInterface, true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             if(null != mUsbEndpointIn){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 iProductId = usbDevice.getProductId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                /* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                if ((iProductId == 0x0819) || (iProductId == 0x8191) || (iProductId == 0x0528) ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    byProductType = GT7; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    byProductType = GT29336; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                if ((iProductId == 0x0829) || (iProductId == 0x0528) || (iProductId == 0x0928)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    byProductType = GT29336; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    byProductType = GT2931; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 mHandler.sendEmptyMessage(CONNECTED_SUCCESS); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2657,7 +2647,7 @@ public class Config extends AppCompatActivity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         mCfg8100.setText(mConfigShow[showid++]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (byProductType == GT7) {  //GT7 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (byProductType == GT738x) {  //GT7 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             mCfg8101.setText(mConfigShow[showid++]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             mCfg8102.setText(mConfigShow[showid++]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             mCfg8103.setText(mConfigShow[showid++]); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -3545,7 +3535,7 @@ public class Config extends AppCompatActivity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //30ms一次轮询[0x10174],如果是0x80,说明GT29XX已准备好,可以send cfg 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 do { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     SystemClock.sleep(30); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    iicRead32Bits((byte)0x01, (byte)0x01, (byte)0x74, mBytes, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    iicRead32Bits((byte)0x01, (byte)0x01, (byte)0x74, (byte)0x0f, mBytes, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 }while(mBytes[0] != (byte)0x80); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //value = configBuilder.toString(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -3632,7 +3622,7 @@ public class Config extends AppCompatActivity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //30ms一次轮询[0x10174],如果是0x80,说明GT29XX已接收配置 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 do { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     SystemClock.sleep(30); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    iicRead32Bits((byte)0x01, (byte)0x01, (byte)0x74, mBytes, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    iicRead32Bits((byte)0x01, (byte)0x01, (byte)0x74, (byte)0x0f, mBytes, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     if (mBytes[0] == (byte)0x03) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         stMessageLog = "Config checksum is error!!"; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -3662,7 +3652,7 @@ public class Config extends AppCompatActivity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //30ms一次轮询[0x10174],如果是0x80,说明GT29XX已完成 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 do { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     SystemClock.sleep(30); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    iicRead32Bits((byte)0x01, (byte)0x01, (byte)0x74, mBytes, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    iicRead32Bits((byte)0x01, (byte)0x01, (byte)0x74, (byte)0x0f, mBytes, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     if (mBytes[0] == (byte)0x01) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         stMessageLog = "receive finish!!"; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -3717,7 +3707,7 @@ public class Config extends AppCompatActivity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //read [0x10174] = 0x80 or 0x01,表示上条命令已执行完毕,或当前固件处于空闲状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 do { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     SystemClock.sleep(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    iicRead32Bits((byte)0x01, (byte)0x01, (byte)0x74, mBytes, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    iicRead32Bits((byte)0x01, (byte)0x01, (byte)0x74, (byte)0x0f, mBytes, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 }while((mBytes[0] != 0x80) && (mBytes[0] != 0x01)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -3734,13 +3724,13 @@ public class Config extends AppCompatActivity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //read [0x10175] = 0x80,config is ready 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //do { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //    SystemClock.sleep(30); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                //    iicRead32Bits((byte)0x01, (byte)0x01, (byte)0x75, mBytes, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //    iicRead32Bits((byte)0x01, (byte)0x01, (byte)0x75, (byte)0x0f, mBytes, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //}while(mBytes[0] != (byte)0x80); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //read [0x10174] = 0x80,config is ready 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 do { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     SystemClock.sleep(30); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    iicRead32Bits((byte)0x01, (byte)0x01, (byte)0x74, mBytes, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    iicRead32Bits((byte)0x01, (byte)0x01, (byte)0x74, (byte)0x0f, mBytes, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 }while(mBytes[0] != (byte)0x80); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //SystemClock.sleep(2); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -3756,11 +3746,11 @@ public class Config extends AppCompatActivity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //read buffer [0x13B74]/[0X1218C] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                iicRead32Bits(addrfirstbyte, addrsecondbyte, addrthirdbyte, mBytes, 63);  //read config head 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                iicRead32Bits(addrfirstbyte, addrsecondbyte, addrthirdbyte, (byte)0x0f, mBytes, 63);  //read config head 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 int iConfigSize = 64 + (int)(mBytes[60] & 0xFF) * 256 + (mBytes[59] & 0xFF);   //the head lend is 64 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                iicRead32Bits(addrfirstbyte, addrsecondbyte, addrthirdbyte, mBytes, iConfigSize);  //read config 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                iicRead32Bits(addrfirstbyte, addrsecondbyte, addrthirdbyte, (byte)0x0f, mBytes, iConfigSize);  //read config 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 for (int i = 0; i < iConfigSize; i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -3799,7 +3789,7 @@ public class Config extends AppCompatActivity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //read [0x10175] = 0x80,read config is over 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 do { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     SystemClock.sleep(30); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    iicRead32Bits((byte)0x01, (byte)0x01, (byte)0x74, mBytes, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    iicRead32Bits((byte)0x01, (byte)0x01, (byte)0x74, (byte)0x0f, mBytes, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 }while(mBytes[0] != (byte)0x80); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //SystemClock.sleep(2); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -3808,7 +3798,7 @@ public class Config extends AppCompatActivity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 stMessageLogShow = stMessageLogShow.concat(stMessageLog); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 mShow.setText(stMessageLogShow); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                iicRead32Bits((byte)0x01, (byte)0x00, (byte)0x2B, mBytes, 4);  //read Sensor ID 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                iicRead32Bits((byte)0x01, (byte)0x00, (byte)0x2B, (byte)0x0f, mBytes, 4);  //read Sensor ID 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 tvVenderID.setText("VenderID:"+Integer.toString(mBytes[0] & 0xFF)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 /* 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -4090,12 +4080,12 @@ public class Config extends AppCompatActivity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //发送命令,使得S8xx可以通过IIC向GT79xx的固定地址读取任意bytes的数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    private boolean iicRead32Bits(byte addrfirstbyte,byte addrsecondbyte,byte addrthirdbyte,byte[] wBuffer,int length) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    //发送命令,使得S8xx可以通过IIC向GT29xx的固定地址读取任意bytes的数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private boolean iicRead32Bits(byte addrfirstbyte,byte addrsecondbyte,byte addrthirdbyte,byte subCommand,byte[] wBuffer,int length) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         int i; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        iicByteData[1] = 0x0f; //7bit:0-read,1-write;other:command 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        iicByteData[1] = (byte)(0 | subCommand);//0x0f; //7bit:0-read,1-write;other:command 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //iicByteData[2] = 0x0f; //no command 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         iicByteData[2] = addrfirstbyte; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         iicByteData[3] = addrsecondbyte; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -4111,7 +4101,7 @@ public class Config extends AppCompatActivity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         int address2 = addrthirdbyte & 0xff; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         int address = address1 | address2; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        int sendTimes = length/63;  //预计是向下取整,所以+1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        int sendTimes = length / 63;  //预计是向下取整,所以+1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if ((length % 63) != 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -4125,14 +4115,14 @@ public class Config extends AppCompatActivity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             int finalOffset = k*63; //每次只能发57bytes数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             int offset = k * 64; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-              if(length - (finalOffset ) < 63) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if(length - (finalOffset ) < 63) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-             iicByteData[6] = (byte) (length - (finalOffset));  //length 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                iicByteData[6] = (byte) (length - (finalOffset));  //length 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                iicByteData[6] = 63; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-               else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-              { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-              iicByteData[6] = 63; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-              } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //发送读取命令 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             i = mUsbDeviceConnection.bulkTransfer(mUsbEndpointOut, iicByteData, 0, 0x40, 100); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -4307,7 +4297,7 @@ public class Config extends AppCompatActivity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //if(false) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (!iicRead32Bits(addrfirstbyte, addrsecondbyte, addrthirdbyte, pbBuf, length)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (!iicRead32Bits(addrfirstbyte, addrsecondbyte, addrthirdbyte, (byte)0x0f, pbBuf, length)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //if (!iicRead(addressHigh, addressLow, pbBuf, length)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //FwUpdateMessage(L"recall i2c error failed", MSG_ERR); 
			 |