shorter syntax
[openwrt.git] / package / openwrt / wlcompat.c
index f96b987..74dcdf2 100644 (file)
@@ -302,6 +302,16 @@ static int wlcompat_ioctl(struct net_device *dev,
                        }
                        break;
                }
+               case SIOCSIWAP:
+               {
+                       if (wrqu->ap_addr.sa_family != ARPHRD_ETHER)
+                               return -EINVAL;
+
+                       if (wl_ioctl(dev,WLC_SET_BSSID,wrqu->ap_addr.sa_data,6) < 0)
+                               return -EINVAL;
+
+                       break;
+               }
                case SIOCGIWAP:
                {
                        wrqu->ap_addr.sa_family = ARPHRD_ETHER;
@@ -513,7 +523,7 @@ static const iw_handler      wlcompat_handler[] = {
        iw_handler_get_spy,     /* SIOCGIWSPY */
        iw_handler_set_thrspy,  /* SIOCSIWTHRSPY */
        iw_handler_get_thrspy,  /* SIOCGIWTHRSPY */
-       NULL,                   /* SIOCSIWAP */
+       wlcompat_ioctl,         /* SIOCSIWAP */
        wlcompat_ioctl,         /* SIOCGIWAP */
        NULL,                   /* -- hole -- */
        NULL,                   /* SIOCGIWAPLIST */
@@ -559,12 +569,12 @@ static const struct iw_priv_args  wlcompat_private_args[] =
        {       PRIV_SET_TXPWR_LIMIT, 
                IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
                0,
-               "set_txpwr_limit"
+               "set_txpwr_force"
        },
        {       PRIV_GET_TXPWR_LIMIT, 
                0,
                IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
-               "get_txpwr_limit"
+               "get_txpwr_force"
        }
 };
 
@@ -685,7 +695,23 @@ static int new_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) {
 
 static int __init wlcompat_init()
 {
-       dev = dev_get_by_name("eth1");
+       int found = 0, i;
+       char *devname = "eth0";
+       
+       while (!found && devname[3] < '3') {
+               devname[3]++;
+               
+               dev = dev_get_by_name(devname);
+               if ((wl_ioctl(dev, WLC_GET_MAGIC, &i, sizeof(i)) == 0) && i == WLC_IOCTL_MAGIC)
+                       found = 1;
+       }
+       
+       if (!found) {
+               printk("No Broadcom devices found.\n");
+               return -ENODEV;
+       }
+               
+
 #ifdef DEBUG
        old_ioctl = dev->do_ioctl;
        dev->do_ioctl = new_ioctl;
This page took 0.02219 seconds and 4 git commands to generate.