From e650c77431a114bb3bc3b337f0bc11355e68ca03 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 7 Feb 2008 08:02:58 -0200 Subject: Make it work also with usb drivers From: Mauro Carvalho Chehab USB drivers, like em28xx and tm6000, have 8 or 16 bit registers, instead of 32, at host. This patch adds an option to set step 1 when listing registers on those devices. Signed-off-by: Mauro Carvalho Chehab --- v4l2-apps/util/v4l2-dbg.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'v4l2-apps/util/v4l2-dbg.cpp') diff --git a/v4l2-apps/util/v4l2-dbg.cpp b/v4l2-apps/util/v4l2-dbg.cpp index ce6a9ac78..e55cbb2a8 100644 --- a/v4l2-apps/util/v4l2-dbg.cpp +++ b/v4l2-apps/util/v4l2-dbg.cpp @@ -71,6 +71,7 @@ enum Option { OptGetDriverInfo = 'D', OptScanChipIdents = 'C', OptGetChipIdent = 'c', + OptSetStride = 'w', OptHelp = 'h', OptLogStatus = 128, @@ -94,6 +95,7 @@ static struct option long_options[] = { {"verbose", no_argument, 0, OptVerbose}, {"log-status", no_argument, 0, OptLogStatus}, {"list-driverids", no_argument, 0, OptListDriverIDs}, + {"wide", required_argument, 0, OptSetStride}, {0, 0, 0, 0} }; @@ -113,6 +115,8 @@ static void usage(void) printf(" Scan the available host and i2c chips [VIDIOC_G_CHIP_IDENT]\n"); printf(" -c, --get-chip-ident=type=,chip=\n"); printf(" Get the chip identifier [VIDIOC_G_CHIP_IDENT]\n"); + printf(" -w, --wide=\n"); + printf(" Sets step between two registers\n"); printf(" --log-status log the board status in the kernel log [VIDIOC_LOG_STATUS]\n"); printf(" --list-driverids list the known I2C driver IDs for use with the i2cdrv type\n"); printf("\n"); @@ -262,7 +266,7 @@ static int parse_subopt(char **subs, char * const *subopts, char **value) int main(int argc, char **argv) { char *value, *subs; - int i; + int i, forcedstride = 0; int fd = -1; @@ -341,6 +345,8 @@ int main(int argc, char **argv) break; } } + case OptSetStride: + forcedstride = strtoull(optarg, 0L, 0); break; case OptListRegisters: subs = optarg; @@ -470,8 +476,12 @@ int main(int argc, char **argv) if (options[OptListRegisters]) { int stride = 1; - - if (get_reg.match_type == V4L2_CHIP_MATCH_HOST) stride = 4; + if (forcedstride) { + stride = forcedstride; + } else { + if (get_reg.match_type == V4L2_CHIP_MATCH_HOST) + stride = 4; + } printf("ioctl: VIDIOC_DBG_G_REGISTER\n"); if (reg_max != 0) { -- cgit v1.2.3