Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 18 additions & 13 deletions vclog/vclog.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ enum
};

#define MAX(x, y) (((x) > (y)) ? (x) : (y))
#define ARRAY_SIZE(_a) (sizeof(_a)/sizeof(_a[0]))

#define FBIODMACOPY _IOW('z', 0x22, struct fb_dmacopy)

#ifdef DEBUG
Expand Down Expand Up @@ -354,25 +356,28 @@ static bool find_logs(uint32_t *logs_start, uint32_t *logs_size)

static bool prepare_vc_mapping(uint32_t vc_start, uint32_t vc_size)
{
const char *fb_filename = "/dev/fb0";
const char *dma_filenames[] = { "/dev/vc-mem", "/dev/fb0" };
const char *mem_filename = "/dev/mem";
struct fb_dmacopy ioparam;
uint32_t id;
int fd;
int err, fd, i;

ioparam.dst = &id;
ioparam.src = vc_start;
ioparam.length = sizeof(id);

if ((fd = open(fb_filename, O_RDWR | O_SYNC)) >= 0)
for (i = 0; i < (int)ARRAY_SIZE(dma_filenames); i++)
{
struct fb_dmacopy ioparam;
int err;
ioparam.dst = &id;
ioparam.src = vc_start;
ioparam.length = sizeof(id);
err = ioctl(fd, FBIODMACOPY, &ioparam);
if (err == 0 && id == LOG_ID)
if ((fd = open(dma_filenames[i], O_RDWR | O_SYNC)) >= 0)
{
dma_fd = fd;
goto success;
err = ioctl(fd, FBIODMACOPY, &ioparam);
if (err == 0 && id == LOG_ID)
{
dma_fd = fd;
goto success;
}
close(fd);
}
close(fd);
}

if ((fd = open(mem_filename, O_RDONLY)) >= 0)
Expand Down