From 07f0d83095c5ca26de9031946ebeec05f24a18e7 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Tue, 11 Oct 2011 11:42:49 +0200 Subject: Print media device information when called with -p/--print In addition to printing pipeline information, print the media device information. Signed-off-by: Laurent Pinchart --- src/main.c | 21 +++++++++++++++++++++ src/mediactl.c | 9 +++++++++ src/mediactl.h | 1 + 3 files changed, 31 insertions(+) (limited to 'src') diff --git a/src/main.c b/src/main.c index c04e12f..d8bd150 100644 --- a/src/main.c +++ b/src/main.c @@ -301,6 +301,27 @@ int main(int argc, char **argv) goto out; } + if (media_opts.print) { + printf("Media controller API version %u.%u.%u\n\n", + (media->info.media_version << 16) & 0xff, + (media->info.media_version << 8) & 0xff, + (media->info.media_version << 0) & 0xff); + printf("Media device information\n" + "------------------------\n" + "driver %s\n" + "model %s\n" + "serial %s\n" + "bus info %s\n" + "hw revision 0x%x\n" + "driver version %u.%u.%u\n\n", + media->info.driver, media->info.model, + media->info.serial, media->info.bus_info, + media->info.hw_revision, + (media->info.driver_version << 16) & 0xff, + (media->info.driver_version << 8) & 0xff, + (media->info.driver_version << 0) & 0xff); + } + if (media_opts.entity) { struct media_entity *entity; diff --git a/src/mediactl.c b/src/mediactl.c index c5da471..5b8c587 100644 --- a/src/mediactl.c +++ b/src/mediactl.c @@ -452,6 +452,15 @@ struct media_device *media_open_debug( return NULL; } + ret = ioctl(media->fd, MEDIA_IOC_DEVICE_INFO, &media->info); + if (ret < 0) { + media_dbg(media, "%s: Unable to retrieve media device " + "information for device %s (%s)\n", __func__, + name, strerror(errno)); + media_close(media); + return NULL; + } + media_dbg(media, "Enumerating entities\n"); ret = media_enum_entities(media); diff --git a/src/mediactl.h b/src/mediactl.h index d4dfc65..1b47b7e 100644 --- a/src/mediactl.h +++ b/src/mediactl.h @@ -54,6 +54,7 @@ struct media_entity { struct media_device { int fd; + struct media_device_info info; struct media_entity *entities; unsigned int entities_count; void (*debug_handler)(void *, ...); -- cgit v1.2.3