bluez/src/kylin_bluetooth.c

46 lines
838 B
C

/*
*
* kylin - Bluetooth configure for Linux
*
* Copyright (C) 2023- Kylin Corporation
* Copyright (C) 2023- Dengtuo Kylin <dengtuo@kylinos.cn>
*
*
*/
#include "kylin_bluetooth.h"
bool is_huawei = false;
bool systemEnvironmentinfo(void)
{
FILE *fp;
int nread=0;
ssize_t len = 0;
char *buf=NULL;
char *buffer=NULL;
char *file = FILE_CPUINFO;
fp = fopen(file, "rb");
if (fp == NULL)
{
printf("error to open: %s\n", file);
fclose(fp);
return false;
}
while((nread = getline(&buffer, &len, fp)) != -1)
{
if((buf=strstr(buffer, "Hardware"))!=NULL &&
((buf=strstr(buffer, "HUAWEI"))!=NULL ||
(buf=strstr(buffer, "Kirin" ))!=NULL )) /* 简单实现grep的功能 */
{
fclose(fp);
return true;
}
}
fclose(fp);
return false;
}