feat: create cook branch
This commit is contained in:
@@ -290,7 +290,7 @@ extern int gx_fsm(long sec, int msec);
|
||||
|
||||
/*----------------------------------------------------*/
|
||||
|
||||
static u8 wxc2_version[4] = {1, 0, 1, 46};
|
||||
static u8 wxc2_version[4] = {1, 0, 1, 50};
|
||||
//static char wxc2_mini_version[4]={""};
|
||||
|
||||
static int wxc2_update_version(char *state_str)
|
||||
@@ -730,188 +730,6 @@ static int CheckHDLicense(unsigned char *HDSerailNumber)
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if 1//def Kylin_and_2204_lic
|
||||
static int GetHDInfo()
|
||||
{
|
||||
FILE *fpConf=NULL;
|
||||
int i,j=0,k;
|
||||
char ethmac[64]="",meminfo[64]="",hwinfo[128]="",*start,*offset,*offset_0,buf[8192]="",tmp[2048]="";//,cpuinfo[64]=""
|
||||
char ascii_buf[128] = {0};
|
||||
unsigned char TmpStr[64] = {0}, act_req_code[128] = {0}, act_req_code_des[128] = {0};
|
||||
int ret, offset_len;
|
||||
|
||||
printf("Get HD info ...\n");
|
||||
|
||||
memset(ethmac, 0, 64);
|
||||
sprintf(buf,"ip a > ../log/hwinfo");
|
||||
ret = system(buf);
|
||||
fpConf = fopen("../log/hwinfo","r");
|
||||
if (fpConf == NULL) {
|
||||
printf("Log directory may be missing!\n");
|
||||
return 0;
|
||||
}
|
||||
ret = fread(buf,2048,1,fpConf);
|
||||
start = buf;
|
||||
for (;;) {
|
||||
offset = strstr(start,"ether ");
|
||||
if (offset == NULL) {
|
||||
offset = strstr(start,"HWaddr ");
|
||||
offset_len = 7;
|
||||
} else {
|
||||
offset_len = 6;
|
||||
}
|
||||
if (offset != NULL) {
|
||||
strncpy(tmp, start, offset-start);
|
||||
tmp[offset-start] = 0;
|
||||
if (strstr(tmp, "docker") != NULL) {
|
||||
start = offset + offset_len;
|
||||
continue;
|
||||
}
|
||||
offset += offset_len;
|
||||
for(i=0,j=0;i<64;i++) {
|
||||
if ((*(offset+i)=='\n') ||
|
||||
(*(offset+i)==' ')) {
|
||||
ethmac[j] = 0;
|
||||
break;
|
||||
} else if (*(offset+i)==':') {
|
||||
continue;
|
||||
} else {
|
||||
ethmac[j] = tolower(*(offset+i));
|
||||
j++;
|
||||
}
|
||||
}
|
||||
ethmac[j] = 0;
|
||||
}
|
||||
fclose(fpConf);
|
||||
remove("../log/hwinfo");
|
||||
break;
|
||||
}
|
||||
|
||||
int uuid_or_cpuid=0; //0=CPUID, 1=UUID
|
||||
memset(meminfo, 0, 64);
|
||||
sprintf(buf,"dmidecode | grep UUID > ../log/hwinfo");
|
||||
ret = system(buf);
|
||||
fpConf = fopen("../log/hwinfo","r");
|
||||
if(fpConf != NULL) {
|
||||
ret = fread(buf,2048,1,fpConf);
|
||||
offset_0=offset = strstr(buf,"UUID: ");
|
||||
if (offset != NULL) {
|
||||
uuid_or_cpuid = 1;
|
||||
for(i=6,j=0;i<64;i++) {
|
||||
if (*(offset+i)=='\n') {
|
||||
meminfo[j] = 0;
|
||||
break;
|
||||
} else if (isdigit(*(offset+i))) {
|
||||
meminfo[j] = *(offset+i);
|
||||
j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose(fpConf);
|
||||
remove("../log/hwinfo");
|
||||
}
|
||||
|
||||
if( uuid_or_cpuid == 0) {//UUID not found
|
||||
// CPUID
|
||||
memset(meminfo, 0, 64);
|
||||
sprintf(buf,"dmidecode -t 4 | grep ID >../log/hwinfo");
|
||||
ret = system(buf);
|
||||
fpConf = fopen("../log/hwinfo","r");
|
||||
if(fpConf != NULL) {
|
||||
ret = fread(buf,2048,1,fpConf);
|
||||
offset_0=offset = strstr(buf,"ID: ");
|
||||
if (offset != NULL) {
|
||||
for(i=4,j=0;i<64;i++) {
|
||||
if (*(offset+i)=='\n') {
|
||||
meminfo[j] = 0;
|
||||
break;
|
||||
} else if (isdigit(*(offset+i))) {
|
||||
meminfo[j] = *(offset+i);
|
||||
j++;
|
||||
}
|
||||
}
|
||||
offset = strstr(offset_0+4,"ID: ");
|
||||
if (offset != NULL) {
|
||||
for(i=4;i<64;i++) {
|
||||
if (*(offset+i)=='\n') {
|
||||
meminfo[j] = 0;
|
||||
break;
|
||||
} else if (isdigit(*(offset+i))) {
|
||||
meminfo[j] = *(offset+i);
|
||||
j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose(fpConf);
|
||||
remove("../log/hwinfo");
|
||||
}
|
||||
}
|
||||
|
||||
strcpy(hwinfo, "");
|
||||
strcat(hwinfo, ethmac);
|
||||
i = j = strlen(ethmac);
|
||||
hwinfo[i++] = ethmac[0];
|
||||
hwinfo[i++] = ethmac[1];
|
||||
hwinfo[i++] = ethmac[2];
|
||||
hwinfo[i++] = ethmac[3];
|
||||
hwinfo[i] = 0;
|
||||
strcat(hwinfo, meminfo);
|
||||
j = strlen(meminfo);
|
||||
i += j;
|
||||
hwinfo[i++] = ethmac[4];
|
||||
hwinfo[i++] = ethmac[5];
|
||||
hwinfo[i++] = ethmac[6];
|
||||
hwinfo[i++] = ethmac[7];
|
||||
hwinfo[i] = 0;
|
||||
//strcat(hwinfo, cpuinfo);
|
||||
//j = strlen(cpuinfo);
|
||||
//i += j;
|
||||
hwinfo[i++] = ethmac[8];
|
||||
hwinfo[i++] = ethmac[9];
|
||||
hwinfo[i++] = ethmac[10];
|
||||
hwinfo[i++] = ethmac[11];
|
||||
hwinfo[i] = 0;
|
||||
|
||||
j = strlen(hwinfo);
|
||||
if (j == 0) {
|
||||
printf("Missing Activation Request Info!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
k = (j + 7) / 8;
|
||||
memset(hwinfo + j, '0', 128 - j);
|
||||
|
||||
memset(act_req_code, 0, 128);
|
||||
for (i = 0; i < k; i++) {
|
||||
memset(TmpStr, 0, 64);
|
||||
DesCrypt(TmpStr, (unsigned char *)hwinfo + 8 * i, NULL, 0);
|
||||
memcpy(act_req_code + 8 * i, TmpStr, 8);
|
||||
}
|
||||
memset(ascii_buf, 0, 128);
|
||||
BcdToAscii(ascii_buf, act_req_code, k * 16);
|
||||
|
||||
fpConf = fopen("../log/Activation_request_code.txt","w");
|
||||
if (fpConf != NULL) {
|
||||
fprintf(fpConf, "%s\n", ascii_buf);
|
||||
fclose(fpConf);
|
||||
} else {
|
||||
printf("Missing Activation_request_code file!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
memset(act_req_code_des, 0, 128);
|
||||
for (i = 0; i < k; i++) {
|
||||
memset(TmpStr, 0, 64);
|
||||
DesCrypt(TmpStr, act_req_code + 8 * i, NULL, 0);
|
||||
memcpy(act_req_code_des + 8 * i, TmpStr, 8);
|
||||
}
|
||||
wxc2HDInfo[0] = k*8;
|
||||
memcpy(&wxc2HDInfo[1],act_req_code_des,k*8);
|
||||
printf("Get HD info... OK!\n");
|
||||
return 1;
|
||||
}
|
||||
#else
|
||||
static int GetHDInfo()
|
||||
{
|
||||
FILE *fpConf=NULL;
|
||||
@@ -1258,7 +1076,6 @@ if(lic_mem_cpu)
|
||||
printf("Get HD info... OK!\n");
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void SaveWxc2SystemConf()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user