Ejemplo n.º 1
0
/*---write channel 1..4 to rxon for it, 0 to rxoff---*/
static ssize_t wil_write_file_rxon(struct file *file, const char __user *buf,
				   size_t len, loff_t *ppos)
{
	struct wil6210_priv *wil = file->private_data;
	int rc;
	long channel;
	bool on;

	char *kbuf = memdup_user_nul(buf, len);

	if (IS_ERR(kbuf))
		return PTR_ERR(kbuf);
	rc = kstrtol(kbuf, 0, &channel);
	kfree(kbuf);
	if (rc)
		return rc;

	if ((channel < 0) || (channel > 4)) {
		wil_err(wil, "Invalid channel %ld\n", channel);
		return -EINVAL;
	}
	on = !!channel;

	if (on) {
		rc = wmi_set_channel(wil, (int)channel);
		if (rc)
			return rc;
	}

	rc = wmi_rxon(wil, on);
	if (rc)
		return rc;

	return len;
}
Ejemplo n.º 2
0
/*---rxon for channel 1---*/
static ssize_t wil_write_file_rxon(struct file *file, const char __user *buf,
				   size_t len, loff_t *ppos)
{
	struct wil6210_priv *wil = file->private_data;
	int rc;
	bool on;

	char *kbuf = kmalloc(len + 1, GFP_KERNEL);
	if (!kbuf)
		return -ENOMEM;
	if (copy_from_user(kbuf, buf, len))
		return -EIO;

	kbuf[len] = '\0';
	on = !!simple_strtol(kbuf, NULL, 0);
	kfree(kbuf);

	rc = wmi_set_channel(wil, 1);
	if (rc)
		return rc;

	rc = wmi_rxon(wil, on);
	if (rc)
		return rc;

	return len;
}
Ejemplo n.º 3
0
static int wil_cancel_remain_on_channel(struct wiphy *wiphy,
                                        struct wireless_dev *wdev,
                                        u64 cookie)
{
    struct wil6210_priv *wil = wiphy_to_wil(wiphy);
    int rc;

    wil_info(wil, "%s()\n", __func__);

    rc = wmi_rxon(wil, false);

    return rc;
}
Ejemplo n.º 4
0
static int wil_remain_on_channel(struct wiphy *wiphy,
                                 struct wireless_dev *wdev,
                                 struct ieee80211_channel *chan,
                                 unsigned int duration,
                                 u64 *cookie)
{
    struct wil6210_priv *wil = wiphy_to_wil(wiphy);
    int rc;

    /* TODO: handle duration */
    wil_info(wil, "%s(%d, %d ms)\n", __func__, chan->center_freq, duration);

    rc = wmi_set_channel(wil, chan->hw_value);
    if (rc)
        return rc;

    rc = wmi_rxon(wil, true);

    return rc;
}
Ejemplo n.º 5
0
/*---write channel 1..4 to rxon for it, 0 to rxoff---*/
static ssize_t wil_write_file_rxon(struct file *file, const char __user *buf,
				   size_t len, loff_t *ppos)
{
	struct wil6210_priv *wil = file->private_data;
	int rc;
	long channel;
	bool on;

	char *kbuf = kmalloc(len + 1, GFP_KERNEL);

	if (!kbuf)
		return -ENOMEM;
	if (copy_from_user(kbuf, buf, len)) {
		kfree(kbuf);
		return -EIO;
	}

	kbuf[len] = '\0';
	rc = kstrtol(kbuf, 0, &channel);
	kfree(kbuf);
	if (rc)
		return rc;

	if ((channel < 0) || (channel > 4)) {
		wil_err(wil, "Invalid channel %ld\n", channel);
		return -EINVAL;
	}
	on = !!channel;

	if (on) {
		rc = wmi_set_channel(wil, (int)channel);
		if (rc)
			return rc;
	}

	rc = wmi_rxon(wil, on);
	if (rc)
		return rc;

	return len;
}