Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src-draft/trunk]: src/sys/dev/usb Initialise channels and media state.



details:   https://anonhg.NetBSD.org/src-all/rev/b0650a8151fd
branches:  trunk
changeset: 933369:b0650a8151fd
user:      Nathanial Sloss <nat%NetBSD.org@localhost>
date:      Fri May 01 00:16:58 2020 +1000

description:
Initialise channels and media state.

diffstat:

 sys/dev/usb/if_urtwn.c |  17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diffs (67 lines):

diff -r 4b50f3732661 -r b0650a8151fd sys/dev/usb/if_urtwn.c
--- a/sys/dev/usb/if_urtwn.c    Tue Apr 28 20:19:35 2020 +0200
+++ b/sys/dev/usb/if_urtwn.c    Fri May 01 00:16:58 2020 +1000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_urtwn.c,v 1.59.2.17 2020/04/27 07:37:01 nat Exp $   */
+/*     $NetBSD: if_urtwn.c,v 1.59.2.18 2020/04/27 07:38:25 nat Exp $   */
 /*     $OpenBSD: if_urtwn.c,v 1.42 2015/02/10 23:25:46 mpi Exp $       */
 
 /*-
@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.59.2.17 2020/04/27 07:37:01 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.59.2.18 2020/04/27 07:38:25 nat Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -2350,7 +2350,6 @@
                urtwn_set_chan(sc, ic->ic_curchan,
                    IEEE80211_HTINFO_2NDCHAN_NONE);
 #endif
-
                if (ic->ic_opmode == IEEE80211_M_IBSS ||
                    ic->ic_opmode == IEEE80211_M_HOSTAP) {
                        /* Stop BCN */
@@ -3453,6 +3452,7 @@
 
        ifp = vap->iv_ifp;
         if_initialize(ifp);
+       ifp->if_softc = vap;
        ifp->if_init = urtwn_init;
        ifp->if_ioctl = urtwn_ioctl;
        ifp->if_start = urtwn_start;
@@ -3776,7 +3776,9 @@
                break;
 
        default:
+               splx(s);
                error = ieee80211_ioctl(ifp, cmd, data);
+               s = splnet();
                break;
        }
        if (error == ENETRESET) {
@@ -5475,6 +5477,7 @@
 {
        struct ieee80211vap *vap = ifp->if_softc;
        struct ieee80211com *ic = vap->iv_ic;
+       struct ifmediareq imr;
        struct urtwn_softc *sc = ic->ic_softc;
        struct urtwn_rx_data *data;
        uint32_t reg;
@@ -5732,6 +5735,14 @@
                ieee80211_new_state(vap, IEEE80211_S_SCAN, -1);
        urtwn_wait_async(sc);
 
+       urtwn_getradiocaps(ic, IEEE80211_CHAN_MAX, &ic->ic_nchans,
+           ic->ic_channels);
+       ieee80211_chan_init(ic);
+       ieee80211_media_status(ifp, &imr);
+       imr.ifm_active |= IFM_AUTO;
+       ifmedia_set(&vap->iv_media,
+           imr.ifm_active &~ (IFM_MMASK | IFM_IEEE80211_TURBO));
+
        /* Init the rest of the 802.11 stuff */
        ieee80211_init(ifp);
 



Home | Main Index | Thread Index | Old Index