aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Roskin <proski@gnu.org>2007-06-16 03:38:26 -0400
committerGuido Guenther <agx@sigxcpu.org>2007-06-16 13:42:56 +0200
commit494b39d0c20ab65cd2269ad54b5d09ecc4a24468 (patch)
treef8020e116d297e1e40904339b17e66c4528e1fce
parent54fe78a862ccc05f0a2d4863deabe9fa03c0e9af (diff)
[PATCH] Implement "get" counterparts for iwpriv calls
Rename all iwpriv calls to start with "get" or "set" for consistency. Eliminate gap in the ioctl numbers. Rename "intl_roaming" to "intl_scan", because it's really affects scanning only. Signed-off-by: Pavel Roskin <proski@gnu.org>
-rw-r--r--at76_usb.c119
-rw-r--r--at76_usb.h30
2 files changed, 120 insertions, 29 deletions
diff --git a/at76_usb.c b/at76_usb.c
index 86e20fc..8c28534 100644
--- a/at76_usb.c
+++ b/at76_usb.c
@@ -3348,6 +3348,17 @@ static int at76_iw_set_short_preamble(struct net_device *netdev,
return ret;
}
+static int at76_iw_get_short_preamble(struct net_device *netdev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ struct at76_priv *priv = netdev_priv(netdev);
+ int *param = (int *)extra;
+
+ param[0] = priv->preamble_type;
+ return 0;
+}
+
static int at76_iw_set_debug(struct net_device *netdev,
struct iw_request_info *info,
struct iw_point *data, char *extra)
@@ -3382,6 +3393,14 @@ static int at76_iw_set_debug(struct net_device *netdev,
return 0;
}
+static int at76_iw_get_debug(struct net_device *netdev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ snprintf(wrqu->name, sizeof(wrqu->name), "0x%08x", at76_debug);
+ return 0;
+}
+
static int at76_iw_set_powersave_mode(struct net_device *netdev,
struct iw_request_info *info, char *name,
char *extra)
@@ -3403,6 +3422,17 @@ static int at76_iw_set_powersave_mode(struct net_device *netdev,
return ret;
}
+static int at76_iw_get_powersave_mode(struct net_device *netdev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ struct at76_priv *priv = netdev_priv(netdev);
+ int *param = (int *)extra;
+
+ param[0] = priv->pm_mode;
+ return 0;
+}
+
static int at76_iw_set_scan_times(struct net_device *netdev,
struct iw_request_info *info, char *name,
char *extra)
@@ -3424,6 +3454,18 @@ static int at76_iw_set_scan_times(struct net_device *netdev,
return ret;
}
+static int at76_iw_get_scan_times(struct net_device *netdev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ struct at76_priv *priv = netdev_priv(netdev);
+ int *param = (int *)extra;
+
+ param[0] = priv->scan_min_time;
+ param[1] = priv->scan_max_time;
+ return 0;
+}
+
static int at76_iw_set_scan_mode(struct net_device *netdev,
struct iw_request_info *info, char *name,
char *extra)
@@ -3445,6 +3487,17 @@ static int at76_iw_set_scan_mode(struct net_device *netdev,
return ret;
}
+static int at76_iw_get_scan_mode(struct net_device *netdev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ struct at76_priv *priv = netdev_priv(netdev);
+ int *param = (int *)extra;
+
+ param[0] = priv->scan_mode;
+ return 0;
+}
+
static int at76_set_iroaming(struct at76_priv *priv, int onoff)
{
int ret = 0;
@@ -3487,6 +3540,17 @@ static int at76_iw_set_intl_roaming(struct net_device *netdev,
return ret;
}
+static int at76_iw_get_intl_roaming(struct net_device *netdev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ struct at76_priv *priv = netdev_priv(netdev);
+ int *param = (int *)extra;
+
+ param[0] = priv->international_roaming;
+ return 0;
+}
+
#define AT76_SET_HANDLER(h, f) [h - SIOCIWFIRST] = (iw_handler) f
/*******************************************************************************
@@ -3530,43 +3594,64 @@ static const iw_handler at76_handlers[] = {
/*structure that advertises the private iw handlers of this driver */
static const iw_handler at76_priv_handlers[] = {
AT76_SET_PRIV(AT76_SET_SHORT_PREAMBLE, at76_iw_set_short_preamble),
+ AT76_SET_PRIV(AT76_GET_SHORT_PREAMBLE, at76_iw_get_short_preamble),
AT76_SET_PRIV(AT76_SET_DEBUG, at76_iw_set_debug),
+ AT76_SET_PRIV(AT76_GET_DEBUG, at76_iw_get_debug),
AT76_SET_PRIV(AT76_SET_POWERSAVE_MODE, at76_iw_set_powersave_mode),
+ AT76_SET_PRIV(AT76_GET_POWERSAVE_MODE, at76_iw_get_powersave_mode),
AT76_SET_PRIV(AT76_SET_SCAN_TIMES, at76_iw_set_scan_times),
+ AT76_SET_PRIV(AT76_GET_SCAN_TIMES, at76_iw_get_scan_times),
AT76_SET_PRIV(AT76_SET_SCAN_MODE, at76_iw_set_scan_mode),
+ AT76_SET_PRIV(AT76_GET_SCAN_MODE, at76_iw_get_scan_mode),
AT76_SET_PRIV(AT76_SET_INTL_ROAMING, at76_iw_set_intl_roaming),
+ AT76_SET_PRIV(AT76_GET_INTL_ROAMING, at76_iw_get_intl_roaming),
};
/*******************************************************************************
* structure that describes the private ioctls/iw handlers of this driver
*/
static const struct iw_priv_args at76_priv_args[] = {
+ /* 0 - long, 1 - short */
{AT76_SET_SHORT_PREAMBLE,
- IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0,
- "short_preamble"}, /* 0 - long, 1 -short */
+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "set_preamble"},
+
+ {AT76_GET_SHORT_PREAMBLE,
+ 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "get_preamble"},
+ /* we must pass the new debug mask as a string, because iwpriv cannot
+ * parse hex numbers starting with 0x :-( */
{AT76_SET_DEBUG,
- /* we must pass the new debug mask as a string,
- * 'cause iwpriv cannot parse hex numbers
- * starting with 0x :-( */
- IW_PRIV_TYPE_CHAR | 10, 0,
- "set_debug"}, /* set debug value */
+ IW_PRIV_TYPE_CHAR | 10, 0, "set_debug"},
+
+ {AT76_GET_DEBUG,
+ 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 10, "get_debug"},
+ /* 1 - active, 2 - power save, 3 - smart power save */
{AT76_SET_POWERSAVE_MODE,
- IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0,
- "powersave_mode"}, /* 1 - active, 2 - power save,
- 3 - smart power save */
+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "set_powersave"},
+
+ {AT76_GET_POWERSAVE_MODE,
+ 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "get_powersave"},
+
+ /* min_channel_time, max_channel_time */
{AT76_SET_SCAN_TIMES,
- IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, 0,
- "scan_times"}, /* min_channel_time,
- max_channel_time */
+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, 0, "set_scan_times"},
+
+ {AT76_GET_SCAN_TIMES,
+ 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, "get_scan_times"},
+
+ /* 0 - active, 1 - passive scan */
{AT76_SET_SCAN_MODE,
- IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0,
- "scan_mode"}, /* 0 - active, 1 - passive scan */
+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "set_scan_mode"},
+
+ {AT76_GET_SCAN_MODE,
+ 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "get_scan_mode"},
{AT76_SET_INTL_ROAMING,
- IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0,
- "intl_roaming"},
+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "set_intl_scan"},
+
+ {AT76_GET_INTL_ROAMING,
+ 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "get_intl_scan"}
};
static const struct iw_handler_def at76_handler_def = {
diff --git a/at76_usb.h b/at76_usb.h
index 9a8c327..532b2f8 100644
--- a/at76_usb.h
+++ b/at76_usb.h
@@ -28,18 +28,24 @@
#define DRIVER_VERSION "0.15dev"
/* our private ioctl's */
-/* set preamble length*/
-#define AT76_SET_SHORT_PREAMBLE (SIOCIWFIRSTPRIV + 0x0)
-/* set debug parameter */
-#define AT76_SET_DEBUG (SIOCIWFIRSTPRIV + 0x2)
-/* set power save mode (incl. the Atmel proprietary smart save mode */
-#define AT76_SET_POWERSAVE_MODE (SIOCIWFIRSTPRIV + 0x4)
-/* set min and max channel times for scan */
-#define AT76_SET_SCAN_TIMES (SIOCIWFIRSTPRIV + 0x6)
-/* set scan mode */
-#define AT76_SET_SCAN_MODE (SIOCIWFIRSTPRIV + 0x8)
-/* set international roaming */
-#define AT76_SET_INTL_ROAMING (SIOCIWFIRSTPRIV + 0x10)
+/* preamble length (0 - long, 1 - short) */
+#define AT76_SET_SHORT_PREAMBLE (SIOCIWFIRSTPRIV + 0)
+#define AT76_GET_SHORT_PREAMBLE (SIOCIWFIRSTPRIV + 1)
+/* which debug channels are enabled */
+#define AT76_SET_DEBUG (SIOCIWFIRSTPRIV + 2)
+#define AT76_GET_DEBUG (SIOCIWFIRSTPRIV + 3)
+/* power save mode (incl. the Atmel proprietary smart save mode) */
+#define AT76_SET_POWERSAVE_MODE (SIOCIWFIRSTPRIV + 4)
+#define AT76_GET_POWERSAVE_MODE (SIOCIWFIRSTPRIV + 5)
+/* min and max channel times for scan */
+#define AT76_SET_SCAN_TIMES (SIOCIWFIRSTPRIV + 6)
+#define AT76_GET_SCAN_TIMES (SIOCIWFIRSTPRIV + 7)
+/* scan mode (0 - active, 1 - passive) */
+#define AT76_SET_SCAN_MODE (SIOCIWFIRSTPRIV + 8)
+#define AT76_GET_SCAN_MODE (SIOCIWFIRSTPRIV + 9)
+/* international roaming (0 - disabled, 1 - enabled */
+#define AT76_SET_INTL_ROAMING (SIOCIWFIRSTPRIV + 10)
+#define AT76_GET_INTL_ROAMING (SIOCIWFIRSTPRIV + 11)
#define DEVICE_VENDOR_REQUEST_OUT 0x40
#define DEVICE_VENDOR_REQUEST_IN 0xc0