Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Mar 2012 16:13:58 +0100
From:      Andre Albsmeier <Andre.Albsmeier@siemens.com>
To:        freebsd-mobile@freebsd.org
Cc:        Andre.Albsmeier@siemens.com
Subject:   [Patch] Reflect state of rfkill switch in a sysctl for ath based card
Message-ID:  <20120312151358.GA26109@bali>

next in thread | raw e-mail | index | archive | help
Hello all,

my laptop (FSC S7020) got this rfkill switch for the normally
used Intel 2200 WLAN card. The state of this switch can be
seen through the dev.iwi.0.radio sysctl.

With my new Atheros based card (Wistron CM9) this never worked
although the state of the switch was properly honoured by the
card.

In case anyone is interested: The following patch brings this
functionality to the ath driver of 7.4-STABLE and works at least
on the above mentioned hardware. Comments and suggestions (apart
from style fixes;-)) are welcome...

	-Andre

--- sys/dev/ath/if_ath.c.ORI	2010-11-17 18:30:14.000000000 +0100
+++ sys/dev/ath/if_ath.c	2012-03-02 13:47:26.000000000 +0100
@@ -6074,6 +6074,15 @@
 	return !ath_hal_settpcts(sc->sc_ah, tpcts) ? EINVAL : 0;
 }
 
+static int ath_sysctl_radio( SYSCTL_HANDLER_ARGS )
+{
+  struct ath_softc* sc = arg1;
+  int val;
+
+  val = ath_hal_gpioget( sc->sc_ah, sc->sc_rfsilentpin ) ^ sc->sc_rfsilentpol;
+  return sysctl_handle_int( oidp, &val, 0, req );
+}
+
 static void
 ath_sysctlattach(struct ath_softc *sc)
 {
@@ -6162,6 +6171,7 @@
 		SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
 			"rfkill", CTLTYPE_INT | CTLFLAG_RW, sc, 0,
 			ath_sysctl_rfkill, "I", "enable/disable RF kill switch");
+  SYSCTL_ADD_PROC( ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "radio", CTLTYPE_INT | CTLFLAG_RD, sc, 0, ath_sysctl_radio, "I", "radio transmitter switch state (0=off, 1=on)");
 	}
 	sc->sc_monpass = HAL_RXERR_DECRYPT | HAL_RXERR_MIC;
 	SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120312151358.GA26109>