From owner-freebsd-mobile@FreeBSD.ORG Mon Mar 12 15:18:40 2012 Return-Path: Delivered-To: freebsd-mobile@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 28B7F106566C for ; Mon, 12 Mar 2012 15:18:40 +0000 (UTC) (envelope-from Andre.Albsmeier@siemens.com) Received: from thoth.sbs.de (thoth.sbs.de [192.35.17.2]) by mx1.freebsd.org (Postfix) with ESMTP id B41978FC1A for ; Mon, 12 Mar 2012 15:18:39 +0000 (UTC) Received: from mail2.siemens.de (localhost [127.0.0.1]) by thoth.sbs.de (8.13.6/8.13.6) with ESMTP id q2CFDxbC023200 for ; Mon, 12 Mar 2012 16:13:59 +0100 Received: from curry.mchp.siemens.de (curry.mchp.siemens.de [139.25.40.130]) by mail2.siemens.de (8.13.6/8.13.6) with ESMTP id q2CFDwQr027139 for ; Mon, 12 Mar 2012 16:13:58 +0100 Received: (from localhost) by curry.mchp.siemens.de (8.14.5/8.14.5) id q2CFDwxM079334; Date: Mon, 12 Mar 2012 16:13:58 +0100 From: Andre Albsmeier To: freebsd-mobile@freebsd.org Message-ID: <20120312151358.GA26109@bali> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Echelon: X-Advice: Drop that crappy M$-Outlook, I'm tired of your viruses! User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Andre.Albsmeier@siemens.com Subject: [Patch] Reflect state of rfkill switch in a sysctl for ath based card X-BeenThere: freebsd-mobile@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Mobile computing with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Mar 2012 15:18:40 -0000 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, From owner-freebsd-mobile@FreeBSD.ORG Mon Mar 12 16:27:12 2012 Return-Path: Delivered-To: freebsd-mobile@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 17CD1106564A; Mon, 12 Mar 2012 16:27:12 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-yw0-f54.google.com (mail-yw0-f54.google.com [209.85.213.54]) by mx1.freebsd.org (Postfix) with ESMTP id B68F98FC08; Mon, 12 Mar 2012 16:27:11 +0000 (UTC) Received: by yhgm50 with SMTP id m50so3259566yhg.13 for ; Mon, 12 Mar 2012 09:27:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=LClQQ4BwtXWsaGEmzGr7+BSGgwtvJ5Ozgj3GeMmnCZo=; b=SVQjJjDEov8fmQoKngNTvNMXObmI6IauBrznrEKbpr9rq1RRj7hg9hBZqZpb6NR2ay n6QMvdHHfaL+duIzVKBn9eYxrkOYx/NO+VIONttKWcV4c71A6W7s6PzrxlGtQ9jZWdLU ZYeqUIdAsD8RP0Fc6tSEAK3I8y6lgu4GOLRFQbbSvOrJiKj6ixG9Nu/xdobi2e8/mMCn bmx6l8n6cLfHIDpVQtGVkqy6oWOVMgvHO7SglXi/QDVSidpxbdDGR3rovZMa98peyxMU Z7xaZiWNaR3C0mcYHcrmciElA3bVbSxrmAQZB425xmgbYPAz+7Td9jVMObUS2i6Ql8XL bKmg== MIME-Version: 1.0 Received: by 10.68.240.135 with SMTP id wa7mr1934194pbc.7.1331569630885; Mon, 12 Mar 2012 09:27:10 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.143.33.5 with HTTP; Mon, 12 Mar 2012 09:27:10 -0700 (PDT) In-Reply-To: <20120312151358.GA26109@bali> References: <20120312151358.GA26109@bali> Date: Mon, 12 Mar 2012 09:27:10 -0700 X-Google-Sender-Auth: gqK2FK2i0VBOcl_CmwysF5JlzuI Message-ID: From: Adrian Chadd To: Andre Albsmeier Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-wireless@freebsd.org, freebsd-mobile@freebsd.org Subject: Re: [Patch] Reflect state of rfkill switch in a sysctl for ath based card X-BeenThere: freebsd-mobile@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Mobile computing with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Mar 2012 16:27:12 -0000 Hi! Would you please create a PR and let me know what the PR number is? I'll test it out on my local ath(4) NICs and commit it to -HEAD if there aren't any issues with it. Thanks! Adrian On 12 March 2012 08:13, Andre Albsmeier wrote= : > 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... > > =A0 =A0 =A0 =A0-Andre > > --- sys/dev/ath/if_ath.c.ORI =A0 =A02010-11-17 18:30:14.000000000 +0100 > +++ sys/dev/ath/if_ath.c =A0 =A0 =A0 =A02012-03-02 13:47:26.000000000 +01= 00 > @@ -6074,6 +6074,15 @@ > =A0 =A0 =A0 =A0return !ath_hal_settpcts(sc->sc_ah, tpcts) ? EINVAL : 0; > =A0} > > +static int ath_sysctl_radio( SYSCTL_HANDLER_ARGS ) > +{ > + =A0struct ath_softc* sc =3D arg1; > + =A0int val; > + > + =A0val =3D ath_hal_gpioget( sc->sc_ah, sc->sc_rfsilentpin ) ^ sc->sc_rf= silentpol; > + =A0return sysctl_handle_int( oidp, &val, 0, req ); > +} > + > =A0static void > =A0ath_sysctlattach(struct ath_softc *sc) > =A0{ > @@ -6162,6 +6171,7 @@ > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree)= , OID_AUTO, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0"rfkill", CTLTYPE_INT | CT= LFLAG_RW, sc, 0, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0ath_sysctl_rfkill, "I", "e= nable/disable RF kill switch"); > + =A0SYSCTL_ADD_PROC( ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "radio", CTLT= YPE_INT | CTLFLAG_RD, sc, 0, ath_sysctl_radio, "I", "radio transmitter swit= ch state (0=3Doff, 1=3Don)"); > =A0 =A0 =A0 =A0} > =A0 =A0 =A0 =A0sc->sc_monpass =3D HAL_RXERR_DECRYPT | HAL_RXERR_MIC; > =A0 =A0 =A0 =A0SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, > _______________________________________________ > freebsd-mobile@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-mobile > To unsubscribe, send any mail to "freebsd-mobile-unsubscribe@freebsd.org" From owner-freebsd-mobile@FreeBSD.ORG Tue Mar 13 11:19:45 2012 Return-Path: Delivered-To: freebsd-mobile@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E2362106564A; Tue, 13 Mar 2012 11:19:44 +0000 (UTC) (envelope-from Andre.Albsmeier@siemens.com) Received: from goliath.siemens.de (goliath.siemens.de [192.35.17.28]) by mx1.freebsd.org (Postfix) with ESMTP id 707BE8FC15; Tue, 13 Mar 2012 11:19:44 +0000 (UTC) Received: from mail2.siemens.de (localhost [127.0.0.1]) by goliath.siemens.de (8.13.6/8.13.6) with ESMTP id q2DBBQWH002268; Tue, 13 Mar 2012 12:11:27 +0100 Received: from curry.mchp.siemens.de (curry.mchp.siemens.de [139.25.40.130]) by mail2.siemens.de (8.13.6/8.13.6) with ESMTP id q2DBBQLp031040; Tue, 13 Mar 2012 12:11:26 +0100 Received: (from localhost) by curry.mchp.siemens.de (8.14.5/8.14.5) id q2DBBQuH082981; Date: Tue, 13 Mar 2012 12:11:26 +0100 From: Andre Albsmeier To: Adrian Chadd Message-ID: <20120313111126.GA29538@bali> References: <20120312151358.GA26109@bali> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Echelon: X-Advice: Drop that crappy M$-Outlook, I'm tired of your viruses! User-Agent: Mutt/1.5.21 (2010-09-15) Cc: "freebsd-wireless@freebsd.org" , "freebsd-mobile@freebsd.org" Subject: Re: [Patch] Reflect state of rfkill switch in a sysctl for ath based card X-BeenThere: freebsd-mobile@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Mobile computing with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Mar 2012 11:19:45 -0000 On Mon, 12-Mar-2012 at 17:27:10 +0100, Adrian Chadd wrote: > Hi! > > Would you please create a PR and let me know what the PR number is? Well, there is a high probability that it might not work on non-5212 cards end even here it might fail (I can just test it with this Wistron CM9 card). Maybe someone with more knowledge about ath(4) (Sam?) might have quick look at it before... -Andre > > I'll test it out on my local ath(4) NICs and commit it to -HEAD if > there aren't any issues with it. > > Thanks! > > > Adrian > > > On 12 March 2012 08:13, Andre Albsmeier wrote: > > 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, > > _______________________________________________ > > freebsd-mobile@freebsd.org mailing list > > http://lists.freebsd.org/mailman/listinfo/freebsd-mobile > > To unsubscribe, send any mail to "freebsd-mobile-unsubscribe@freebsd.org" -- FreeBSD: We eat penguins for breakfast From owner-freebsd-mobile@FreeBSD.ORG Tue Mar 13 17:30:04 2012 Return-Path: Delivered-To: freebsd-mobile@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E7A2C10657A1; Tue, 13 Mar 2012 17:30:04 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-pz0-f45.google.com (mail-pz0-f45.google.com [209.85.210.45]) by mx1.freebsd.org (Postfix) with ESMTP id 9E0FB8FC21; Tue, 13 Mar 2012 17:30:04 +0000 (UTC) Received: by dadp14 with SMTP id p14so2676277dad.18 for ; Tue, 13 Mar 2012 10:30:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=exNiL6atR12n3qB5ooDpG5hPb8pNqLrNE7fhrF8Yw3A=; b=NcvV34ezFFcgnORVQuKq3/cQ5/7M9DPeWWwJudF1w4rhKyeqANBudbIs7ZcYFXpxh9 w5TcU9JXrrKCckWlFDcUOdah88zGlzBqmpIuDFrkKU0tFU6XHiXuwFflg3aAHFhSUOrm NHZePzHSSSn3/5WAtUUV1oBBHPwKjGfm6oDnb8YIHX/LUEYOJ2XwdoJ0B7RawlaEyY4G 8TkMwzwZIky0tpmKgmtq5wDP2VswBi9ifkZH3C+2s+cSi0Qhspm1xYCpIDcCvxLI8kes Z3McHDccC3y2WGU+o7AMD0OCaHhrK7ttn6XGSGl7FxMB0NwgvptXptpWVa7jquRDin14 9d+g== MIME-Version: 1.0 Received: by 10.68.232.2 with SMTP id tk2mr7122257pbc.68.1331659804225; Tue, 13 Mar 2012 10:30:04 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.143.33.5 with HTTP; Tue, 13 Mar 2012 10:30:04 -0700 (PDT) In-Reply-To: <20120313111126.GA29538@bali> References: <20120312151358.GA26109@bali> <20120313111126.GA29538@bali> Date: Tue, 13 Mar 2012 10:30:04 -0700 X-Google-Sender-Auth: 8lP0HR-cQvgjMog0ykcZH1zDGRg Message-ID: From: Adrian Chadd To: Andre Albsmeier Content-Type: text/plain; charset=ISO-8859-1 Cc: "freebsd-wireless@freebsd.org" , "freebsd-mobile@freebsd.org" Subject: Re: [Patch] Reflect state of rfkill switch in a sysctl for ath based card X-BeenThere: freebsd-mobile@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Mobile computing with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Mar 2012 17:30:05 -0000 On 13 March 2012 04:11, Andre Albsmeier wrote: >> Would you please create a PR and let me know what the PR number is? > > Well, there is a high probability that it might not work on > non-5212 cards end even here it might fail (I can just test > it with this Wistron CM9 card). Maybe someone with more > knowledge about ath(4) (Sam?) might have quick look at it > before... Oh, I'm the ath(4) maintainer now and I'm pretty cluey in this area. The AR5416 and later NICs have a similar looking GPIO rfkill setup but the code isn't yet in the FreeBSD HAL. I have it though, I just haven't ported it from the Atheros reference driver. I'd prefer the rfkill method to be a HAL call, rather than assuming it's a GPIO line. (I mean, it _is_ a GPIO line, but still.) In any case, please create a PR for it now and we'll get it into -HEAD once I've merged in rfkill support for the AR5416 and later NICs. Thanks, Adrian (I work at Atheros now, so..) From owner-freebsd-mobile@FreeBSD.ORG Wed Mar 14 13:44:38 2012 Return-Path: Delivered-To: freebsd-mobile@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 837D9106564A; Wed, 14 Mar 2012 13:44:38 +0000 (UTC) (envelope-from Andre.Albsmeier@siemens.com) Received: from thoth.sbs.de (thoth.sbs.de [192.35.17.2]) by mx1.freebsd.org (Postfix) with ESMTP id 08AD78FC12; Wed, 14 Mar 2012 13:44:37 +0000 (UTC) Received: from mail3.siemens.de (localhost [127.0.0.1]) by thoth.sbs.de (8.13.6/8.13.6) with ESMTP id q2EDiUxl013130; Wed, 14 Mar 2012 14:44:30 +0100 Received: from curry.mchp.siemens.de (curry.mchp.siemens.de [139.25.40.130]) by mail3.siemens.de (8.13.6/8.13.6) with ESMTP id q2EDiUxN025561; Wed, 14 Mar 2012 14:44:30 +0100 Received: (from localhost) by curry.mchp.siemens.de (8.14.5/8.14.5) id q2EDiU01086714; Date: Wed, 14 Mar 2012 14:44:30 +0100 From: Andre Albsmeier To: Adrian Chadd Message-ID: <20120314134430.GA36213@bali> References: <20120312151358.GA26109@bali> <20120313111126.GA29538@bali> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Echelon: X-Advice: Drop that crappy M$-Outlook, I'm tired of your viruses! User-Agent: Mutt/1.5.21 (2010-09-15) Cc: "freebsd-wireless@freebsd.org" , "freebsd-mobile@freebsd.org" Subject: Re: [Patch] Reflect state of rfkill switch in a sysctl for ath based card X-BeenThere: freebsd-mobile@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Mobile computing with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Mar 2012 13:44:38 -0000 On Tue, 13-Mar-2012 at 18:30:04 +0100, Adrian Chadd wrote: > On 13 March 2012 04:11, Andre Albsmeier wrote: > > >> Would you please create a PR and let me know what the PR number is? > > > > Well, there is a high probability that it might not work on > > non-5212 cards end even here it might fail (I can just test > > it with this Wistron CM9 card). Maybe someone with more > > knowledge about ath(4) (Sam?) might have quick look at it > > before... > > Oh, I'm the ath(4) maintainer now and I'm pretty cluey in this area. Ah, I didn't know that. I hope you didn't refer my statement about "someone with more knowledge about ath" to you -- it was just meant to express my poor overall knowledge of this driver ;-) > > The AR5416 and later NICs have a similar looking GPIO rfkill setup but > the code isn't yet in the FreeBSD HAL. > I have it though, I just haven't ported it from the Atheros reference driver. > > I'd prefer the rfkill method to be a HAL call, rather than assuming > it's a GPIO line. (I mean, it _is_ a GPIO line, but still.) In any I although thought about making it a HALL call but I first wanted to make sure it works at all. And so it stayed like this ;-) > case, please create a PR for it now and we'll get it into -HEAD once OK: kern/166086 > I've merged in rfkill support for the AR5416 and later NICs. > > Thanks, > > Adrian > (I work at Atheros now, so..) That's good news! -Andre