Skip to contentSkip to conversation

ir-ctl: report timeout when it cannot be modified

PATCH New Sean Young 1 participant 1 message Oct 3, 2019 Media (V4L/DVB)

lore
Share & tools
lore

Sean Young

author
#0 lore raw

PATCH 1/1 ir-ctl: report timeout when it cannot be modified

There are many IR devices which cannot modify their timeout, but do have a timeout which should be reported (e.g. mtk_cir).

---
 utils/ir-ctl/ir-ctl.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
utils/ir-ctl/ir-ctl.c +8 -5
index 8aead6e0..ef399808 100644
@@ -966,13 +966,16 @@ static void lirc_features(struct arguments *args, int fd, unsigned features)
 			printf(_(" - Use wideband receiver\n"));
 		if (features & LIRC_CAN_MEASURE_CARRIER)
 			printf(_(" - Can measure carrier\n"));
+
+		// This ioctl is only supported from kernel 4.18 onwards
+		unsigned timeout;
+		int rc = ioctl(fd, LIRC_GET_REC_TIMEOUT, &timeout);
+		if (rc == 0)
+			printf(_(" - Receiving timeout %u microseconds\n"), timeout);
+
 		if (features & LIRC_CAN_SET_REC_TIMEOUT) {
-			unsigned min_timeout, max_timeout, timeout;
+			unsigned min_timeout, max_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);
Signature · 1 line
2.21.0