Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2783751pxb; Sat, 6 Feb 2021 07:37:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJyyVL0QemGBxQN8oMDmcSXLXb7z+SfGyM2wo2nu43JFxbwM1Hbxmd0c6gQQH0pw1oAc4mRY X-Received: by 2002:a17:906:b50:: with SMTP id v16mr8858139ejg.298.1612625867399; Sat, 06 Feb 2021 07:37:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612625867; cv=none; d=google.com; s=arc-20160816; b=mlw60+RKdzvsr2xqYugOWnm7dA19A0TvGayXqForzfKcnB+Xu4IYFkCpxQMELSSCWc YNgE37V+ULfnTNLMCqy4sEkpX3XtworfeLzJ1QlC8XZDdSf0OhG7bOFVWsxkc3x0JKKj SxyYExlo7Wn4AIhDv9u4gq7p3vwH1QtBLBtPb/QmnyqMxEOl3TqgnbJ1lksIbyAoFdtQ xDK7C42OH9fTNJYEBP4cLZmp5YvlYYXRnHdrEYluJhbnBKTVjqEmtTDXtdrvm0NPCr6o iPKB/OnP7Vf5/UdW/0ntP2y0YLeqIAu1en2ER8YEfAXaehkY3VNvSmR7ACUE1uOiOr3G 7Xmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=C97B33R7YF5yQv+4zphlbiERuJ6+LvMcv6zagr75d5Q=; b=C3S8oMuoGXfsbI5NsTlmoKzFi0/vgCzUigp3YOsZ+mVsHb/M9KTbXKtDKIeTtJd8l5 Q3EcQHDkorV8QoNtErSGZF7+Pr1K6cjM8rznHEl1QjdvVCqzoTL6mELE9HXs8RA4jxtY KWopWyfKU8Qns5M844leP/NssecdC61+ITFBU2X1RIHxfvicke9BLsxKN2JG8n4hH79B KEAVkN9io3eRuxdS6Y29K6l1eKfWoRsPkz3Wqsnwm2rS2tXY+ET4327oueBoWn1/O0ux NDV3i9gs8y3gcotVvMSR0GAa+oHE6wA3IbC/mtA1LI+3176zlucQk/kt6MiuaAzHydiK neBQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ay8si6456193ejb.612.2021.02.06.07.37.24; Sat, 06 Feb 2021 07:37:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230244AbhBFPf7 (ORCPT + 99 others); Sat, 6 Feb 2021 10:35:59 -0500 Received: from smail.rz.tu-ilmenau.de ([141.24.186.67]:41000 "EHLO smail.rz.tu-ilmenau.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230106AbhBFPf7 (ORCPT ); Sat, 6 Feb 2021 10:35:59 -0500 Received: from isengard.fritz.box (unknown [87.147.51.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smail.rz.tu-ilmenau.de (Postfix) with ESMTPSA id 65CE758006C; Sat, 6 Feb 2021 16:34:34 +0100 (CET) From: Markus Theil To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Markus Theil Subject: [PATCH 3/3] rfkill: support hard block reason in C code Date: Sat, 6 Feb 2021 16:34:11 +0100 Message-Id: <20210206153411.19097-3-markus.theil@tu-ilmenau.de> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210206153411.19097-1-markus.theil@tu-ilmenau.de> References: <20210206153411.19097-1-markus.theil@tu-ilmenau.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Signed-off-by: Markus Theil --- rfkill.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/rfkill.c b/rfkill.c index 6b5ca2c..253ee46 100644 --- a/rfkill.c +++ b/rfkill.c @@ -58,9 +58,10 @@ static void rfkill_event(void) } gettimeofday(&tv, NULL); - printf("%ld.%06u: idx %u type %u op %u soft %u hard %u\n", + printf("%ld.%06u: idx %u type %u op %u soft %u hard %u hard block reasons 0x%02x\n", (long) tv.tv_sec, (unsigned int) tv.tv_usec, - event.idx, event.type, event.op, event.soft, event.hard); + event.idx, event.type, event.op, event.soft, event.hard, + event.hard_block_reasons); fflush(stdout); } @@ -244,6 +245,16 @@ static int rfkill_list(const char *param) type2string(event.type)); printf("\tSoft blocked: %s\n", event.soft ? "yes" : "no"); printf("\tHard blocked: %s\n", event.hard ? "yes" : "no"); + if (len >= RFKILL_EVENT_SIZE_V1 + 1) { + printf("\tHard block reasons: "); + if (event.hard_block_reasons == 0) + printf("[NONE]"); + if (event.hard_block_reasons & RFKILL_HARD_BLOCK_NOT_OWNER) + printf("[NOT_OWNER]"); + if (event.hard_block_reasons & RFKILL_HARD_BLOCK_SIGNAL) + printf("[SIGNAL]"); + printf("\n"); + } } close(fd); -- 2.30.0