+static int wlcompat_private_ioctl(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu,
+ char *extra)
+{
+ int *value = (int *) wrqu->name;
+
+ switch (info->cmd) {
+ case WLCOMPAT_SET_MONITOR:
+ {
+ if (wl_ioctl(dev, WLC_SET_MONITOR, value, sizeof(int)) < 0)
+ return -EINVAL;
+
+ break;
+ }
+ case WLCOMPAT_GET_MONITOR:
+ {
+ if (wl_ioctl(dev, WLC_GET_MONITOR, extra, sizeof(int)) < 0)
+ return -EINVAL;
+
+ break;
+ }
+ case WLCOMPAT_SET_TXPWR_LIMIT:
+ {
+ int val;
+
+
+ if (wl_get_val(dev, "qtxpower", &val, sizeof(int)) < 0)
+ return -EINVAL;
+
+ if (*extra > 0)
+ val |= WL_TXPWR_OVERRIDE;
+ else
+ val &= ~WL_TXPWR_OVERRIDE;
+
+ if (wl_set_val(dev, "qtxpower", &val, sizeof(int)) < 0)
+ return -EINVAL;
+
+ break;
+ }
+ case WLCOMPAT_GET_TXPWR_LIMIT:
+ {
+ if (wl_get_val(dev, "qtxpower", value, sizeof(int)) < 0)
+ return -EINVAL;
+
+ *value = ((*value & WL_TXPWR_OVERRIDE) == WL_TXPWR_OVERRIDE ? 1 : 0);
+
+ break;
+ }
+ case WLCOMPAT_SET_ANTDIV:
+ {
+ if (wl_ioctl(dev, WLC_SET_ANTDIV, value, sizeof(int)) < 0)
+ return -EINVAL;
+
+ break;
+ }
+ case WLCOMPAT_GET_ANTDIV:
+ {
+ if (wl_ioctl(dev, WLC_GET_ANTDIV, extra, sizeof(int)) < 0)
+ return -EINVAL;
+
+ break;
+ }
+ case WLCOMPAT_SET_TXANT:
+ {
+ if (wl_ioctl(dev, WLC_SET_TXANT, value, sizeof(int)) < 0)
+ return -EINVAL;
+
+ break;
+ }
+ case WLCOMPAT_GET_TXANT:
+ {
+ if (wl_ioctl(dev, WLC_GET_TXANT, extra, sizeof(int)) < 0)
+ return -EINVAL;
+
+ break;
+ }
+ default:
+ {
+ return -EINVAL;
+ }
+
+ }
+ return 0;
+}
+
+static const struct iw_priv_args wlcompat_private_args[] =
+{
+ { WLCOMPAT_SET_MONITOR,
+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+ 0,
+ "set_monitor"
+ },
+ { WLCOMPAT_GET_MONITOR,
+ 0,
+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+ "get_monitor"
+ },
+ { WLCOMPAT_SET_TXPWR_LIMIT,
+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+ 0,
+ "set_txpwr_force"
+ },
+ { WLCOMPAT_GET_TXPWR_LIMIT,
+ 0,
+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+ "get_txpwr_force"
+ },
+ { WLCOMPAT_SET_ANTDIV,
+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+ 0,
+ "set_antdiv"
+ },
+ { WLCOMPAT_GET_ANTDIV,
+ 0,
+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+ "get_antdiv"
+ },
+ { WLCOMPAT_SET_TXANT,
+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+ 0,
+ "set_txant"
+ },
+ { WLCOMPAT_GET_TXANT,
+ 0,
+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+ "get_txant"
+ },
+};
+
+static const iw_handler wlcompat_private[] =
+{
+ wlcompat_private_ioctl,
+ NULL
+};
+
+
+static const struct iw_handler_def wlcompat_handler_def =