Is it possible开发者_JAVA技巧 to obtain the bit rate of a wireless interface in a kernel module?
Thanks
I am not sure if I understood you correctly, but I think that you may use iw_range struct defined in libiw library (note that it's licensed under GPL, so be carefull when you use it in commercial application). You can do it in following way:
#include<iwlib.h>
int main(int argc, char** argv)
{
char* dev = "wlan0";
int skfd = iw_sockets_open();
int has_range = 0;
struct iw_range range;
int i = 0;
has_range = (iw_get_range_info(skfd, dev, &range) >= 0);
printf("Available %d bitrates\n", range.num_bitrates);
while(i < range.num_bitrates)
{
printf("Available bitrate: %d\n", range.bitrate[i]);
i++;
}
}
精彩评论