您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ usb_reset_device函数代码示例

51自学网 2021-06-03 09:21:06
  C++
这篇教程C++ usb_reset_device函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中usb_reset_device函数的典型用法代码示例。如果您正苦于以下问题:C++ usb_reset_device函数的具体用法?C++ usb_reset_device怎么用?C++ usb_reset_device使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了usb_reset_device函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: usb_hub_reset

static int usb_hub_reset(struct usb_hub *hub){	struct usb_device *dev = hub->dev;	int i;    DBG_HOST_HUB("### >>> Enter hub.c file --> usb_hub_reset function /n");	/* Disconnect any attached devices */	for (i = 0; i < hub->descriptor->bNbrPorts; i++) {		if (dev->children[i])			usb_disconnect(&dev->children[i]);	}	/* Attempt to reset the hub */	if (hub->urb)		usb_unlink_urb(hub->urb);	else		return -1;	if (usb_reset_device(dev))		return -1;	hub->urb->dev = dev;                                                    	if (usb_submit_urb(hub->urb))		return -1;	usb_hub_power_on(hub);	return 0;}
开发者ID:niubl,项目名称:camera_project,代码行数:29,


示例2: vboxUSBMonSolarisResetDevice

static int vboxUSBMonSolarisResetDevice(char *pszDevicePath, bool fReattach){    int rc = VERR_GENERAL_FAILURE;    LogFunc((DEVICE_NAME ": vboxUSBMonSolarisResetDevice: pszDevicePath=%s fReattach=%d/n", pszDevicePath, fReattach));    /*     * Try grabbing the dev_info_t.     */    dev_info_t *pDeviceInfo = e_ddi_hold_devi_by_path(pszDevicePath, 0);    if (pDeviceInfo)    {        ddi_release_devi(pDeviceInfo);        /*         * Grab the root device node from the parent hub for resetting.         */        dev_info_t *pTmpDeviceInfo = NULL;        for (;;)        {            pTmpDeviceInfo = ddi_get_parent(pDeviceInfo);            if (!pTmpDeviceInfo)            {                LogRel((DEVICE_NAME ":vboxUSBMonSolarisResetDevice: Failed to get parent device info for %s/n", pszDevicePath));                return VERR_GENERAL_FAILURE;            }            if (ddi_prop_exists(DDI_DEV_T_ANY, pTmpDeviceInfo, DDI_PROP_DONTPASS, "usb-port-count"))   /* parent hub */                break;            pDeviceInfo = pTmpDeviceInfo;        }        /*         * Try re-enumerating the device.         */        rc = usb_reset_device(pDeviceInfo, fReattach ? USB_RESET_LVL_REATTACH : USB_RESET_LVL_DEFAULT);        Log((DEVICE_NAME ": vboxUSBMonSolarisResetDevice: usb_reset_device for %s level=%s rc=%d/n", pszDevicePath,             fReattach ? "ReAttach" : "Default", rc));        switch (rc)        {            case USB_SUCCESS:         rc = VINF_SUCCESS;                break;            case USB_INVALID_PERM:    rc = VERR_PERMISSION_DENIED;      break;            case USB_INVALID_ARGS:    rc = VERR_INVALID_PARAMETER;      break;            case USB_BUSY:            rc = VERR_RESOURCE_BUSY;          break;            case USB_INVALID_CONTEXT: rc = VERR_INVALID_CONTEXT;        break;            case USB_FAILURE:         rc = VERR_GENERAL_FAILURE;        break;            default:                  rc = VERR_UNRESOLVED_ERROR;       break;        }    }    else    {        rc = VERR_INVALID_HANDLE;        LogRel((DEVICE_NAME ": vboxUSBMonSolarisResetDevice: Cannot obtain device info for %s/n", pszDevicePath));    }    return rc;}
开发者ID:jeppeter,项目名称:vbox,代码行数:60,


示例3: usb_dvobj_deinit

static void usb_dvobj_deinit(struct usb_interface *usb_intf){	struct dvobj_priv *dvobj = usb_get_intfdata(usb_intf);	usb_set_intfdata(usb_intf, NULL);	if (dvobj) {		/* Modify condition for 92DU DMDP 2010.11.18, by Thomas */		if ((dvobj->NumInterfaces != 2 && dvobj->NumInterfaces != 3) ||		    (dvobj->InterfaceNumber == 1)) {			if (interface_to_usbdev(usb_intf)->state !=			    USB_STATE_NOTATTACHED) {				/* If we didn't unplug usb dongle and				 * remove/insert module, driver fails on				 * sitesurvey for the first time when				 * device is up .				 * Reset usb port for sitesurvey fail issue.				 */				DBG_8723A("usb attached..., try to reset usb device/n");				usb_reset_device(interface_to_usbdev(usb_intf));			}		}		rtw_deinit_intf_priv(dvobj);		mutex_destroy(&dvobj->hw_init_mutex);		mutex_destroy(&dvobj->h2c_fwcmd_mutex);		mutex_destroy(&dvobj->setch_mutex);		mutex_destroy(&dvobj->setbw_mutex);		kfree(dvobj);	}	usb_put_dev(interface_to_usbdev(usb_intf));}
开发者ID:Abioy,项目名称:kasan,代码行数:30,


示例4: usb_stor_port_reset

/* Issue a USB port reset to the device.  The caller must not hold * us->dev_mutex. */int usb_stor_port_reset(struct us_data *us){	int result;	/*for these devices we must use the class specific method */	if (us->pusb_dev->quirks & USB_QUIRK_RESET_MORPHS)		return -EPERM;	result = usb_lock_device_for_reset(us->pusb_dev, us->pusb_intf);	if (result < 0)		US_DEBUGP("unable to lock device for reset: %d/n", result);	else {		/* Were we disconnected while waiting for the lock? */		if (test_bit(US_FLIDX_DISCONNECTING, &us->dflags)) {			result = -EIO;			US_DEBUGP("No reset during disconnect/n");		} else {			result = usb_reset_device(us->pusb_dev);			US_DEBUGP("usb_reset_device returns %d/n",					result);		}		usb_unlock_device(us->pusb_dev);	}	return result;}
开发者ID:LiquidSmooth-Devices,项目名称:Deathly_Kernel_D2,代码行数:28,


示例5: if_usb_reset_device

static int if_usb_reset_device(struct if_usb_card *cardp){	struct cmd_ds_command *cmd = cardp->ep_out_buf + 4;	int ret;	lbs_deb_enter(LBS_DEB_USB);	*(__le32 *)cardp->ep_out_buf = cpu_to_le32(CMD_TYPE_REQUEST);	cmd->command = cpu_to_le16(CMD_802_11_RESET);	cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_reset) + S_DS_GEN);	cmd->result = cpu_to_le16(0);	cmd->seqnum = cpu_to_le16(0x5a5a);	cmd->params.reset.action = cpu_to_le16(CMD_ACT_HALT);	usb_tx_block(cardp, cardp->ep_out_buf, 4 + S_DS_GEN + sizeof(struct cmd_ds_802_11_reset));	msleep(100);	ret = usb_reset_device(cardp->udev);	msleep(100);#ifdef CONFIG_OLPC	if (ret && machine_is_olpc())		if_usb_reset_olpc_card(NULL);#endif	lbs_deb_leave_args(LBS_DEB_USB, "ret %d", ret);	return ret;}
开发者ID:LouZiffer,项目名称:m900_kernel_cupcake-SDX,代码行数:29,


示例6: hub_reset

static int hub_reset(struct usb_hub *hub){    struct usb_device *dev = interface_to_usbdev(hub->intf);    int i;    /* Disconnect any attached devices */    for (i = 0; i < hub->descriptor->bNbrPorts; i++) {        if (dev->children[i])            usb_disconnect(&dev->children[i]);    }    /* Attempt to reset the hub */    if (hub->urb)        usb_unlink_urb(hub->urb);    else        return -1;    if (usb_reset_device(dev))        return -1;    hub->urb->dev = dev;    if (usb_submit_urb(hub->urb, GFP_KERNEL))        return -1;    hub_power_on(hub);    return 0;}
开发者ID:nolenfelten,项目名称:cromwell,代码行数:28,


示例7: lme2510_probe

static int lme2510_probe(struct usb_interface *intf,		const struct usb_device_id *id){	struct usb_device *udev = interface_to_usbdev(intf);	int ret = 0;	usb_reset_configuration(udev);	usb_set_interface(udev, intf->cur_altsetting->desc.bInterfaceNumber, 1);	if (udev->speed != USB_SPEED_HIGH) {		ret = usb_reset_device(udev);		info("DEV Failed to connect in HIGH SPEED mode");		return -ENODEV;	}	lme_firmware_switch(udev, 0);	if (0 == dvb_usb_device_init(intf, &lme2510_properties,				     THIS_MODULE, NULL, adapter_nr)) {		info("DEV registering device driver");		return 0;	}	if (0 == dvb_usb_device_init(intf, &lme2510c_properties,				     THIS_MODULE, NULL, adapter_nr)) {		info("DEV registering device driver");		return 0;	}	info("DEV lme2510 Error");	return -ENODEV;}
开发者ID:3null,项目名称:fastsocket,代码行数:33,


示例8: tweak_reset_device_cmd

static int tweak_reset_device_cmd(struct urb *urb){	struct usb_ctrlrequest *req;	__u16 value;	__u16 index;	int ret;	req = (struct usb_ctrlrequest *) urb->setup_packet;	value = le16_to_cpu(req->wValue);	index = le16_to_cpu(req->wIndex);	uinfo("reset_device (port %d) to %s/n", index, urb->dev->dev.bus->name);	/* all interfaces should be owned by usbip driver, so just reset it. */	ret = usb_lock_device_for_reset(urb->dev, NULL);	if (ret < 0) {		uerr("lock for reset/n");		return ret;	}	/* try to reset the device */	ret = usb_reset_device(urb->dev);	if (ret < 0)		uerr("device reset/n");	usb_unlock_device(urb->dev);	return ret;}
开发者ID:pjump,项目名称:usbip,代码行数:29,


示例9: if_usb_reset_device

static int if_usb_reset_device(struct if_usb_card *cardp){	struct cmd_ds_802_11_reset *cmd = cardp->ep_out_buf + 4;	int ret;	lbtf_deb_enter(LBTF_DEB_USB);	*(__le32 *)cardp->ep_out_buf = cpu_to_le32(CMD_TYPE_REQUEST);	cmd->hdr.command = cpu_to_le16(CMD_802_11_RESET);	cmd->hdr.size = cpu_to_le16(sizeof(struct cmd_ds_802_11_reset));	cmd->hdr.result = cpu_to_le16(0);	cmd->hdr.seqnum = cpu_to_le16(0x5a5a);	cmd->action = cpu_to_le16(CMD_ACT_HALT);	usb_tx_block(cardp, cardp->ep_out_buf,		     4 + sizeof(struct cmd_ds_802_11_reset), 0);	msleep(100);	ret = usb_reset_device(cardp->udev);	msleep(100);	lbtf_deb_leave_args(LBTF_DEB_USB, "ret %d", ret);	return ret;}
开发者ID:nocl,项目名称:linux-libre,代码行数:25,


示例10: disconnect

static void disconnect(struct usb_interface *intf){    struct net_device *netdev = zd_intf_to_netdev(intf);    struct zd_mac *mac = zd_netdev_mac(netdev);    struct zd_usb *usb = &mac->chip.usb;    /* Either something really bad happened, or we're just dealing with     * a DEVICE_INSTALLER. */    if (netdev == NULL)        return;    dev_dbg_f(zd_usb_dev(usb), "/n");    zd_netdev_disconnect(netdev);    /* Just in case something has gone wrong! */    zd_usb_disable_rx(usb);    zd_usb_disable_int(usb);    /* If the disconnect has been caused by a removal of the     * driver module, the reset allows reloading of the driver. If the     * reset will not be executed here, the upload of the firmware in the     * probe function caused by the reloading of the driver will fail.     */    usb_reset_device(interface_to_usbdev(intf));    zd_netdev_free(netdev);    dev_dbg(&intf->dev, "disconnected/n");}
开发者ID:b3rnik,项目名称:dsl-n55u-bender,代码行数:29,


示例11: usb_stor_port_reset

/* Issue a USB port reset to the device.  But don't do anything if * there's more than one interface in the device, so that other users * are not affected. */int usb_stor_port_reset(struct us_data *us){	int result, rc;	if (test_bit(US_FLIDX_DISCONNECTING, &us->flags)) {		result = -EIO;		US_DEBUGP("No reset during disconnect/n");	} else if (us->pusb_dev->actconfig->desc.bNumInterfaces != 1) {		result = -EBUSY;		US_DEBUGP("Refusing to reset a multi-interface device/n");	} else {		result = rc =			usb_lock_device_for_reset(us->pusb_dev, us->pusb_intf);		if (result < 0) {			US_DEBUGP("unable to lock device for reset: %d/n",					result);		} else {			result = usb_reset_device(us->pusb_dev);			if (rc)				usb_unlock_device(us->pusb_dev);			US_DEBUGP("usb_reset_device returns %d/n", result);		}	}	return result;}
开发者ID:KrisChaplin,项目名称:LRT2x4_v1.0.2.06_GPL_source,代码行数:28,


示例12: usb_hub_reset

static int usb_hub_reset(struct usb_hub *hub){	struct usb_device *dev = hub->dev;	int i;	/* Disconnect any attached devices */	for (i = 0; i < hub->nports; i++) {		if (dev->children[i])			usb_disconnect(&dev->children[i]);	}	/* Attempt to reset the hub */	if (hub->urb)		usb_unlink_urb(hub->urb);	else		return -1;	if (usb_reset_device(dev))		return -1;	if (usb_submit_urb(hub->urb))		return -1;	usb_hub_power_on(hub);	return 0;}
开发者ID:davidbau,项目名称:davej,代码行数:27,


示例13: woal_usb_disconnect

/** *  @brief Free resource and cleanup * *  @param intf		Pointer to usb_interface * *  @return 	   	N/A */static voidwoal_usb_disconnect(struct usb_interface *intf){    struct usb_card_rec *cardp = usb_get_intfdata(intf);    moal_handle *phandle = NULL;    ENTER();    if (!cardp || !cardp->phandle) {        PRINTM(MERROR, "Card or phandle is not valid/n");        LEAVE();        return;    }    phandle = (moal_handle *) cardp->phandle;    /*      * Update Surprise removed to TRUE     *  Free all the URB's allocated     */    phandle->surprise_removed = MTRUE;    /* Unlink and free urb */    woal_usb_free(cardp);    /* Card is removed and we can call wlan_remove_card */    PRINTM(MINFO, "Call remove card/n");    woal_remove_card(cardp);    /* Reset device */    usb_reset_device(cardp->udev);    usb_set_intfdata(intf, NULL);    usb_put_dev(interface_to_usbdev(intf));    kfree(cardp);    LEAVE();    return;}
开发者ID:lshw,项目名称:loongson1-linux-3.0,代码行数:41,


示例14: i2400mu_bus_reset

staticint i2400mu_bus_reset(struct i2400m *i2400m, enum i2400m_reset_type rt){	int result;	struct i2400mu *i2400mu =		container_of(i2400m, struct i2400mu, i2400m);	struct device *dev = i2400m_dev(i2400m);	static const __le32 i2400m_WARM_BOOT_BARKER[4] = {		cpu_to_le32(I2400M_WARM_RESET_BARKER),		cpu_to_le32(I2400M_WARM_RESET_BARKER),		cpu_to_le32(I2400M_WARM_RESET_BARKER),		cpu_to_le32(I2400M_WARM_RESET_BARKER),	};	static const __le32 i2400m_COLD_BOOT_BARKER[4] = {		cpu_to_le32(I2400M_COLD_RESET_BARKER),		cpu_to_le32(I2400M_COLD_RESET_BARKER),		cpu_to_le32(I2400M_COLD_RESET_BARKER),		cpu_to_le32(I2400M_COLD_RESET_BARKER),	};	d_fnstart(3, dev, "(i2400m %p rt %u)/n", i2400m, rt);	if (rt == I2400M_RT_WARM)		result = __i2400mu_send_barker(			i2400mu, i2400m_WARM_BOOT_BARKER,			sizeof(i2400m_WARM_BOOT_BARKER),			i2400mu->endpoint_cfg.bulk_out);	else if (rt == I2400M_RT_COLD)		result = __i2400mu_send_barker(			i2400mu, i2400m_COLD_BOOT_BARKER,			sizeof(i2400m_COLD_BOOT_BARKER),			i2400mu->endpoint_cfg.reset_cold);	else if (rt == I2400M_RT_BUS) {		result = usb_reset_device(i2400mu->usb_dev);		switch (result) {		case 0:		case -EINVAL:			case -ENODEV:		case -ENOENT:		case -ESHUTDOWN:			result = 0;			break;			default:			dev_err(dev, "USB reset failed (%d), giving up!/n",				result);		}	} else {		result = -EINVAL;			BUG();	}	if (result < 0	    && result != -EINVAL		    && rt != I2400M_RT_BUS) {		dev_err(dev, "%s reset failed (%d); trying USB reset/n",			rt == I2400M_RT_WARM ? "warm" : "cold", result);		usb_queue_reset_device(i2400mu->usb_iface);		result = -ENODEV;	}	d_fnend(3, dev, "(i2400m %p rt %u) = %d/n", i2400m, rt, result);	return result;}
开发者ID:mjduddin,项目名称:B14CKB1RD_kernel_m8,代码行数:60,


示例15: mt76x2u_probe

static int mt76x2u_probe(struct usb_interface *intf,			 const struct usb_device_id *id){	struct usb_device *udev = interface_to_usbdev(intf);	struct mt76x02_dev *dev;	int err;	dev = mt76x2u_alloc_device(&intf->dev);	if (!dev)		return -ENOMEM;	udev = usb_get_dev(udev);	usb_reset_device(udev);	mt76x02u_init_mcu(&dev->mt76);	err = mt76u_init(&dev->mt76, intf);	if (err < 0)		goto err;	dev->mt76.rev = mt76_rr(dev, MT_ASIC_VERSION);	dev_info(dev->mt76.dev, "ASIC revision: %08x/n", dev->mt76.rev);	err = mt76x2u_register_device(dev);	if (err < 0)		goto err;	return 0;err:	ieee80211_free_hw(mt76_hw(dev));	usb_set_intfdata(intf, NULL);	usb_put_dev(udev);	return err;}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:35,


示例16: prism2_usb_cor_sreset

static void prism2_usb_cor_sreset(local_info_t *local){	struct hostap_usb_priv *hw_priv = local->hw_priv;	printk(KERN_INFO "%s: resetting device %p/n", dev_info, hw_priv->usb);	usb_reset_device(hw_priv->usb);}
开发者ID:lumag,项目名称:HostAP-USB,代码行数:7,


示例17: i2400mu_bus_reset

/* * Reset a device at different levels (warm, cold or bus) * * @i2400m: device descriptor * @reset_type: soft, warm or bus reset (I2400M_RT_WARM/SOFT/BUS) * * Warm and cold resets get a USB reset if they fail. * * Warm reset: * * The device will be fully reset internally, but won't be * disconnected from the USB bus (so no reenumeration will * happen). Firmware upload will be neccessary. * * The device will send a reboot barker in the notification endpoint * that will trigger the driver to reinitialize the state * automatically from notif.c:i2400m_notification_grok() into * i2400m_dev_bootstrap_delayed(). * * Cold and bus (USB) reset: * * The device will be fully reset internally, disconnected from the * USB bus an a reenumeration will happen. Firmware upload will be * neccessary. Thus, we don't do any locking or struct * reinitialization, as we are going to be fully disconnected and * reenumerated. * * Note we need to return -ENODEV if a warm reset was requested and we * had to resort to a bus reset. See i2400m_op_reset(), wimax_reset() * and wimax_dev->op_reset. * * WARNING: no driver state saved/fixed */staticint i2400mu_bus_reset(struct i2400m *i2400m, enum i2400m_reset_type rt){	int result;	struct i2400mu *i2400mu =		container_of(i2400m, struct i2400mu, i2400m);	struct device *dev = i2400m_dev(i2400m);	static const __le32 i2400m_WARM_BOOT_BARKER[4] = {		cpu_to_le32(I2400M_WARM_RESET_BARKER),		cpu_to_le32(I2400M_WARM_RESET_BARKER),		cpu_to_le32(I2400M_WARM_RESET_BARKER),		cpu_to_le32(I2400M_WARM_RESET_BARKER),	};	static const __le32 i2400m_COLD_BOOT_BARKER[4] = {		cpu_to_le32(I2400M_COLD_RESET_BARKER),		cpu_to_le32(I2400M_COLD_RESET_BARKER),		cpu_to_le32(I2400M_COLD_RESET_BARKER),		cpu_to_le32(I2400M_COLD_RESET_BARKER),	};	d_fnstart(3, dev, "(i2400m %p rt %u)/n", i2400m, rt);	if (rt == I2400M_RT_WARM)		result = __i2400mu_send_barker(i2400mu, i2400m_WARM_BOOT_BARKER,					       sizeof(i2400m_WARM_BOOT_BARKER),					       I2400MU_EP_BULK_OUT);	else if (rt == I2400M_RT_COLD)		result = __i2400mu_send_barker(i2400mu, i2400m_COLD_BOOT_BARKER,					       sizeof(i2400m_COLD_BOOT_BARKER),					       I2400MU_EP_RESET_COLD);	else if (rt == I2400M_RT_BUS) {do_bus_reset:		result = usb_reset_device(i2400mu->usb_dev);		switch (result) {		case 0:		case -EINVAL:	/* device is gone */		case -ENODEV:		case -ENOENT:		case -ESHUTDOWN:			result = rt == I2400M_RT_WARM ? -ENODEV : 0;			break;	/* We assume the device is disconnected */		default:			dev_err(dev, "USB reset failed (%d), giving up!/n",				result);		}	} else {		result = -EINVAL;	/* shut gcc up in certain arches */		BUG();	}	if (result < 0	    && result != -EINVAL	/* device is gone */	    && rt != I2400M_RT_BUS) {		dev_err(dev, "%s reset failed (%d); trying USB reset/n",			rt == I2400M_RT_WARM ? "warm" : "cold", result);		rt = I2400M_RT_BUS;		goto do_bus_reset;	}	d_fnend(3, dev, "(i2400m %p rt %u) = %d/n", i2400m, rt, result);	return result;}
开发者ID:325116067,项目名称:semc-qsd8x50,代码行数:92,


示例18: usb_device_reset

static void usb_device_reset(struct vnt_private *pDevice){ int status; status = usb_reset_device(pDevice->usb);	if (status)            printk("usb_device_reset fail status=%d/n",status);	return ;}
开发者ID:IDM350,项目名称:linux,代码行数:8,


示例19: usb_device_reset

static void usb_device_reset(struct vnt_private *priv){	int status;	status = usb_reset_device(priv->usb);	if (status)		dev_warn(&priv->usb->dev,			 "usb_device_reset fail status=%d/n", status);}
开发者ID:513855417,项目名称:linux,代码行数:9,


示例20: carl9170_usb_probe

static int carl9170_usb_probe(struct usb_interface *intf,			      const struct usb_device_id *id){	struct ar9170 *ar;	struct usb_device *udev;	int err;	err = usb_reset_device(interface_to_usbdev(intf));	if (err)		return err;	ar = carl9170_alloc(sizeof(*ar));	if (IS_ERR(ar))		return PTR_ERR(ar);	udev = interface_to_usbdev(intf);	usb_get_dev(udev);	ar->udev = udev;	ar->intf = intf;	ar->features = id->driver_info;	usb_set_intfdata(intf, ar);	SET_IEEE80211_DEV(ar->hw, &intf->dev);	init_usb_anchor(&ar->rx_anch);	init_usb_anchor(&ar->rx_pool);	init_usb_anchor(&ar->rx_work);	init_usb_anchor(&ar->tx_wait);	init_usb_anchor(&ar->tx_anch);	init_usb_anchor(&ar->tx_cmd);	init_usb_anchor(&ar->tx_err);	init_completion(&ar->cmd_wait);	init_completion(&ar->fw_boot_wait);	init_completion(&ar->fw_load_wait);	tasklet_init(&ar->usb_tasklet, carl9170_usb_tasklet,		     (unsigned long)ar);	atomic_set(&ar->tx_cmd_urbs, 0);	atomic_set(&ar->tx_anch_urbs, 0);	atomic_set(&ar->rx_work_urbs, 0);	atomic_set(&ar->rx_anch_urbs, 0);	atomic_set(&ar->rx_pool_urbs, 0);	usb_get_dev(ar->udev);	carl9170_set_state(ar, CARL9170_STOPPED);	err = request_firmware_nowait(THIS_MODULE, 1, CARL9170FW_NAME,		&ar->udev->dev, GFP_KERNEL, ar, carl9170_usb_firmware_step2);	if (err) {		usb_put_dev(udev);		usb_put_dev(udev);		carl9170_free(ar);	}	return err;}
开发者ID:MaxChina,项目名称:linux,代码行数:56,


示例21: mts_scsi_host_reset

static int mts_scsi_host_reset (Scsi_Cmnd *srb){	struct mts_desc* desc = (struct mts_desc*)(srb->host->hostdata[0]);	MTS_DEBUG_GOT_HERE();	mts_debug_dump(desc);	usb_reset_device(desc->usb_dev); /*FIXME: untested on new reset code */	return 0;  /* RANT why here 0 and not SUCCESS */}
开发者ID:fgeraci,项目名称:cs518-sched,代码行数:10,


示例22: mt7601u_probe

static int mt7601u_probe(struct usb_interface *usb_intf,			 const struct usb_device_id *id){	struct usb_device *usb_dev = interface_to_usbdev(usb_intf);	struct mt7601u_dev *dev;	u32 asic_rev, mac_rev;	int ret;	dev = mt7601u_alloc_device(&usb_intf->dev);	if (!dev)		return -ENOMEM;	usb_dev = usb_get_dev(usb_dev);	usb_reset_device(usb_dev);	usb_set_intfdata(usb_intf, dev);	ret = mt7601u_assign_pipes(usb_intf, dev);	if (ret)		goto err;	ret = mt7601u_wait_asic_ready(dev);	if (ret)		goto err;	asic_rev = mt7601u_rr(dev, MT_ASIC_VERSION);	mac_rev = mt7601u_rr(dev, MT_MAC_CSR0);	dev_info(dev->dev, "ASIC revision: %08x MAC revision: %08x/n",		 asic_rev, mac_rev);	/* Note: vendor driver skips this check for MT7601U */	if (!(mt7601u_rr(dev, MT_EFUSE_CTRL) & MT_EFUSE_CTRL_SEL))		dev_warn(dev->dev, "Warning: eFUSE not present/n");	ret = mt7601u_init_hardware(dev);	if (ret)		goto err;	ret = mt7601u_register_device(dev);	if (ret)		goto err_hw;	set_bit(MT7601U_STATE_INITIALIZED, &dev->state);	return 0;err_hw:	mt7601u_cleanup(dev);err:	usb_set_intfdata(usb_intf, NULL);	usb_put_dev(interface_to_usbdev(usb_intf));	destroy_workqueue(dev->stat_wq);	ieee80211_free_hw(dev->hw);	return ret;}
开发者ID:Kirill2013,项目名称:kasan,代码行数:53,


示例23: m5632_recover

static void m5632_recover(struct usbnet *dev){	struct usb_device	*udev = dev->udev;	struct usb_interface	*intf = dev->intf;	int r;	r = usb_lock_device_for_reset(udev, intf);	if (r < 0)		return;	usb_reset_device(udev);	usb_unlock_device(udev);}
开发者ID:avagin,项目名称:linux,代码行数:13,


示例24: mts_scsi_host_reset

static int mts_scsi_host_reset(struct scsi_cmnd *srb){	struct mts_desc* desc = (struct mts_desc*)(srb->device->host->hostdata[0]);	int result;	MTS_DEBUG_GOT_HERE();	mts_debug_dump(desc);	result = usb_lock_device_for_reset(desc->usb_dev, desc->usb_intf);	if (result == 0) {		result = usb_reset_device(desc->usb_dev);		usb_unlock_device(desc->usb_dev);	}	return result ? FAILED : SUCCESS;}
开发者ID:ANFS,项目名称:ANFS-kernel,代码行数:15,


示例25: pcan_usb_plugout

static void pcan_usb_plugout(struct usb_interface *interface){	struct pcan_usb_interface *usb_if = usb_get_intfdata(interface);	if (usb_if)	{		int c;		struct pcandev *dev;		for (dev=&usb_if->dev[c=0]; c < usb_if->dev_ctrl_count; c++, dev++)		{			DPRINTK(KERN_DEBUG "%s: %s(%d)/n", 			        DEVICE_NAME, __FUNCTION__, dev->nMinor);#ifdef NETDEV_SUPPORT			pcan_usb_plugout_netdev(dev);#endif			// mark this device as plugged out			dev->ucPhysicallyInstalled = 0;			// do not remove resources if the device is still in use			if (!dev->nOpenPaths)				pcan_usb_cleanup(dev);			pcan_kill_sync_urb(&dev->port.usb.write_data);			interface->minor = dev->nMinor;			usb_deregister_dev(interface, &pcan_class);		}		pcan_kill_sync_urb(&usb_if->urb_cmd_sync);		pcan_kill_sync_urb(&usb_if->urb_cmd_async);		pcan_kill_sync_urb(&usb_if->read_data);		kfree(usb_if->read_buffer_addr[0]);		if (usb_if->device_free)			usb_if->device_free(usb_if);		usb_reset_device(usb_if->usb_dev);		kfree(usb_if);		usb_set_intfdata(interface, NULL);	}}
开发者ID:ESE519,项目名称:LemonAid,代码行数:47,


示例26: libertas_do_reset

static int libertas_do_reset(wlan_private *priv){	int ret;	struct usb_card_rec *cardp = priv->card;	lbs_deb_enter(LBS_DEB_USB);	ret = usb_reset_device(cardp->udev);	if (!ret) {		msleep(10);		if_usb_reset_device(priv);		msleep(10);	}	lbs_deb_leave_args(LBS_DEB_USB, "ret %d", ret);	return ret;}
开发者ID:3sOx,项目名称:asuswrt-merlin,代码行数:18,


示例27: process_resetdev_request

static int process_resetdev_request(struct usb_serial_port *port){	unsigned long flags;	int status;	struct garmin_data *garmin_data_p = usb_get_serial_port_data(port);	spin_lock_irqsave(&garmin_data_p->lock, flags);	garmin_data_p->flags &= ~(CLEAR_HALT_REQUIRED);	garmin_data_p->state = STATE_RESET;	garmin_data_p->serial_num = 0;	spin_unlock_irqrestore(&garmin_data_p->lock, flags);	usb_kill_urb(port->interrupt_in_urb);	dev_dbg(&port->dev, "%s - usb_reset_device/n", __func__);	status = usb_reset_device(port->serial->dev);	if (status)		dev_dbg(&port->dev, "%s - usb_reset_device failed: %d/n",			__func__, status);	return status;}
开发者ID:AeroGirl,项目名称:VAR-SOM-AM33-SDK7-Kernel,代码行数:20,


示例28: hid_reset

/* Workqueue routine to reset the device or clear a halt */static void hid_reset(struct work_struct *work){	struct usbhid_device *usbhid =		container_of(work, struct usbhid_device, reset_work);	struct hid_device *hid = usbhid->hid;	int rc = 0;	if (test_bit(HID_CLEAR_HALT, &usbhid->iofl)) {		dev_dbg(&usbhid->intf->dev, "clear halt/n");		rc = usb_clear_halt(hid_to_usb_dev(hid), usbhid->urbin->pipe);		clear_bit(HID_CLEAR_HALT, &usbhid->iofl);		hid_start_in(hid);	}	else if (test_bit(HID_RESET_PENDING, &usbhid->iofl)) {		dev_dbg(&usbhid->intf->dev, "resetting device/n");		rc = usb_lock_device_for_reset(hid_to_usb_dev(hid), usbhid->intf);		if (rc == 0) {			rc = usb_reset_device(hid_to_usb_dev(hid));			usb_unlock_device(hid_to_usb_dev(hid));		}		clear_bit(HID_RESET_PENDING, &usbhid->iofl);	}	switch (rc) {	case 0:		if (!test_bit(HID_IN_RUNNING, &usbhid->iofl))			hid_io_error(hid);		break;	default:		hid_err(hid, "can't reset device, %s-%s/input%d, status %d/n",			hid_to_usb_dev(hid)->bus->bus_name,			hid_to_usb_dev(hid)->devpath,			usbhid->ifnum, rc);		/* FALLTHROUGH */	case -EHOSTUNREACH:	case -ENODEV:	case -EINTR:		break;	}}
开发者ID:onenonlycasper,项目名称:tf700t_kernel,代码行数:42,


示例29: usb_stor_port_reset

//----- usb_stor_port_reset() ---------------------int usb_stor_port_reset(struct us_data *us){	int result;	//printk("transport --- usb_stor_port_reset/n");	result = usb_lock_device_for_reset(us->pusb_dev, us->pusb_intf);	if (result < 0)		printk("unable to lock device for reset: %d/n", result);	else {		/* Were we disconnected while waiting for the lock? */		if (test_bit(US_FLIDX_DISCONNECTING, &us->dflags)) {			result = -EIO;			//printk("No reset during disconnect/n");		} else {			result = usb_reset_device(us->pusb_dev);			//printk("usb_reset_composite_device returns %d/n", result);		}		usb_unlock_device(us->pusb_dev);	}	return result;}
开发者ID:ANFS,项目名称:ANFS-kernel,代码行数:22,



注:本文中的usb_reset_device函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ usb_resume函数代码示例
C++ usb_release_interface函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。