Re: events when (de)associating or when cable is (un)plugged
From: Dirk-Willem van Gulik (dirkx_at_webweaving.org)
Date: 03/27/04
- Previous message: Suleiman Souhlal: "Re: events when (de)associating or when cable is (un)plugged"
- In reply to: Suleiman Souhlal: "Re: events when (de)associating or when cable is (un)plugged"
- Next in thread: Dirk-Willem van Gulik: "Re: events when (de)associating or when cable is (un)plugged"
- Reply: Dirk-Willem van Gulik: "Re: events when (de)associating or when cable is (un)plugged"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 27 Mar 2004 01:39:33 +0100 To: Suleiman Souhlal <refugee@segfaulted.com>
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
_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
- Previous message: Suleiman Souhlal: "Re: events when (de)associating or when cable is (un)plugged"
- In reply to: Suleiman Souhlal: "Re: events when (de)associating or when cable is (un)plugged"
- Next in thread: Dirk-Willem van Gulik: "Re: events when (de)associating or when cable is (un)plugged"
- Reply: Dirk-Willem van Gulik: "Re: events when (de)associating or when cable is (un)plugged"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|