linux - 从无线设备驱动程序获取比特率的值。

标签 linux linux-device-driver wireless

我正在编写一个内核模块,需要从这个联合中读取 bitrate 的值:

union   iwreq_data
{==
    .......
    struct iw_param bitrate;    /* default bit rate */

     ....
}

此代码是 wireless.h 的形式 有谁知道我如何访问它的值? (我使用的是 linux 内核 2.6.35)

最佳答案

不幸的是,没有办法做到这一点......

仔细观察我们发现的iw_param结构

struct  iw_param
{
  __s32     value;      /* The value of the parameter itself */
  __u8      fixed;      /* Hardware should not use auto select */
  __u8      disabled;   /* Disable the feature */
  __u16     flags;      /* Various specifc flags (if any) */
};

现在,wireless.h

中的代码如下所示
union   iwreq_data
{
    /* Config - generic */
    char        name[IFNAMSIZ];
    /* Name : used to verify the presence of  wireless extensions.
     * Name of the protocol/provider... */

    struct iw_point essid;      /* Extended network name */
    struct iw_param nwid;       /* network id (or domain - the cell) */
    struct iw_freq  freq;       /* frequency or channel :
                     * 0-1000 = channel
                     * > 1000 = frequency in Hz */

    struct iw_param sens;       /* signal level threshold */
    struct iw_param bitrate;    /* default bit rate */
    struct iw_param txpower;    /* default transmit power */
    struct iw_param rts;        /* RTS threshold threshold */
    struct iw_param frag;       /* Fragmentation threshold */
    __u32       mode;       /* Operation mode */
    struct iw_param retry;      /* Retry limits & lifetime */

    struct iw_point encoding;   /* Encoding stuff : tokens */
    struct iw_param power;      /* PM duration/timeout */
    struct iw_quality qual;     /* Quality part of statistics */

    struct sockaddr ap_addr;    /* Access point address */
    struct sockaddr addr;       /* Destination address (hw/mac) */

    struct iw_param param;      /* Other small parameters */
    struct iw_point data;       /* Other large parameters */
};

除了 bitrate->value

之外,我想不出其他方法来访问它

关于linux - 从无线设备驱动程序获取比特率的值。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11158094/

相关文章:

c - Linux 如何知道要调用哪个 ioctl 函数?

networking - 基于地理位置的无线网状路由算法 : useful?

linux - sudo模式和内核模式有区别吗?

php - 从 php 重启 Sphinx

logging - 如何避免在Linux内核中丢失printk日志

检查正确接收的数据包数量 - Socket 编程

wifi - 哪种方法更好——多个 SSID 或单个 SSID

C 使用预定义消息将标准输出重定向到文件

python selenium 点击第n个元素

camera - Raspberry Pi - Raspbian - 运动 - USB 摄像头 - 黑色图像