开发者

Linux kernel module wireless interface bit rate

开发者 https://www.devze.com 2023-03-13 19:02 出处:网络
Is it possible开发者_JAVA技巧 to obtain the bit rate of a wireless interface in a kernel module?

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++;
  }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号