Skip to contentSkip to conversation

v4l2-dbg: report fail reason to the user

hg:v4l-dvb Németh Márton 1 participant 1 message Nov 25, 2009 1 message not in the archive Media (V4L/DVB)

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Hello Mauro,

Quoted 75 lines · Patch from Mauro Carvalho Chehab

The patch number 13472 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:
Linux Media Mailing List <[email protected]>

------

From: Mauro Carvalho Chehab <[email protected]>
v4l2-dbg: report fail reason to the user

Report the fail reason to the user when writing a register even if the verbose mode is switched off.

Remove duplicated code ioctl() call which may cause different ioctl() function call in case of verbose and non verbose if not handled carefully.

Priority: normal

[[email protected]: minor additional cleanup in doioctl()]
[[email protected]: As I've already applied the original version, apply the diff version now]

---

 v4l2-apps/util/v4l2-dbg.cpp |   17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff -r c1b0ff440683 -r 98a8e3a2b8b3 v4l2-apps/util/v4l2-dbg.cpp

v4l2-apps/util/v4l2-dbg.cpp +8 -10
@@ -354,14 +354,13 @@
 {
 	int retVal;
 
+	if (!options[OptVerbose]) return ioctl(fd, request, parm);
 	retVal = ioctl(fd, request, parm);
-	if (options[OptVerbose]) {
-		printf("%s: ", name);
-		if (retVal < 0)
-			printf("failed: %s\n", strerror(errno));
-		else
-			printf("ok\n");
-	}
+	printf("%s: ", name);
+	if (retVal < 0)
+		printf("failed: %s\n", strerror(errno));
+	else
+		printf("ok\n");
 
 	return retVal;
 }
@@ -587,8 +586,8 @@
 
 				printf(" set to 0x%llx\n", set_reg.val);
 			} else {
-				printf("Failed to set register 0x%08llx value 0x%llx: %s\n",
-					set_reg.reg, set_reg.val, strerror(errno));
+				printf("Failed to set register 0x%08llx value 0x%llx\n",
+					set_reg.reg, set_reg.val);
 			}
 			set_reg.reg++;
 		}
 
 
---
Quoted 3 lines

Patch is available at: http://linuxtv.org/hg/v4l-dvb/rev/98a8e3a2b8b39732055f03533acf9aa8d0c896c2

Do you really want this patch? It does the opposite what the comment says: when the verbose mode is switched off, strerror(errno) is not printed at all. Actually this reverts changeset 13405:65a25dd73390 as far as I can see:

http://linuxtv.org/hg/v4l-dvb/log/98a8e3a2b8b3/v4l2-apps/util/v4l2-dbg.cpp

Regards,

Márton Németh