summaryrefslogtreecommitdiff
path: root/v4l2-apps
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2008-12-30 11:14:19 +0100
committerHans Verkuil <hverkuil@xs4all.nl>2008-12-30 11:14:19 +0100
commit1b466c7ec5d6b66905c47c49fd3cbc59569e7b4e (patch)
tree38f6fbe937eb1d5c22f018e7730f1b1a3cbb9a78 /v4l2-apps
parent033f7befdeeb65b662a90b0685f24ea62dfcbbd5 (diff)
downloadmediapointer-dvb-s2-1b466c7ec5d6b66905c47c49fd3cbc59569e7b4e.tar.gz
mediapointer-dvb-s2-1b466c7ec5d6b66905c47c49fd3cbc59569e7b4e.tar.bz2
v4l2: debugging API changed to match against driver name instead of ID.
From: Hans Verkuil <hverkuil@xs4all.nl> Since the i2c driver ID will be removed in the near future we have to modify the v4l2 debugging API to use the driver name instead of driver ID. Note that this API is not used in applications other than v4l2-dbg.cpp as it is for debugging and testing only. Should anyone use the old VIDIOC_G_CHIP_IDENT, then this will be logged with a warning that it is deprecated and will be removed in 2.6.30. Priority: normal Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Diffstat (limited to 'v4l2-apps')
-rw-r--r--v4l2-apps/test/ioctl-test.c8
-rw-r--r--v4l2-apps/util/Makefile11
-rw-r--r--v4l2-apps/util/cx18-ctl.c12
-rw-r--r--v4l2-apps/util/ivtv-ctl.c12
-rw-r--r--v4l2-apps/util/v4l2-compliance.cpp36
-rw-r--r--v4l2-apps/util/v4l2-dbg.cpp177
6 files changed, 107 insertions, 149 deletions
diff --git a/v4l2-apps/test/ioctl-test.c b/v4l2-apps/test/ioctl-test.c
index 37a0e2374..f9ac1cad5 100644
--- a/v4l2-apps/test/ioctl-test.c
+++ b/v4l2-apps/test/ioctl-test.c
@@ -88,8 +88,9 @@ union v4l_parms {
struct v4l2_frmivalenum p_v4l2_frmivalenum;
struct v4l2_enc_idx p_v4l2_enc_idx;
struct v4l2_encoder_cmd p_v4l2_encoder_cmd;
- struct v4l2_register p_v4l2_register;
- struct v4l2_chip_ident p_v4l2_chip_ident;
+ struct v4l2_dbg_register p_v4l2_dbg_register;
+ struct v4l2_dbg_chip_ident p_v4l2_dbg_chip_ident;
+ struct v4l2_chip_ident_old p_v4l2_chip_ident_old;
struct v4l2_hw_freq_seek p_v4l2_hw_freq_seek;
};
@@ -195,7 +196,8 @@ static const struct {
ioc(VIDIOC_TRY_ENCODER_CMD), /* struct v4l2_encoder_cmd */
ioc(VIDIOC_DBG_S_REGISTER), /* struct v4l2_register */
ioc(VIDIOC_DBG_G_REGISTER), /* struct v4l2_register */
- ioc(VIDIOC_G_CHIP_IDENT), /* struct v4l2_chip_ident */
+ ioc(VIDIOC_DBG_G_CHIP_IDENT), /* struct v4l2_dbg_chip_ident */
+ ioc(VIDIOC_G_CHIP_IDENT_OLD), /* struct v4l2_chip_ident_old */
ioc(VIDIOC_S_HW_FREQ_SEEK), /* struct v4l2_hw_freq_seek */
#ifdef __OLD_VIDIOC_
ioc(VIDIOC_OVERLAY_OLD), /* int */
diff --git a/v4l2-apps/util/Makefile b/v4l2-apps/util/Makefile
index 0a28e7da9..b80de190b 100644
--- a/v4l2-apps/util/Makefile
+++ b/v4l2-apps/util/Makefile
@@ -18,18 +18,18 @@ endif
all: $(binaries) qv4l2 keytable
clean::
- rm -f $(binaries) v4l2-driverids.cpp v4l2-chipids.cpp
+ rm -f $(binaries) v4l2-chipids.cpp
-if [ -f qv4l2/Makefile ]; then make -C qv4l2 $@; fi
-rm -f qv4l2/qv4l2 qv4l2/Makefile
make -C xc3028-firmware $@
- rm -f v4l2-driverids.cpp v4l2-chipids.cpp
+ rm -f v4l2-chipids.cpp
rm -rf keycodes parse.h keytable
qv4l2:
-if [ ! -f qv4l2/Makefile ]; then (cd qv4l2; qmake); fi
$(MAKE) -C qv4l2
-v4l2-dbg: v4l2-dbg.o v4l2-driverids.o v4l2-chipids.o
+v4l2-dbg: v4l2-dbg.o v4l2-chipids.o
$(CXX) $^ -o $@
v4l2-dbg.o: v4l2-dbg.h v4l2-dbg-bttv.h v4l2-dbg-em28xx.h v4l2-dbg-saa7134.h
@@ -59,11 +59,6 @@ keytables:
keytable: keytable.c parse.h keytables
-v4l2-driverids.cpp: ../include/linux/i2c-id.h
- @echo "struct driverid { const char *name; unsigned id; } driverids[] = {" >$@
- @grep I2C_DRIVERID_ $^ | sed -e 's/.*I2C_DRIVERID_\([0-9A-Z_]*\)[^0-9]*\([0-9]*\).*/{ "\1", \2 },/' | tr A-Z a-z >>$@
- @echo "{ 0, 0 }};" >>$@
-
v4l2-chipids.cpp: ../include/media/v4l2-chip-ident.h
@echo "struct chipid { const char *name; unsigned id; } chipids[] = {" >$@
@grep V4L2_IDENT_ $^ | sed -e 's/.*V4L2_IDENT_\([0-9A-Z_]*\)[^=]*=[^0-9]*\([0-9]*\).*/{ "\1", \2 },/' | tr A-Z a-z >>$@
diff --git a/v4l2-apps/util/cx18-ctl.c b/v4l2-apps/util/cx18-ctl.c
index 4081f3aef..3d8ff385d 100644
--- a/v4l2-apps/util/cx18-ctl.c
+++ b/v4l2-apps/util/cx18-ctl.c
@@ -419,10 +419,10 @@ int main(int argc, char **argv)
doioctl(fd, VIDIOC_INT_S_AUDIO_ROUTING, &route, "VIDIOC_INT_S_AUDIO_ROUTING");
if (options[OptSetGPIO]) {
- struct v4l2_register reg;
+ struct v4l2_dbg_register reg;
- reg.match_type = V4L2_CHIP_MATCH_HOST;
- reg.match_chip = 0;
+ reg.match.type = V4L2_CHIP_MATCH_HOST;
+ reg.match.addr = 0;
reg.reg = CX18_REG_GPIO_DIR1;
reg.val = (unsigned)((gpio_dir & 0xffff) << 16);
if (gpio_set_dir && doioctl(fd, VIDIOC_DBG_S_REGISTER, &reg,
@@ -446,10 +446,10 @@ int main(int argc, char **argv)
}
if (options[OptListGPIO]) {
- struct v4l2_register reg;
+ struct v4l2_dbg_register reg;
- reg.match_type = V4L2_CHIP_MATCH_HOST;
- reg.match_chip = 0;
+ reg.match.type = V4L2_CHIP_MATCH_HOST;
+ reg.match.addr = 0;
reg.reg = CX18_REG_GPIO_IN;
if (ioctl(fd, VIDIOC_DBG_G_REGISTER, &reg) == 0)
printf("GPIO in: 0x%04llx\n", reg.val);
diff --git a/v4l2-apps/util/ivtv-ctl.c b/v4l2-apps/util/ivtv-ctl.c
index af84164e3..a05dcbba2 100644
--- a/v4l2-apps/util/ivtv-ctl.c
+++ b/v4l2-apps/util/ivtv-ctl.c
@@ -564,10 +564,10 @@ int main(int argc, char **argv)
}
if (options[OptSetGPIO]) {
- struct v4l2_register reg;
+ struct v4l2_dbg_register reg;
- reg.match_type = V4L2_CHIP_MATCH_HOST;
- reg.match_chip = 0;
+ reg.match.type = V4L2_CHIP_MATCH_HOST;
+ reg.match.addr = 0;
reg.reg = IVTV_REG_GPIO_DIR_OFFSET;
reg.val = gpio_dir;
if (gpio_set_dir && doioctl(fd, VIDIOC_DBG_S_REGISTER, &reg,
@@ -581,10 +581,10 @@ int main(int argc, char **argv)
}
if (options[OptListGPIO]) {
- struct v4l2_register reg;
+ struct v4l2_dbg_register reg;
- reg.match_type = V4L2_CHIP_MATCH_HOST;
- reg.match_chip = 0;
+ reg.match.type = V4L2_CHIP_MATCH_HOST;
+ reg.match.addr = 0;
reg.reg = IVTV_REG_GPIO_IN_OFFSET;
if (ioctl(fd, VIDIOC_DBG_G_REGISTER, &reg) == 0)
printf("GPIO in: 0x%04llx\n", reg.val);
diff --git a/v4l2-apps/util/v4l2-compliance.cpp b/v4l2-apps/util/v4l2-compliance.cpp
index 2fe5292fe..3780f982e 100644
--- a/v4l2-apps/util/v4l2-compliance.cpp
+++ b/v4l2-apps/util/v4l2-compliance.cpp
@@ -910,23 +910,25 @@ static int testCap(int fd)
static int testChipIdent(int fd)
{
- struct v4l2_chip_ident chip;
+ struct v4l2_dbg_chip_ident chip;
int ret;
- chip.match_type = V4L2_CHIP_MATCH_HOST;
- chip.match_chip = 0;
- ret = doioctl(fd, VIDIOC_G_CHIP_IDENT, &chip, "VIDIOC_G_CHIP_IDENT");
+ memset(&chip, 0, sizeof(chip));
+ chip.match.type = V4L2_CHIP_MATCH_HOST;
+ chip.match.addr = 0;
+ ret = doioctl(fd, VIDIOC_DBG_G_CHIP_IDENT, &chip, "VIDIOC_DBG_G_CHIP_IDENT");
// Must return either 0 (OK) or EINVAL (not supported)
if (ret == 0) {
- struct v4l2_chip_ident orig;
+ struct v4l2_dbg_chip_ident orig;
+ memset(&orig, 0, sizeof(orig));
// set invalid match_type
- chip.match_type = V4L2_CHIP_MATCH_I2C_ADDR + 1;
- chip.match_chip = 0xdeadbeef;
+ chip.match.type = V4L2_CHIP_MATCH_I2C_ADDR + 1;
+ chip.match.addr = 0xdeadbeef;
chip.ident = 0xdeadbeef;
chip.revision = 0xdeadbeef;
orig = chip;
- ret = doioctl(fd, VIDIOC_G_CHIP_IDENT, &chip, "VIDIOC_G_CHIP_IDENT");
+ ret = doioctl(fd, VIDIOC_DBG_G_CHIP_IDENT, &chip, "VIDIOC_DBG_G_CHIP_IDENT");
if (ret != EINVAL) {
if (verbose)
printf("Invalid match_type accepted\n");
@@ -944,13 +946,13 @@ static int testChipIdent(int fd)
static int testRegister(int fd)
{
- struct v4l2_register reg;
- struct v4l2_chip_ident chip;
+ struct v4l2_dbg_register reg;
+ struct v4l2_dbg_chip_ident chip;
int ret;
int uid = getuid();
- reg.match_type = V4L2_CHIP_MATCH_HOST;
- reg.match_chip = 0;
+ reg.match.type = V4L2_CHIP_MATCH_HOST;
+ reg.match.addr = 0;
reg.reg = 0;
ret = doioctl(fd, VIDIOC_DBG_G_REGISTER, &reg, "VIDIOC_DBG_G_REGISTER");
if (ret == EINVAL)
@@ -963,10 +965,10 @@ static int testRegister(int fd)
printf("Not allowed to call VIDIOC_DBG_G_REGISTER even though we are root\n");
return -1;
}
- chip.match_type = V4L2_CHIP_MATCH_HOST;
- chip.match_chip = 0;
- if (doioctl(fd, VIDIOC_G_CHIP_IDENT, &chip, "VIDIOC_G_CHIP_IDENT")) {
- printf("Must support VIDIOC_G_CHIP_IDENT\n");
+ chip.match.type = V4L2_CHIP_MATCH_HOST;
+ chip.match.addr = 0;
+ if (doioctl(fd, VIDIOC_DBG_G_CHIP_IDENT, &chip, "VIDIOC_DBG_G_CHIP_IDENT")) {
+ printf("Must support VIDIOC_DBG_G_CHIP_IDENT\n");
return -1;
}
if (uid) {
@@ -1111,7 +1113,7 @@ int main(int argc, char **argv)
printf("Debug ioctls:\n");
if (test[TestChipIdent])
- printf("\ttest VIDIOC_G_CHIP_IDENT: %s\n", ok(testChipIdent(fd)));
+ printf("\ttest VIDIOC_DBG_G_CHIP_IDENT: %s\n", ok(testChipIdent(fd)));
if (test[TestRegister])
printf("\ttest VIDIOC_DBG_G/S_REGISTER: %s\n", ok(testRegister(fd)));
if (test[TestLogStatus])
diff --git a/v4l2-apps/util/v4l2-dbg.cpp b/v4l2-apps/util/v4l2-dbg.cpp
index 577c8585e..b38d18cf0 100644
--- a/v4l2-apps/util/v4l2-dbg.cpp
+++ b/v4l2-apps/util/v4l2-dbg.cpp
@@ -103,13 +103,6 @@ static const struct board_list boards[] = {
},
};
-struct driverid {
- const char *name;
- unsigned id;
-};
-
-extern struct driverid driverids[];
-
struct chipid {
const char *name;
unsigned id;
@@ -138,7 +131,6 @@ enum Option {
OptLogStatus = 128,
OptVerbose,
- OptListDriverIDs,
OptListSymbols,
OptLast = 256
};
@@ -159,7 +151,6 @@ static struct option long_options[] = {
{"info", no_argument, 0, OptGetDriverInfo},
{"verbose", no_argument, 0, OptVerbose},
{"log-status", no_argument, 0, OptLogStatus},
- {"list-driverids", no_argument, 0, OptListDriverIDs},
{"list-symbols", no_argument, 0, OptListSymbols},
{"wide", required_argument, 0, OptSetStride},
{0, 0, 0, 0}
@@ -175,7 +166,7 @@ static void usage(void)
" --verbose Turn on verbose ioctl error reporting\n"
" -c, --chip=<chip> The chip identifier to use with other commands\n"
" It can be one of:\n"
- " I2C driver ID (see --list-driverids)\n"
+ " I2C driver name\n"
" I2C 7-bit address\n"
" AC97: for ac97 anciliary mixer\n"
" host<num>: host chip number <num>\n"
@@ -188,25 +179,16 @@ static void usage(void)
" Set the register with the commandline arguments\n"
" The register will autoincrement [VIDIOC_DBG_S_REGISTER]\n"
" -S, --scan-chip-idents\n"
- " Scan the available host and i2c chips [VIDIOC_G_CHIP_IDENT]\n"
+ " Scan the available host and i2c chips [VIDIOC_DBG_G_CHIP_IDENT]\n"
" -i, --get-chip-ident\n"
- " Get the chip identifier [VIDIOC_G_CHIP_IDENT]\n"
+ " Get the chip identifier [VIDIOC_DBG_G_CHIP_IDENT]\n"
" -w, --wide=<reg length>\n"
" Sets step between two registers\n"
" --list-symbols List the symbolic register names you can use, if any\n"
- " --log-status Log the board status in the kernel log [VIDIOC_LOG_STATUS]\n"
- " --list-driverids List the known I2C driver IDs for use with the i2cdrv type\n");
+ " --log-status Log the board status in the kernel log [VIDIOC_LOG_STATUS]\n");
exit(0);
}
-static unsigned parse_chip(const std::string &s)
-{
- for (int i = 0; driverids[i].name; i++)
- if (!strcasecmp(s.c_str(), driverids[i].name))
- return driverids[i].id;
- return 0;
-}
-
static std::string cap2s(unsigned cap)
{
std::string s;
@@ -244,7 +226,7 @@ static std::string cap2s(unsigned cap)
return s;
}
-static void print_regs(int fd, struct v4l2_register *reg, unsigned long min, unsigned long max, int stride)
+static void print_regs(int fd, struct v4l2_dbg_register *reg, unsigned long min, unsigned long max, int stride)
{
unsigned long mask = stride > 1 ? 0x1f : 0x0f;
unsigned long i;
@@ -278,7 +260,7 @@ static void print_regs(int fd, struct v4l2_register *reg, unsigned long min, uns
printf("\n");
}
-static void print_chip(struct v4l2_chip_ident *chip)
+static void print_chip(struct v4l2_dbg_chip_ident *chip)
{
const char *name = NULL;
@@ -403,9 +385,9 @@ int main(int argc, char **argv)
int ch;
const char *device = "/dev/video0"; /* -d device */
struct v4l2_capability vcap; /* list_cap */
- struct v4l2_register set_reg;
- struct v4l2_register get_reg;
- struct v4l2_chip_ident chip_id;
+ struct v4l2_dbg_register set_reg;
+ struct v4l2_dbg_register get_reg;
+ struct v4l2_dbg_chip_ident chip_id;
const struct board_list *curr_bd = NULL;
char short_options[26 * 2 * 2 + 1];
int idx = 0;
@@ -413,10 +395,11 @@ int main(int argc, char **argv)
std::string reg_set_arg;
unsigned long long reg_min = 0, reg_max = 0;
std::vector<std::string> get_regs;
- int match_type = V4L2_CHIP_MATCH_HOST;
- int match_chip = 0;
char driver[255];
+ struct v4l2_dbg_match match;
+ match.type = V4L2_CHIP_MATCH_HOST;
+ match.addr = 0;
memset(&set_reg, 0, sizeof(set_reg));
memset(&get_reg, 0, sizeof(get_reg));
memset(&chip_id, 0, sizeof(chip_id));
@@ -460,26 +443,23 @@ int main(int argc, char **argv)
case OptChip:
if (isdigit(optarg[0])) {
- match_type = V4L2_CHIP_MATCH_I2C_ADDR;
- match_chip = strtoul(optarg, NULL, 0);
+ match.type = V4L2_CHIP_MATCH_I2C_ADDR;
+ match.addr = strtoul(optarg, NULL, 0);
break;
}
if (!memcmp(optarg, "host", 4)) {
- match_type = V4L2_CHIP_MATCH_HOST;
- match_chip = strtoul(optarg + 4, NULL, 0);
+ match.type = V4L2_CHIP_MATCH_HOST;
+ match.addr = strtoul(optarg + 4, NULL, 0);
break;
}
if (!strcasecmp(optarg, "ac97")) {
- match_type = V4L2_CHIP_MATCH_AC97;
+ match.type = V4L2_CHIP_MATCH_AC97;
+ match.addr = 0;
break;
}
- match_type = V4L2_CHIP_MATCH_I2C_DRIVER;
- strcpy(driver, optarg);
- match_chip = parse_chip(optarg);
- if (!match_chip) {
- fprintf(stderr, "unknown driver ID %s\n", optarg);
- exit(-1);
- }
+ match.type = V4L2_CHIP_MATCH_I2C_DRIVER;
+ strncpy(match.name, optarg, sizeof(match.name));
+ match.name[sizeof(match.name) - 1] = '\0';
break;
case OptSetRegister:
@@ -558,16 +538,16 @@ int main(int argc, char **argv)
printf("%s", cap2s(vcap.capabilities).c_str());
}
- if (match_type == V4L2_CHIP_MATCH_AC97) {
+ if (match.type == V4L2_CHIP_MATCH_AC97) {
curr_bd = &boards[AC97_BOARD];
- } else if (match_type == V4L2_CHIP_MATCH_HOST) {
+ } else if (match.type == V4L2_CHIP_MATCH_HOST) {
for (int board = ARRAY_SIZE(boards) - 1; board >= 0; board--) {
if (!strcasecmp((char *)vcap.driver, boards[board].name)) {
curr_bd = &boards[board];
break;
}
}
- } else if (match_type == V4L2_CHIP_MATCH_I2C_DRIVER) {
+ } else if (match.type == V4L2_CHIP_MATCH_I2C_DRIVER) {
for (int board = ARRAY_SIZE(boards) - 1; board >= 0; board--) {
if (!strcasecmp(driver, boards[board].name)) {
curr_bd = &boards[board];
@@ -579,8 +559,7 @@ int main(int argc, char **argv)
/* Set options */
if (options[OptSetRegister]) {
- set_reg.match_type = match_type;
- set_reg.match_chip = match_chip;
+ set_reg.match = match;
if (optind >= argc)
usage();
set_reg.reg = parse_reg(curr_bd, reg_set_arg);
@@ -607,28 +586,27 @@ int main(int argc, char **argv)
}
if (options[OptGetChipIdent]) {
- chip_id.match_type = match_type;
- chip_id.match_chip = match_chip;
- if (doioctl(fd, VIDIOC_G_CHIP_IDENT, &chip_id, "VIDIOC_G_CHIP_IDENT") == 0)
+ chip_id.match = match;
+ if (doioctl(fd, VIDIOC_DBG_G_CHIP_IDENT, &chip_id, "VIDIOC_DBG_G_CHIP_IDENT") == 0)
print_chip(&chip_id);
}
if (options[OptScanChipIdents]) {
int i;
- chip_id.match_type = V4L2_CHIP_MATCH_HOST;
- chip_id.match_chip = 0;
+ chip_id.match.type = V4L2_CHIP_MATCH_HOST;
+ chip_id.match.addr = 0;
- while (doioctl(fd, VIDIOC_G_CHIP_IDENT, &chip_id, "VIDIOC_G_CHIP_IDENT") == 0 && chip_id.ident) {
- printf("host%d: ", chip_id.match_chip);
+ while (doioctl(fd, VIDIOC_DBG_G_CHIP_IDENT, &chip_id, "VIDIOC_DBG_G_CHIP_IDENT") == 0 && chip_id.ident) {
+ printf("host%d: ", chip_id.match.addr);
print_chip(&chip_id);
- chip_id.match_chip++;
+ chip_id.match.addr++;
}
- chip_id.match_type = V4L2_CHIP_MATCH_I2C_ADDR;
+ chip_id.match.type = V4L2_CHIP_MATCH_I2C_ADDR;
for (i = 0; i < 128; i++) {
- chip_id.match_chip = i;
- if (doioctl(fd, VIDIOC_G_CHIP_IDENT, &chip_id, "VIDIOC_G_CHIP_IDENT") == 0 && chip_id.ident) {
+ chip_id.match.addr = i;
+ if (doioctl(fd, VIDIOC_DBG_G_CHIP_IDENT, &chip_id, "VIDIOC_DBG_G_CHIP_IDENT") == 0 && chip_id.ident) {
printf("i2c 0x%02x: ", i);
print_chip(&chip_id);
}
@@ -638,8 +616,7 @@ int main(int argc, char **argv)
if (options[OptGetRegister]) {
int stride = 1;
- get_reg.match_type = match_type;
- get_reg.match_chip = match_chip;
+ get_reg.match = match;
printf("ioctl: VIDIOC_DBG_G_REGISTER\n");
for (std::vector<std::string>::iterator iter = get_regs.begin();
@@ -665,16 +642,14 @@ int main(int argc, char **argv)
}
if (options[OptListRegisters]) {
+ std::string name;
int stride = 1;
- get_reg.match_type = match_type;
- get_reg.match_chip = match_chip;
-
+ get_reg.match = match;
if (forcedstride) {
stride = forcedstride;
- } else {
- if (get_reg.match_type == V4L2_CHIP_MATCH_HOST)
- stride = 4;
+ } else if (get_reg.match.type == V4L2_CHIP_MATCH_HOST) {
+ stride = 4;
}
printf("ioctl: VIDIOC_DBG_G_REGISTER\n");
@@ -726,57 +701,47 @@ int main(int argc, char **argv)
goto list_done;
}
- /* try to match the i2c chip */
- switch (get_reg.match_chip) {
- case I2C_DRIVERID_SAA711X:
- print_regs(fd, &get_reg, 0, 0xff, stride);
+ /* try to figure out which chip it is */
+ chip_id.match = match;
+ if (doioctl(fd, VIDIOC_DBG_G_CHIP_IDENT, &chip_id, "VIDIOC_DBG_G_CHIP_IDENT") != 0) {
+ chip_id.ident = V4L2_IDENT_NONE;
+ }
+ switch (chip_id.ident) {
+ case V4L2_IDENT_CX23415:
+ case V4L2_IDENT_CX23416:
+ name = "cx23416";
+ break;
+ case V4L2_IDENT_CX23418:
+ name = "cx23418";
break;
- case I2C_DRIVERID_SAA717X:
+ default:
+ if (get_reg.match.type == V4L2_CHIP_MATCH_I2C_DRIVER)
+ name = get_reg.match.name;
+ break;
+ }
+
+ if (name == "saa7115") {
+ print_regs(fd, &get_reg, 0, 0xff, stride);
+ } else if (name == "saa717x") {
// FIXME: use correct reg regions
print_regs(fd, &get_reg, 0, 0xff, stride);
- break;
- case I2C_DRIVERID_SAA7127:
+ } else if (name == "saa7127") {
print_regs(fd, &get_reg, 0, 0x7f, stride);
- break;
- case I2C_DRIVERID_CX25840:
+ } else if (name == "cx25840") {
print_regs(fd, &get_reg, 0, 2, stride);
print_regs(fd, &get_reg, 0x100, 0x15f, stride);
print_regs(fd, &get_reg, 0x200, 0x23f, stride);
print_regs(fd, &get_reg, 0x400, 0x4bf, stride);
print_regs(fd, &get_reg, 0x800, 0x9af, stride);
- break;
- case I2C_DRIVERID_CS5345:
+ } else if (name == "cs5345") {
print_regs(fd, &get_reg, 1, 0x10, stride);
- break;
- case 0:
- /* host chip, handle later */
- break;
- default:
- /* unknown i2c chip, dump 0-0xff by default */
- print_regs(fd, &get_reg, 0, 0xff, stride);
- break;
- }
- if (get_reg.match_chip != 0) {
- /* found i2c chip, we're done */
- goto list_done;
- }
- /* try to figure out which host chip it is */
- if (doioctl(fd, VIDIOC_G_CHIP_IDENT, &chip_id, "VIDIOC_G_CHIP_IDENT") != 0) {
- chip_id.ident = V4L2_IDENT_NONE;
- }
-
- switch (chip_id.ident) {
- case V4L2_IDENT_CX23415:
- case V4L2_IDENT_CX23416:
+ } else if (name == "cx23416") {
print_regs(fd, &get_reg, 0x02000000, 0x020000ff, stride);
- break;
- case V4L2_IDENT_CX23418:
+ } else if (name == "cx23418") {
print_regs(fd, &get_reg, 0x02c40000, 0x02c409c7, stride);
- break;
- default:
- /* By default print range 0-0xff */
+ } else {
+ /* unknown chip, dump 0-0xff by default */
print_regs(fd, &get_reg, 0, 0xff, stride);
- break;
}
}
list_done:
@@ -808,12 +773,6 @@ list_done:
}
}
- if (options[OptListDriverIDs]) {
- printf("Known I2C driver IDs:\n");
- for (int i = 0; driverids[i].name; i++)
- printf("%s\n", driverids[i].name);
- }
-
if (options[OptListSymbols]) {
if (curr_bd == NULL) {
printf("No symbols found for driver %s\n", vcap.driver);