I’m writing a kernel module that needs to read the value of bitrate from this union :
union iwreq_data
{
.......
struct iw_param bitrate; /* default bit rate */
....
}
this code is taken form wireless.h anyone knows how I can access get its’ value?I mean what struct should I use net_device?wireless_dev? I’m using linux kernel 2.6.35
If you have
union iwreq_data *data, you can simply usedata->bitrate.value.But this structure doesn’t permanently exist, so you can’t get a pointer to it for a given device. The structure is used when setting or getting parameters for a device, and exists only for the duration of the set/get operation.
When setting the bitrate, the driver saves the new value in a driver-dependent manner, and the structure is released (it’s normally allocated on the stack of the setting function).
You can try calling
ieee80211softmac_wx_get_rateto get it. Give it a pointer to an uninitializedunion iwreq_data, and it will fill in the bit rate.