linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4l-utils] Print receiver timeout
@ 2019-01-29 16:34 Sean Young
  0 siblings, 0 replies; only message in thread
From: Sean Young @ 2019-01-29 16:34 UTC (permalink / raw)
  To: linux-media

Signed-off-by: Sean Young <sean@mess.org>
---
 utils/ir-ctl/ir-ctl.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/utils/ir-ctl/ir-ctl.c b/utils/ir-ctl/ir-ctl.c
index 7ecb1317..f8f4e0aa 100644
--- a/utils/ir-ctl/ir-ctl.c
+++ b/utils/ir-ctl/ir-ctl.c
@@ -708,8 +708,13 @@ static void lirc_features(struct arguments *args, int fd, unsigned features)
 		if (features & LIRC_CAN_MEASURE_CARRIER)
 			printf(_(" - Can measure carrier\n"));
 		if (features & LIRC_CAN_SET_REC_TIMEOUT) {
-			unsigned min_timeout, max_timeout;
-			int rc = ioctl(fd, LIRC_GET_MIN_TIMEOUT, &min_timeout);
+			unsigned min_timeout, max_timeout, timeout;
+
+			// This ioctl is only supported from kernel 4.18 onwards
+			int rc = ioctl(fd, LIRC_GET_REC_TIMEOUT, &timeout);
+			if (rc == 0)
+				printf(_(" - Receiving timeout %u microseconds\n"), timeout);
+			rc = ioctl(fd, LIRC_GET_MIN_TIMEOUT, &min_timeout);
 			if (rc) {
 				fprintf(stderr, _("warning: %s: device supports setting receiving timeout but LIRC_GET_MIN_TIMEOUT returns: %m\n"), dev);
 				min_timeout = 0;
@@ -724,7 +729,7 @@ static void lirc_features(struct arguments *args, int fd, unsigned features)
 			}
 
 			if (min_timeout || max_timeout)
-				printf(_(" - Can set receiving timeout min:%u microseconds max:%u microseconds\n"), min_timeout, max_timeout);
+				printf(_(" - Can set receiving timeout min %u microseconds, max %u microseconds\n"), min_timeout, max_timeout);
 		}
 	} else if (features & LIRC_CAN_REC_LIRCCODE) {
 		printf(_(" - Device can receive using device dependent LIRCCODE mode (not supported)\n"));
-- 
2.20.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-01-29 16:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-29 16:34 [PATCH v4l-utils] Print receiver timeout Sean Young

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).