From patchwork Wed Jul 20 14:08:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Young X-Patchwork-Id: 9239659 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5A7BF602F0 for ; Wed, 20 Jul 2016 14:08:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4C5FE27C05 for ; Wed, 20 Jul 2016 14:08:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4111C27C26; Wed, 20 Jul 2016 14:08:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C8F7627C05 for ; Wed, 20 Jul 2016 14:08:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754017AbcGTOIa (ORCPT ); Wed, 20 Jul 2016 10:08:30 -0400 Received: from gofer.mess.org ([80.229.237.210]:53529 "EHLO gofer.mess.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753212AbcGTOI3 (ORCPT ); Wed, 20 Jul 2016 10:08:29 -0400 Received: by gofer.mess.org (Postfix, from userid 1000) id A437B60400; Wed, 20 Jul 2016 15:08:27 +0100 (BST) From: Sean Young To: Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org Subject: [PATCH] ir-ctl: give proper error message if transmitter does not exist Date: Wed, 20 Jul 2016 15:08:27 +0100 Message-Id: <1469023707-3248-1-git-send-email-sean@mess.org> X-Mailer: git-send-email 2.1.4 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If a transmitter does not exist when setting using -e, you get the error: warning: /dev/lirc0: failed to set send transmitters: Success Signed-off-by: Sean Young --- utils/ir-ctl/ir-ctl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/utils/ir-ctl/ir-ctl.c b/utils/ir-ctl/ir-ctl.c index 05b46a3..229330e 100644 --- a/utils/ir-ctl/ir-ctl.c +++ b/utils/ir-ctl/ir-ctl.c @@ -516,7 +516,9 @@ static int lirc_options(struct arguments *args, int fd, unsigned features) if (args->emitters) { if (features & LIRC_CAN_SET_TRANSMITTER_MASK) { rc = ioctl(fd, LIRC_SET_TRANSMITTER_MASK, &args->emitters); - if (rc) + if (rc > 0) + fprintf(stderr, _("warning: %s: failed to set send transmitters: only %d available\n"), dev, rc); + else if (rc < 0) fprintf(stderr, _("warning: %s: failed to set send transmitters: %m\n"), dev); } else fprintf(stderr, _("warning: %s: does not support setting send transmitters\n"), dev);