Improve regular messages
This commit is contained in:
parent
887b88fdda
commit
b9fd63154c
@ -285,9 +285,8 @@ static void links_dump_buf_list(char *output, buffer_list_t *buf_list)
|
|||||||
void links_dump(link_t *all_links)
|
void links_dump(link_t *all_links)
|
||||||
{
|
{
|
||||||
char line[4096];
|
char line[4096];
|
||||||
int n;
|
|
||||||
|
|
||||||
for (n = 0; all_links[n].source; n++) {
|
for (int n = 0; all_links[n].source; n++) {
|
||||||
link_t *link = &all_links[n];
|
link_t *link = &all_links[n];
|
||||||
|
|
||||||
line[0] = 0;
|
line[0] = 0;
|
||||||
@ -308,6 +307,4 @@ void links_dump(link_t *all_links)
|
|||||||
|
|
||||||
LOG_INFO(NULL, "Link %d: %s", n, line);
|
LOG_INFO(NULL, "Link %d: %s", n, line);
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_INFO(NULL, "%d links.", n);
|
|
||||||
}
|
}
|
||||||
|
@ -14,11 +14,11 @@ int v4l2_device_open_media_device(device_t *dev)
|
|||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
if (fstat(dev->v4l2->dev_fd, &st) < 0) {
|
if (fstat(dev->v4l2->dev_fd, &st) < 0) {
|
||||||
LOG_ERROR(dev, "Cannot get fstat");
|
LOG_VERBOSE(dev, "Cannot get fstat");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (~st.st_mode & S_IFCHR) {
|
if (~st.st_mode & S_IFCHR) {
|
||||||
LOG_ERROR(dev, "FD is not char");
|
LOG_VERBOSE(dev, "FD is not char");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ int v4l2_device_open_media_device(device_t *dev)
|
|||||||
struct dirent **namelist;
|
struct dirent **namelist;
|
||||||
int n = scandir(path, &namelist, NULL, NULL);
|
int n = scandir(path, &namelist, NULL, NULL);
|
||||||
if (n < 0) {
|
if (n < 0) {
|
||||||
LOG_ERROR(dev, "Cannot scan: %s", path);
|
LOG_VERBOSE(dev, "Cannot scan: %s", path);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,7 +59,8 @@ int v4l2_device_open_v4l2_subdev(device_t *dev, int subdev)
|
|||||||
|
|
||||||
media_fd = v4l2_device_open_media_device(dev);
|
media_fd = v4l2_device_open_media_device(dev);
|
||||||
if (media_fd < 0) {
|
if (media_fd < 0) {
|
||||||
LOG_ERROR(dev, "Cannot find media controller");
|
LOG_VERBOSE(dev, "Cannot find media controller");
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
@ -82,26 +83,29 @@ int v4l2_device_open_v4l2_subdev(device_t *dev, int subdev)
|
|||||||
|
|
||||||
char link[256];
|
char link[256];
|
||||||
if ((rc = readlink(path, link, sizeof(link)-1)) < 0) {
|
if ((rc = readlink(path, link, sizeof(link)-1)) < 0) {
|
||||||
LOG_ERROR(dev, "Cannot readlink '%s'", path);
|
LOG_VERBOSE(dev, "Cannot readlink '%s'", path);
|
||||||
}
|
}
|
||||||
link[rc] = 0;
|
link[rc] = 0;
|
||||||
|
|
||||||
char *last = strrchr(link, '/');
|
char *last = strrchr(link, '/');
|
||||||
if (!last) {
|
if (!last) {
|
||||||
LOG_ERROR(dev, "Link '%s' for '%s' does not end with '/'", link, path);
|
LOG_VERBOSE(dev, "Link '%s' for '%s' does not end with '/'", link, path);
|
||||||
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strstr(last, "/v4l-subdev") != last) {
|
if (strstr(last, "/v4l-subdev") != last) {
|
||||||
LOG_ERROR(dev, "Link '%s' does not contain '/v4l-subdev'", link, path);
|
LOG_VERBOSE(dev, "Link '%s' does not contain '/v4l-subdev'", link, path);
|
||||||
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(path, "/dev%s", last);
|
sprintf(path, "/dev%s", last);
|
||||||
ret = open(path, O_RDWR);
|
ret = open(path, O_RDWR);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
LOG_ERROR(dev, "Cannot open '%s' (ret=%d)", path, ret);
|
LOG_ERROR(dev, "Cannot open '%s' (ret=%d)", path, ret);
|
||||||
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_INFO(dev, "Opened '%s' (fd=%d)", path, ret);
|
LOG_VERBOSE(dev, "Opened '%s' (fd=%d)", path, ret);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user