Beispiel #1
0
/* Enables the long range detector and starts async receive */
static int redrat3_enable_detector(struct redrat3_dev *rr3)
{
	struct device *dev = rr3->dev;
	u8 ret;

	ret = redrat3_send_cmd(RR3_RC_DET_ENABLE, rr3);
	if (ret != 0)
		dev_dbg(dev, "%s: unexpected ret of %d\n",
			__func__, ret);

	ret = redrat3_send_cmd(RR3_RC_DET_STATUS, rr3);
	if (ret != 1) {
		dev_err(dev, "%s: detector status: %d, should be 1\n",
			__func__, ret);
		return -EIO;
	}

	ret = usb_submit_urb(rr3->narrow_urb, GFP_KERNEL);
	if (ret) {
		dev_err(rr3->dev, "narrow band urb failed: %d", ret);
		return ret;
	}

	ret = usb_submit_urb(rr3->wide_urb, GFP_KERNEL);
	if (ret)
		dev_err(rr3->dev, "wide band urb failed: %d", ret);

	return ret;
}
static void redrat3_disable_detector(struct redrat3_dev *rr3)
{
	struct device *dev = rr3->dev;
	u8 ret;

	rr3_ftr(dev, "Entering %s\n", __func__);

	ret = redrat3_send_cmd(RR3_RC_DET_DISABLE, rr3);
	if (ret != 0)
		dev_err(dev, "%s: failure!\n", __func__);

	ret = redrat3_send_cmd(RR3_RC_DET_STATUS, rr3);
	if (ret != 0)
		dev_warn(dev, "%s: detector status: %d, should be 0\n",
			 __func__, ret);

	rr3->det_enabled = false;
}
/* Enables the long range detector and starts async receive */
static int redrat3_enable_detector(struct redrat3_dev *rr3)
{
    struct device *dev = rr3->dev;
    u8 ret;

    rr3_ftr(dev, "Entering %s\n", __func__);

    ret = redrat3_send_cmd(RR3_RC_DET_ENABLE, rr3);
    if (ret != 0)
        dev_dbg(dev, "%s: unexpected ret of %d\n",
                __func__, ret);

    ret = redrat3_send_cmd(RR3_RC_DET_STATUS, rr3);
    if (ret != 1) {
        dev_err(dev, "%s: detector status: %d, should be 1\n",
                __func__, ret);
        return -EIO;
    }

    redrat3_issue_async(rr3);

    return 0;
}