kern/166086: [Patch][ath] Reflect state of rfkill switch in a sysctl for ath based card

Andre Albsmeier Andre.Albsmeier at siemens.com
Wed Mar 14 13:40:03 UTC 2012


>Number:         166086
>Category:       kern
>Synopsis:       [Patch][ath] Reflect state of rfkill switch in a sysctl for ath based card
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Wed Mar 14 13:40:02 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Andre Albsmeier
>Release:        FreeBSD 7.4-STABLE i386
>Organization:
>Environment:

FreeBSD 7.4-STABLE
Wistron CM9 WLAN card (ath) in a FSC S7020


>Description:

As requested by adrian@ here is my patch to make the
state of the rfkill switch available via sysctl for
the above hardware.

>How-To-Repeat:

>Fix:

--- 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,

>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list