blob: bc529a91babb1239408c0fe18bf50e8f6703e937 [file] [log] [blame]
/* GStreamer
* Copyright (C) 2023 <xuesong.jiang@amlogic.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
static int set_osd_blank(int blank)
{
const char *path1 = "/sys/class/graphics/fb0/blank";
const char *path3 = "/sys/class/graphics/fb0/osd_display_debug";
int fd;
char cmd[128] = {0};
fd = open(path3, O_CREAT | O_RDWR | O_TRUNC, 0644);
if (fd >= 0)
{
sprintf(cmd, "%d", blank);
write(fd, cmd, strlen(cmd));
close(fd);
}
fd = open(path1, O_CREAT | O_RDWR | O_TRUNC, 0644);
if (fd >= 0)
{
sprintf(cmd, "%d", blank);
write(fd, cmd, strlen(cmd));
close(fd);
}
return 0;
}
static int amsysfs_set_sysfs_str(const char *path, const char *val)
{
int fd;
fd = open(path, O_CREAT | O_RDWR | O_TRUNC, 0644);
if (fd >= 0)
{
write(fd, val, strlen(val));
close(fd);
return 0;
}
return -1;
}
static int set_dmx_source()
{
amsysfs_set_sysfs_str("/sys/class/stb/source", "dmx0");
amsysfs_set_sysfs_str("/sys/class/stb/demux0_source", "hiu");
return 0;
}