Date: Sat, 27 Mar 2004 01:39:33 +0100 From: Dirk-Willem van Gulik <dirkx@webweaving.org> To: Suleiman Souhlal <refugee@segfaulted.com> Cc: freebsd-hackers@freebsd.org Subject: Re: events when (de)associating or when cable is (un)plugged Message-ID: <37AF87AA-7F87-11D8-8F99-000A95CDA38A@webweaving.org> In-Reply-To: <20040326181713.32971952@zZzZ.segfaulted.com> References: <39FE23FA-7F75-11D8-8F99-000A95CDA38A@webweaving.org> <20040326181713.32971952@zZzZ.segfaulted.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mar 27, 2004, at 12:17 AM, Suleiman Souhlal wrote:
>> Looking for suggestions on a 'clean' and generic way to allow for
>> notifications when a 802.11 association is made or lost, or when
>> a ethernet cable is (un)plugged. I.e.akin to the events 'usbd(8) get
>> when you sit on /dev/usb. This is for 5.2.1 or beyond.
>
> I am not too sure about 802.11, but to detect when the ethernet cable
> is
> (un)plugged, you can use kqueue(2) with the EVFILT_NETDEV filter.
Ok - that looks like a good match - so I guess it would make sense
then to make
the #define of:
#define ieee80211_new_state(_ic, _nstate, _arg) \
(((_ic)->ic_newstate)((_ic), (_nstate), (_arg)))
into something a bit more like a function:
extern int ieee80211_new_state(struct ieee80211com *, enum
ieee80211_state , int);
and then make the latter do something like
void
ieee80211_new_state(struct ieee80211com * ic, enum ieee80211_state
nstate , int arg)
{
/* Callback into the real driver */
int err = (ic->ic_newstate)(ic, nstate, arg);
#ifdef IEEE80211_DEBUG
printf("Transition to state %x(%d) %s\n",nstate,arg, err ? "Failed" :
"ok");
#endif /* DEBUG */
if (right args == some-assoc-change)
KNOTE(ic->ifp->if_klist, arg ? NOTE_LINKDOWN : NOTE_LINKUP); /* ??
locking ?? */
}
Thanks - hacking away.
Dw
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?37AF87AA-7F87-11D8-8F99-000A95CDA38A>
