Add BT indicator to menu core.

This commit is contained in:
sorgelig
2019-04-05 23:35:21 +08:00
parent 4112165389
commit 28059fb4e9
2 changed files with 23 additions and 3 deletions

View File

@@ -17,7 +17,7 @@ unsigned char charfont[256][8] =
{ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55 }, // 1 [0x1]
{ 0x2A,0x2A,0x2A,0x2A,0x2A,0x2A,0x2A,0x2A }, // 2 [0x2]
{ 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14 }, // 3 [0x3]
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, // 4 [0x4]
{ 0x00,0x7f,0x6b,0x77,0x41,0x55,0x6b,0x7f }, // 4 [0x4] bluetooth
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, // 5 [0x5]
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, // 6 [0x6]
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, // 7 [0x7]

View File

@@ -489,6 +489,24 @@ static uint32_t menu_key_get(void)
return(c);
}
static int has_bt()
{
FILE *fp;
static char out[1035];
fp = popen("hcitool dev | grep hci0", "r");
if (!fp) return 0;
int ret = 0;
while (fgets(out, sizeof(out) - 1, fp) != NULL)
{
if (strlen(out)) ret = 1;
}
pclose(fp);
return ret;
}
static char* getNet(int spec)
{
int netType = 0;
@@ -3688,17 +3706,19 @@ void HandleUI(void)
}
}
sprintf(str, " MiSTer ");
sprintf(str, " MiSTer ");
time_t t = time(NULL);
struct tm tm = *localtime(&t);
if (tm.tm_year >= 117)
{
strftime(str + strlen(str), sizeof(str) - 1 - strlen(str), "%b %d %a %H:%M:%S", &tm);
strftime(str + strlen(str), sizeof(str) - 1 - strlen(str), "%b %d %a%H:%M:%S", &tm);
}
int netType = (int)getNet(0);
if (netType) str[9] = 0x1b + netType;
if (has_bt()) str[10] = 4;
str[21] = ' ';
OsdWrite(16, "", 1, 0);
OsdWrite(17, str, 1, 0);