The patch number 9949 was added via Mauro Carvalho Chehab <[email protected]>
to http://linuxtv.org/hg/v4l-dvb master development tree.

Kernel patches in this development tree may be modified to be backward
compatible with older kernels. Compatibility modifications will be
removed before inclusion into the mainstream Kernel

If anyone has any objections, please let us know by sending a message to:
        [email protected]

------

From: Mauro Carvalho Chehab  <[email protected]>
v4l2-dbg: print register name when known


Priority: normal

Signed-off-by: Mauro Carvalho Chehab <[email protected]>


---

 v4l2-apps/util/v4l2-dbg.cpp |   29 +++++++++++++++++++++++++++--
 1 file changed, 27 insertions(+), 2 deletions(-)

diff -r 5df4f03253db -r 8383791267d3 v4l2-apps/util/v4l2-dbg.cpp
--- a/v4l2-apps/util/v4l2-dbg.cpp       Mon Dec 22 09:36:29 2008 -0200
+++ b/v4l2-apps/util/v4l2-dbg.cpp       Mon Dec 22 09:53:53 2008 -0200
@@ -293,6 +293,21 @@ static unsigned long long parse_reg(cons
        return strtoull(reg.c_str(), NULL, 0);
 }
 
+static const char *reg_name(const struct board_list *curr_bd, unsigned long 
long reg)
+{
+       if (curr_bd) {
+               for (int i = 0; i < curr_bd->regs_size; i++) {
+                       if (reg == curr_bd->regs[i].reg)
+                               return curr_bd->regs[i].name;
+               }
+               for (int i = 0; i < curr_bd->alt_regs_size; i++) {
+                       if (reg == curr_bd->regs[i].reg)
+                               return curr_bd->regs[i].name;
+               }
+       }
+       return NULL;
+}
+
 static const char *binary(unsigned long long val)
 {
        static char bin[80];
@@ -582,9 +597,19 @@ int main(int argc, char **argv)
                        if (ioctl(fd, VIDIOC_DBG_G_REGISTER, &get_reg) < 0)
                                fprintf(stderr, "ioctl: VIDIOC_DBG_G_REGISTER "
                                                "failed for 0x%llx\n", 
get_reg.reg);
-                       else
-                               printf("%llx = %llxh = %lldd = %sb\n", 
get_reg.reg,
+                       else {
+                               const char *name = reg_name(curr_bd, 
get_reg.reg);
+
+                               printf("Register ");
+
+                               if (name)
+                                       printf("%s", name);
+                               else
+                                       printf("0x%08llx", get_reg.reg);
+
+                               printf(" = %llxh (%lldd  %sb)\n",
                                        get_reg.val, get_reg.val, 
binary(get_reg.val));
+                       }
                }
        }
 


---

Patch is available at: 
http://linuxtv.org/hg/v4l-dvb/rev/8383791267d31f6eaf567448a1c9e828c4e0f375

_______________________________________________
linuxtv-commits mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to