fix bug#198380 198378 198429 198411;修改kyrealtime模块中获取上传/下载网速的实现;补充libkysdk-realtime依赖,解决依赖不满足问题
This commit is contained in:
parent
168a6b53c2
commit
3b944f169c
|
@ -1,3 +1,12 @@
|
|||
libkysdk-system (2.2.3.5-0k0.17) yangtze; urgency=medium
|
||||
|
||||
*Bug号:198380 198378 198429 198411
|
||||
*需求号:
|
||||
*其他修改:修改kyrealtime模块中获取上传/下载网速的实现
|
||||
补充libkysdk-realtime依赖,解决依赖不满足问题
|
||||
|
||||
-- szm-min <shaozhimin@kylinos.cn> Wed, 11 Oct 2023 09:43:29 +0800
|
||||
|
||||
libkysdk-system (2.2.3.5-0k0.16) yangtze; urgency=medium
|
||||
|
||||
*Bug号:
|
||||
|
|
|
@ -351,7 +351,10 @@ Package: libkysdk-realtime
|
|||
Architecture: any
|
||||
Section: utils
|
||||
Depends: libkysdk-systemcommon,
|
||||
libc6
|
||||
libc6,
|
||||
libgcc-s1 | libgcc1,
|
||||
libstdc++6,
|
||||
lm-sensors
|
||||
Multi-Arch: same
|
||||
Description: 运行时信息库
|
||||
|
||||
|
|
|
@ -88,7 +88,6 @@ char *cmd_exec(char *file)
|
|||
} else {
|
||||
close(fd[1]); // 关闭写入端
|
||||
|
||||
char buffer[1024];
|
||||
const char* targetLine1 = "Display Product Name"; // 要匹配的目标行
|
||||
const char* targetLine2 = "Alphanumeric Data String"; // 要匹配的目标行
|
||||
|
||||
|
@ -136,7 +135,7 @@ void kdk_edid(char *name)
|
|||
return;
|
||||
}
|
||||
int i = 0;
|
||||
memset(edid_character, 0, sizeof(edid_character));
|
||||
memset(edid_character, 0, 1024);
|
||||
while(fgets(edid_text, sizeof(edid_text), pipeLine))
|
||||
{
|
||||
if(i != 1)
|
||||
|
@ -490,9 +489,6 @@ const float kdk_edid_get_gamma(char *name)
|
|||
float ga = 0.00;
|
||||
char canonical_filename[100] = "\0";
|
||||
char filename[100] = "\0";
|
||||
// char edid_text[24] = "\0";
|
||||
// char num[24] = "\0";
|
||||
// char line[11520] = "\0";
|
||||
char str_name[32] = "\0";
|
||||
strcpy(str_name, name);
|
||||
dirfd = opendir("/sys/class/drm");
|
||||
|
@ -610,17 +606,19 @@ float kdk_edid_get_size(char *name)
|
|||
return 0.00;
|
||||
}
|
||||
int fd;
|
||||
unsigned char *edid;
|
||||
char path[512] = "\0";
|
||||
DIR *dirfd = NULL;
|
||||
struct dirent *direfd = NULL;
|
||||
char canonical_filename[100] = "\0";
|
||||
float size = 0.00;
|
||||
char filename[100] = "\0";
|
||||
// char edid_text[24] = "\0";
|
||||
char str_name[32] = "\0";
|
||||
strcpy(str_name, name);
|
||||
|
||||
FILE *fp = NULL;
|
||||
int num1 = 0;
|
||||
int num2 = 0;
|
||||
|
||||
dirfd = opendir("/sys/class/drm");
|
||||
if (!dirfd)
|
||||
{
|
||||
|
@ -658,75 +656,68 @@ float kdk_edid_get_size(char *name)
|
|||
return 0.00;
|
||||
}
|
||||
fclose(fs);
|
||||
FILE *fp = popen("edid-decode /tmp/sdk-edid", "r");
|
||||
fp = popen("edid-decode /tmp/sdk-edid", "r");
|
||||
if(!fp)
|
||||
{
|
||||
closedir(dirfd);
|
||||
return 0.00;
|
||||
}
|
||||
char *msize = get_val_from_file(fp, "Maximum image size");
|
||||
if(!msize)
|
||||
{
|
||||
closedir(dirfd);
|
||||
pclose(fp);
|
||||
return 0.00;
|
||||
}
|
||||
char *buf[3];
|
||||
int i = 0;
|
||||
char *p = strtok(msize, "x");
|
||||
while (p)
|
||||
{
|
||||
buf[i] = p;
|
||||
i++;
|
||||
p = strtok(NULL, "x");
|
||||
}
|
||||
char fs1[12] = "\0";
|
||||
char fs2[12] = "\0";
|
||||
strcpy(fs1, buf[0]);
|
||||
strcpy(fs2, buf[1]);
|
||||
strskipspace(fs1);
|
||||
strskipspace(fs2);
|
||||
int num1 = 0;
|
||||
int num2 = 0;
|
||||
sscanf(fs1, "%d", &num1);
|
||||
sscanf(fs2, "%d", &num2);
|
||||
|
||||
size = sqrt(pow(num1, 2) + pow(num2, 2)) / 2.54;
|
||||
free(msize);
|
||||
closedir(dirfd);
|
||||
pclose(fp);
|
||||
return size;
|
||||
|
||||
}
|
||||
else{
|
||||
edid = extract_edid(fd);
|
||||
if (!edid)
|
||||
char repath[527] = "\0";
|
||||
sprintf(repath, "edid-decode %s", path);
|
||||
fp = popen(repath, "r");
|
||||
if(!fp)
|
||||
{
|
||||
goto err_out;
|
||||
closedir(dirfd);
|
||||
return 0.00;
|
||||
}
|
||||
|
||||
if (!edid || memcmp(edid, "\x00\xFF\xFF\xFF\xFF\xFF\xFF\x00", 8))
|
||||
{
|
||||
goto err_out;
|
||||
}
|
||||
close(fd);
|
||||
closedir(dirfd);
|
||||
|
||||
if (edid[0x15] && edid[0x16])
|
||||
{
|
||||
size = sqrt(pow(edid[0x15], 2) + pow(edid[0x16], 2)) / 2.54;
|
||||
}
|
||||
free(edid);
|
||||
return size;
|
||||
}
|
||||
|
||||
err_out:
|
||||
close(fd);
|
||||
closedir(dirfd);
|
||||
if(edid)
|
||||
char xsize[16] = "\0";
|
||||
char ysize[16] = "\0";
|
||||
char *tmp = get_val_from_file(fp, "Maximum image size");
|
||||
if(!tmp)
|
||||
{
|
||||
free(edid);
|
||||
printf("test\n");
|
||||
closedir(dirfd);
|
||||
pclose(fp);
|
||||
return 0.00;
|
||||
}
|
||||
return 0.00;
|
||||
char *msize = get_val_from_file(fp, "Detailed mode");
|
||||
if(msize)
|
||||
{
|
||||
sscanf(msize, "%*s %*s %*s %s %*s %*s %s", xsize, ysize);
|
||||
num1 = atoi(xsize);
|
||||
num2 = atoi(ysize);
|
||||
size = sqrt(pow(num1, 2) + pow(num2, 2)) / 25.4;
|
||||
free(msize);
|
||||
free(tmp);
|
||||
}
|
||||
else if(tmp)
|
||||
{
|
||||
sscanf(tmp, "%s %*s %*s %s", xsize, ysize);
|
||||
num1 = atoi(xsize);
|
||||
num2 = atoi(ysize);
|
||||
size = sqrt(pow(num1, 2) + pow(num2, 2)) / 2.54;
|
||||
free(tmp);
|
||||
}
|
||||
closedir(dirfd);
|
||||
pclose(fp);
|
||||
|
||||
// greatwall
|
||||
if(!strcmp("24AL60", kdk_edid_get_model(name)))
|
||||
{
|
||||
size = 23.8;
|
||||
}
|
||||
|
||||
// X100
|
||||
if(!strcmp("LM133LF-8L02", kdk_edid_get_model(name)))
|
||||
{
|
||||
size = 13.3;
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
char *kdk_edid_get_max_resolution(char *name)
|
||||
|
@ -847,9 +838,7 @@ char *kdk_edid_get_model(char *name)
|
|||
return NULL;
|
||||
}
|
||||
int fd;
|
||||
// unsigned char *edid;
|
||||
char path[512] = "\0";
|
||||
char str_path[600] = "\0";
|
||||
DIR *dirfd = NULL;
|
||||
struct dirent *direfd = NULL;
|
||||
char canonical_filename[100] = "\0";
|
||||
|
|
|
@ -865,15 +865,8 @@ char *kdk_net_get_hosts_domain()
|
|||
return NULL;
|
||||
}
|
||||
|
||||
char *hosts = (char *)malloc(sizeof(char) * 256);
|
||||
if (hosts == NULL)
|
||||
{
|
||||
fclose(fp);
|
||||
return NULL;
|
||||
}
|
||||
memset(hosts, 0, 256);
|
||||
char line[4096] = "\0";
|
||||
memset(hosts, 0, sizeof(hosts));
|
||||
char strtmp[4096] = "\0";
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
while (fgets(line, sizeof(line), fp))
|
||||
|
@ -896,9 +889,20 @@ char *kdk_net_get_hosts_domain()
|
|||
}
|
||||
if((j == 6) && (strlen(line) != 0))
|
||||
{
|
||||
strcat(hosts, line);
|
||||
strcat(strtmp, line);
|
||||
}
|
||||
}
|
||||
|
||||
int len = strlen(strtmp);
|
||||
|
||||
char *hosts = (char *)malloc(sizeof(char) * len + 1);
|
||||
if (hosts == NULL)
|
||||
{
|
||||
fclose(fp);
|
||||
return NULL;
|
||||
}
|
||||
memset(hosts, 0, len + 1);
|
||||
strcpy(hosts, strtmp);
|
||||
fclose(fp);
|
||||
strstripspace(hosts);
|
||||
return hosts;
|
||||
|
|
|
@ -743,7 +743,7 @@ char *kdk_get_process_start_time(int proc_num)
|
|||
struct timespec time2 = {0, 0};
|
||||
clock_gettime(CLOCK_MONOTONIC, &time2);
|
||||
|
||||
starttime = (unsigned long long)(time1 / HZ) + (now - time2.tv_sec);
|
||||
starttime = (unsigned long long)(time1 / HZ) + (now - time2.tv_sec) - 0.1;
|
||||
|
||||
time_t time3 = starttime;
|
||||
|
||||
|
|
|
@ -13,8 +13,8 @@ struct if_data
|
|||
/* generic interface information */
|
||||
unsigned int ifi_opackets; /* packets sent on interface */
|
||||
unsigned int ifi_ipackets; /* packets received on interface */
|
||||
unsigned int ifi_obytes; /* total number of octets sent */
|
||||
unsigned int ifi_ibytes; /* total number of octets received */
|
||||
unsigned int ifi_obytes; /* total number of octets sent */
|
||||
};
|
||||
|
||||
struct if_info
|
||||
|
@ -151,7 +151,7 @@ float kdk_real_get_net_speed(const char *nc)
|
|||
|
||||
double kdk_real_get_cpu_temperature()
|
||||
{
|
||||
char tmp[32] = "\0";
|
||||
char tmp[1024] = "\0";
|
||||
char path[64] = "\0";
|
||||
for (int i = 0;; i++)
|
||||
{
|
||||
|
@ -170,14 +170,46 @@ double kdk_real_get_cpu_temperature()
|
|||
continue;
|
||||
break;
|
||||
}
|
||||
double temp = 0.0;
|
||||
FILE *fp = fopen(path, "r");
|
||||
if (fp)
|
||||
{
|
||||
fgets(tmp, sizeof(tmp), fp);
|
||||
fclose(fp);
|
||||
float temp = atof(tmp);
|
||||
temp = atof(tmp);
|
||||
return temp < 100 ? temp : temp / 1000;
|
||||
}
|
||||
if(fabs(temp - 0.0) < 0.000001)
|
||||
{
|
||||
fp = popen("sensors","r");
|
||||
if(fp)
|
||||
{
|
||||
while (fgets(tmp, sizeof(tmp), fp))
|
||||
{
|
||||
if (0 == strncmp(tmp, "Core", 4))
|
||||
{
|
||||
char *pos = tmp, *start = NULL;
|
||||
while (*pos != '+' && *pos != '\0')
|
||||
{
|
||||
pos++;
|
||||
continue;
|
||||
}
|
||||
start = pos++;
|
||||
while (*pos != '\0')
|
||||
{
|
||||
if(*pos == 0xc2 && *(pos + 1) == 0xb0) //字符"°"
|
||||
break;
|
||||
pos++;
|
||||
}
|
||||
*pos = '\0';
|
||||
temp = atof(start);
|
||||
fclose(fp);
|
||||
return temp;
|
||||
}
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue