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

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

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

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

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

示例1: ipw_release

static void ipw_release(struct usb_serial *serial){	struct usb_wwan_intf_private *data = usb_get_serial_data(serial);	usb_set_serial_data(serial, NULL);	kfree(data);}
开发者ID:AD5GB,项目名称:kernel_n5_3.10-experimental,代码行数:7,


示例2: spcp8x5_probe

static int spcp8x5_probe(struct usb_serial *serial,						const struct usb_device_id *id){	usb_set_serial_data(serial, (void *)id);	return 0;}
开发者ID:kdave,项目名称:btrfs-devel,代码行数:7,


示例3: qt2_attach

static int qt2_attach(struct usb_serial *serial){	struct qt2_serial_private *serial_priv;	int status;	/* power on unit */	status = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),				 0xc2, 0x40, 0x8000, 0, NULL, 0,				 QT2_USB_TIMEOUT);	if (status < 0) {		dev_err(&serial->dev->dev,			"%s - failed to power on unit: %i/n", __func__, status);		return status;	}	serial_priv = kzalloc(sizeof(*serial_priv), GFP_KERNEL);	if (!serial_priv) {		dev_err(&serial->dev->dev, "%s - Out of memory/n", __func__);		return -ENOMEM;	}	usb_set_serial_data(serial, serial_priv);	status = qt2_setup_urbs(serial);	if (status != 0)		goto attach_failed;	return 0;attach_failed:	kfree(serial_priv);	return status;}
开发者ID:CoerWatt,项目名称:linux,代码行数:33,


示例4: qc_release

static void qc_release(struct usb_serial *serial){	struct usb_wwan_intf_private *priv = usb_get_serial_data(serial);	/* Free the private data allocated in qcprobe */	usb_set_serial_data(serial, NULL);	kfree(priv);}
开发者ID:ashang,项目名称:xpenology-3.x,代码行数:8,


示例5: mxu1_startup

static int mxu1_startup(struct usb_serial *serial){	struct mxu1_device *mxdev;	struct usb_device *dev = serial->dev;	struct usb_host_interface *cur_altsetting;	char fw_name[32];	const struct firmware *fw_p = NULL;	int err;	dev_dbg(&dev->dev, "%s - product 0x%4X, num configurations %d, configuration value %d/n",		__func__, le16_to_cpu(dev->descriptor.idProduct),		dev->descriptor.bNumConfigurations,		dev->actconfig->desc.bConfigurationValue);	/* create device structure */	mxdev = kzalloc(sizeof(struct mxu1_device), GFP_KERNEL);	if (mxdev == NULL)		return -ENOMEM;	mutex_init(&mxdev->mxd_lock);	mxdev->mxd_serial = serial;	usb_set_serial_data(serial, mxdev);	mxdev->mxd_model = le16_to_cpu(dev->descriptor.idProduct);	cur_altsetting = serial->interface->cur_altsetting;	/* if we have only 1 configuration, download firmware */	if (cur_altsetting->desc.bNumEndpoints == 1) {		snprintf(fw_name,			 sizeof(fw_name),			 "moxa/moxa-%04x.fw",			 mxdev->mxd_model);		err = request_firmware(&fw_p, fw_name, &serial->interface->dev);		if (err) {			dev_err(&serial->interface->dev, "firmware %s not found/n",				fw_name);			kfree(mxdev);			return err;		}		err = mxu1_download_firmware(serial, fw_p);		if (err) {			kfree(mxdev);			return err;		}		release_firmware(fw_p);	}	return 0;}
开发者ID:efferre79,项目名称:mxu11x0,代码行数:54,


示例6: opticon_shutdown

static void opticon_shutdown(struct usb_serial *serial){	struct opticon_private *priv = usb_get_serial_data(serial);	dbg("%s", __func__);	usb_kill_urb(priv->bulk_read_urb);	usb_free_urb(priv->bulk_read_urb);	kfree(priv->bulk_in_buffer);	kfree(priv);	usb_set_serial_data(serial, NULL);}
开发者ID:artm1248,项目名称:linux,代码行数:12,


示例7: ipw_attach

static int ipw_attach(struct usb_serial *serial){	struct usb_wwan_intf_private *data;	data = kzalloc(sizeof(struct usb_wwan_intf_private), GFP_KERNEL);	if (!data)		return -ENOMEM;	spin_lock_init(&data->susp_lock);	usb_set_serial_data(serial, data);	return 0;}
开发者ID:AD5GB,项目名称:kernel_n5_3.10-experimental,代码行数:12,


示例8: pl2303_startup

static int pl2303_startup(struct usb_serial *serial){	struct pl2303_serial_private *spriv;	enum pl2303_type type = type_0;	unsigned char *buf;	spriv = kzalloc(sizeof(*spriv), GFP_KERNEL);	if (!spriv)		return -ENOMEM;	buf = kmalloc(10, GFP_KERNEL);	if (!buf) {		kfree(spriv);		return -ENOMEM;	}	if (serial->dev->descriptor.bDeviceClass == 0x02)		type = type_0;	else if (serial->dev->descriptor.bMaxPacketSize0 == 0x40)		type = HX;	else if (serial->dev->descriptor.bDeviceClass == 0x00)		type = type_1;	else if (serial->dev->descriptor.bDeviceClass == 0xFF)		type = type_1;	dev_dbg(&serial->interface->dev, "device type: %d/n", type);	spriv->type = type;	usb_set_serial_data(serial, spriv);	pl2303_vendor_read(0x8484, 0, serial, buf);	pl2303_vendor_write(0x0404, 0, serial);	pl2303_vendor_read(0x8484, 0, serial, buf);	pl2303_vendor_read(0x8383, 0, serial, buf);	pl2303_vendor_read(0x8484, 0, serial, buf);	pl2303_vendor_write(0x0404, 1, serial);	pl2303_vendor_read(0x8484, 0, serial, buf);	pl2303_vendor_read(0x8383, 0, serial, buf);	pl2303_vendor_write(0, 1, serial);	pl2303_vendor_write(1, 0, serial);	if (type == HX)		pl2303_vendor_write(2, 0x44, serial);	else		pl2303_vendor_write(2, 0x24, serial);	kfree(buf);	return 0;}
开发者ID:daltenty,项目名称:kernel-ubuntu.trusty-vgt,代码行数:47,


示例9: qc_attach

static int qc_attach(struct usb_serial *serial){	struct usb_wwan_intf_private *data;	bool sendsetup;	data = kzalloc(sizeof(*data), GFP_KERNEL);	if (!data)		return -ENOMEM;	sendsetup = !!(unsigned long)(usb_get_serial_data(serial));	if (sendsetup)		data->use_send_setup = 1;	spin_lock_init(&data->susp_lock);	usb_set_serial_data(serial, data);	return 0;}
开发者ID:Codefollows,项目名称:ps4-linux,代码行数:19,


示例10: modem_release

static void modem_release(struct usb_serial *serial){	struct modem_port *modem_port_ptr =	usb_get_serial_data(serial);	int i;	modem_write_buffers_free(modem_port_ptr, serial);	modem_read_buffers_free(modem_port_ptr, serial);	for (i = 0; i < AP_NW; i++)		usb_free_urb(modem_port_ptr->wb[i].urb);	for (i = 0; i < modem_port_ptr->rx_buflimit; i++)		usb_free_urb(modem_port_ptr->ru[i].urb);	if (modem_port_ptr) {		/* free private structure allocated for serial device */		kfree(modem_port_ptr);		usb_set_serial_data(serial, NULL);	}}
开发者ID:Atrix-Dev-Team,项目名称:kernel-MB860,代码行数:21,


示例11: sierra_startup

static int sierra_startup(struct usb_serial *serial){	struct sierra_intf_private *intfdata;	intfdata = kzalloc(sizeof(*intfdata), GFP_KERNEL);	if (!intfdata)		return -ENOMEM;	spin_lock_init(&intfdata->susp_lock);	usb_set_serial_data(serial, intfdata);	/* Set Device mode to D0 */	sierra_set_power_state(serial->dev, 0x0000);	/* Check NMEA and set */	if (nmea)		sierra_vsc_set_nmea(serial->dev, 1);	return 0;}
开发者ID:asmalldev,项目名称:linux,代码行数:21,


示例12: hsic_s_probe

static int hsic_s_probe(struct usb_serial *serial,			const struct usb_device_id *id){	struct hsictty_intf_private *spriv;	spriv = kzalloc(sizeof(struct hsictty_intf_private), GFP_KERNEL);	if (!spriv)		return -ENOMEM;	spin_lock_init(&spriv->susp_lock);	sema_init(&spriv->handshake_sem, 1);	spriv->channel_open_flag = 0;	spriv->multi_channel_mode = 0;	spriv->support_pm = 1;	usb_disable_autosuspend(serial->dev);	wake_lock_init(&spriv->tx_wakelock, WAKE_LOCK_SUSPEND, "hsic_tx");	wake_lock_init(&spriv->rx_wakelock, WAKE_LOCK_SUSPEND, "hsic_rx");#ifdef USE_READ_WORK	spriv->hsictty_read_wq = create_workqueue("hsic tty task");	if (!spriv->hsictty_read_wq) {		hsictty_error("%s: can't create workqueue/n", __func__);		return -EINVAL;	}#endif#ifdef BACKUP_DATA_DUMP	backup_queue_init();	dumped = 0;#endif	usb_set_serial_data(serial, spriv);	return 0;}
开发者ID:qkdang,项目名称:m462,代码行数:36,


示例13: qcprobe

//.........这里部分代码省略.........		case 1:			dev_dbg(dev, "Gobi 2K+ DM/DIAG interface found/n");			break;		case 2:			dev_dbg(dev, "Modem port found/n");			break;		case 3:			/*			 * NMEA (serial line 9600 8N1)			 * # echo "/$GPS_START" > /dev/ttyUSBx			 * # echo "/$GPS_STOP"  > /dev/ttyUSBx			 */			dev_dbg(dev, "Gobi 2K+ NMEA GPS interface found/n");			break;		}		break;	case QCSERIAL_SWI:		/*		 * Sierra Wireless layout:		 * 0: DM/DIAG (use libqcdm from ModemManager for communication)		 * 2: NMEA		 * 3: AT-capable modem port		 * 8: QMI/net		 */		switch (ifnum) {		case 0:			dev_dbg(dev, "DM/DIAG interface found/n");			break;		case 2:			dev_dbg(dev, "NMEA GPS interface found/n");			break;		case 3:			dev_dbg(dev, "Modem port found/n");			sendsetup = true;			break;		default:			/* don't claim any unsupported interface */			altsetting = -1;			break;		}		break;	case QCSERIAL_HWI:		/*		 * Huawei devices map functions by subclass + protocol		 * instead of interface numbers. The protocol identify		 * a specific function, while the subclass indicate a		 * specific firmware source		 *		 * This is a blacklist of functions known to be		 * non-serial.  The rest are assumed to be serial and		 * will be handled by this driver		 */		switch (intf->desc.bInterfaceProtocol) {			/* QMI combined (qmi_wwan) */		case 0x07:		case 0x37:		case 0x67:			/* QMI data (qmi_wwan) */		case 0x08:		case 0x38:		case 0x68:			/* QMI control (qmi_wwan) */		case 0x09:		case 0x39:		case 0x69:			/* NCM like (huawei_cdc_ncm) */		case 0x16:		case 0x46:		case 0x76:			altsetting = -1;			break;		default:			dev_dbg(dev, "Huawei type serial port found (%02x/%02x/%02x)/n",				intf->desc.bInterfaceClass,				intf->desc.bInterfaceSubClass,				intf->desc.bInterfaceProtocol);		}		break;	default:		dev_err(dev, "unsupported device layout type: %lu/n",			id->driver_info);		break;	}done:	if (altsetting >= 0) {		retval = usb_set_interface(serial->dev, ifnum, altsetting);		if (retval < 0) {			dev_err(dev,				"Could not set interface, error %d/n",				retval);			retval = -ENODEV;		}	}	if (!retval)		usb_set_serial_data(serial, (void *)(unsigned long)sendsetup);	return retval;}
开发者ID:Codefollows,项目名称:ps4-linux,代码行数:101,


示例14: symbol_startup

static int symbol_startup(struct usb_serial *serial){	struct symbol_private *priv;	struct usb_host_interface *intf;	int i;	int retval = -ENOMEM;	bool int_in_found = false;	/* create our private serial structure */	priv = kzalloc(sizeof(*priv), GFP_KERNEL);	if (priv == NULL) {		dev_err(&serial->dev->dev, "%s - Out of memory/n", __func__);		return -ENOMEM;	}	spin_lock_init(&priv->lock);	priv->serial = serial;	priv->port = serial->port[0];	priv->udev = serial->dev;	/* find our interrupt endpoint */	intf = serial->interface->altsetting;	for (i = 0; i < intf->desc.bNumEndpoints; ++i) {		struct usb_endpoint_descriptor *endpoint;		endpoint = &intf->endpoint[i].desc;		if (!usb_endpoint_is_int_in(endpoint))			continue;		priv->int_urb = usb_alloc_urb(0, GFP_KERNEL);		if (!priv->int_urb) {			dev_err(&priv->udev->dev, "out of memory/n");			goto error;		}		priv->buffer_size = usb_endpoint_maxp(endpoint) * 2;		priv->int_buffer = kmalloc(priv->buffer_size, GFP_KERNEL);		if (!priv->int_buffer) {			dev_err(&priv->udev->dev, "out of memory/n");			goto error;		}		priv->int_address = endpoint->bEndpointAddress;		priv->bInterval = endpoint->bInterval;		/* set up our int urb */		usb_fill_int_urb(priv->int_urb, priv->udev,				 usb_rcvintpipe(priv->udev,				 		endpoint->bEndpointAddress),				 priv->int_buffer, priv->buffer_size,				 symbol_int_callback, priv, priv->bInterval);		int_in_found = true;		break;		}	if (!int_in_found) {		dev_err(&priv->udev->dev,			"Error - the proper endpoints were not found!/n");		goto error;	}	usb_set_serial_data(serial, priv);	return 0;error:	usb_free_urb(priv->int_urb);	kfree(priv->int_buffer);	kfree(priv);	return retval;}
开发者ID:matsufan,项目名称:linux,代码行数:70,


示例15: pl2303_startup

static int pl2303_startup(struct usb_serial *serial){	struct pl2303_serial_private *spriv;	enum pl2303_type type = type_0;	char *type_str = "unknown (treating as type_0)";	unsigned char *buf;	spriv = kzalloc(sizeof(*spriv), GFP_KERNEL);	if (!spriv)		return -ENOMEM;	buf = kmalloc(10, GFP_KERNEL);	if (!buf) {		kfree(spriv);		return -ENOMEM;	}	if (serial->dev->descriptor.bDeviceClass == 0x02) {		type = type_0;		type_str = "type_0";	} else if (serial->dev->descriptor.bMaxPacketSize0 == 0x40) {		/*		 * NOTE: The bcdDevice version is the only difference between		 * the device descriptors of the X/HX, HXD, EA, RA, SA, TA, TB		 */		if (le16_to_cpu(serial->dev->descriptor.bcdDevice) == 0x300) {			type = HX_TA;			type_str = "X/HX/TA";		} else if (le16_to_cpu(serial->dev->descriptor.bcdDevice)								     == 0x400) {			type = HXD_EA_RA_SA;			type_str = "HXD/EA/RA/SA";		} else if (le16_to_cpu(serial->dev->descriptor.bcdDevice)								     == 0x500) {			type = TB;			type_str = "TB";		} else {			dev_info(&serial->interface->dev,					   "unknown/unsupported device type/n");			kfree(spriv);			kfree(buf);			return -ENODEV;		}	} else if (serial->dev->descriptor.bDeviceClass == 0x00		   || serial->dev->descriptor.bDeviceClass == 0xFF) {		type = type_1;		type_str = "type_1";	}	dev_dbg(&serial->interface->dev, "device type: %s/n", type_str);	spriv->type = type;	usb_set_serial_data(serial, spriv);	pl2303_vendor_read(0x8484, 0, serial, buf);	pl2303_vendor_write(0x0404, 0, serial);	pl2303_vendor_read(0x8484, 0, serial, buf);	pl2303_vendor_read(0x8383, 0, serial, buf);	pl2303_vendor_read(0x8484, 0, serial, buf);	pl2303_vendor_write(0x0404, 1, serial);	pl2303_vendor_read(0x8484, 0, serial, buf);	pl2303_vendor_read(0x8383, 0, serial, buf);	pl2303_vendor_write(0, 1, serial);	pl2303_vendor_write(1, 0, serial);	if (type == type_0 || type == type_1)		pl2303_vendor_write(2, 0x24, serial);	else		pl2303_vendor_write(2, 0x44, serial);	kfree(buf);	return 0;}
开发者ID:IIosTaJI,项目名称:linux-2.6,代码行数:71,


示例16: qcprobe

//.........这里部分代码省略.........		return -ENOMEM;	spin_lock_init(&data->susp_lock);		if (!(board_mfg_mode() == 8 || board_mfg_mode() == 6 || board_mfg_mode() == 2))			usb_enable_autosuspend(serial->dev);	switch (nintf) {	case 1:						if (serial->interface->num_altsetting == 2)			intf = &serial->interface->altsetting[1];		else if (serial->interface->num_altsetting > 2)			break;		if (intf->desc.bNumEndpoints == 2 &&		    usb_endpoint_is_bulk_in(&intf->endpoint[0].desc) &&		    usb_endpoint_is_bulk_out(&intf->endpoint[1].desc)) {			dbg("QDL port found");			if (serial->interface->num_altsetting == 1) {				retval = 0; 				break;			}			retval = usb_set_interface(serial->dev, ifnum, 1);			if (retval < 0) {				dev_err(&serial->dev->dev,					"Could not set interface, error %d/n",					retval);				retval = -ENODEV;				kfree(data);			}		}		break;	case 3:	case 4:		if (ifnum == 1 && !is_gobi1k) {			dbg("Gobi 2K+ DM/DIAG interface found");			retval = usb_set_interface(serial->dev, ifnum, 0);			if (retval < 0) {				dev_err(&serial->dev->dev,					"Could not set interface, error %d/n",					retval);				retval = -ENODEV;				kfree(data);			}		} else if (ifnum == 2) {			dbg("Modem port found");			retval = usb_set_interface(serial->dev, ifnum, 0);			if (retval < 0) {				dev_err(&serial->dev->dev,					"Could not set interface, error %d/n",					retval);				retval = -ENODEV;				kfree(data);			}		} else if (ifnum==3 && !is_gobi1k) {			dbg("Gobi 2K+ NMEA GPS interface found");			retval = usb_set_interface(serial->dev, ifnum, 0);			if (retval < 0) {				dev_err(&serial->dev->dev,					"Could not set interface, error %d/n",					retval);				retval = -ENODEV;				kfree(data);			}		}		break;	case 9:				if (get_radio_flag() & 0x20000)		usb_diag_enable = true;				if (ifnum != EFS_SYNC_IFC_NUM && !(!usb_diag_enable && ifnum == DUN_IFC_NUM && (board_mfg_mode() == 8 || board_mfg_mode() == 6 || board_mfg_mode() == 2))) { 			kfree(data);			break;		}		retval = 0;		break;	default:		dev_err(&serial->dev->dev,			"unknown number of interfaces: %d/n", nintf);		kfree(data);		retval = -ENODEV;	}		if (retval != -ENODEV)		usb_set_serial_data(serial, data);	return retval;}
开发者ID:boa19861105,项目名称:Killx-Kernel,代码行数:101,


示例17: opticon_startup

static int opticon_startup(struct usb_serial *serial){	struct opticon_private *priv;	struct usb_host_interface *intf;	int i;	int retval = -ENOMEM;	bool bulk_in_found = false;	/* create our private serial structure */	priv = kzalloc(sizeof(*priv), GFP_KERNEL);	if (priv == NULL) {		dev_err(&serial->dev->dev, "%s - Out of memory/n", __func__);		return -ENOMEM;	}	spin_lock_init(&priv->lock);	priv->serial = serial;	priv->port = serial->port[0];	priv->udev = serial->dev;	priv->outstanding_urbs = 0;	/* Init the outstanding urbs */	/* find our bulk endpoint */	intf = serial->interface->altsetting;	for (i = 0; i < intf->desc.bNumEndpoints; ++i) {		struct usb_endpoint_descriptor *endpoint;		endpoint = &intf->endpoint[i].desc;		if (!usb_endpoint_is_bulk_in(endpoint))			continue;		priv->bulk_read_urb = usb_alloc_urb(0, GFP_KERNEL);		if (!priv->bulk_read_urb) {			dev_err(&priv->udev->dev, "out of memory/n");			goto error;		}		priv->buffer_size = usb_endpoint_maxp(endpoint) * 2;		priv->bulk_in_buffer = kmalloc(priv->buffer_size, GFP_KERNEL);		if (!priv->bulk_in_buffer) {			dev_err(&priv->udev->dev, "out of memory/n");			goto error;		}		priv->bulk_address = endpoint->bEndpointAddress;		bulk_in_found = true;		break;		}	if (!bulk_in_found) {		dev_err(&priv->udev->dev,			"Error - the proper endpoints were not found!/n");		goto error;	}	usb_set_serial_data(serial, priv);	return 0;error:	usb_free_urb(priv->bulk_read_urb);	kfree(priv->bulk_in_buffer);	kfree(priv);	return retval;}
开发者ID:openube,项目名称:android_kernel_sony_c2305,代码行数:63,


示例18: modem_startup

//.........这里部分代码省略.........	}	/* allocate multiple receive urb pool */	for (i = 0; i < num_rx_buf; i++) {		struct ap_ru *rcv = &(modem_port_ptr->ru[i]);		rcv->urb = usb_alloc_urb(0, GFP_KERNEL);		if (rcv->urb == NULL) {			dev_err(&serial->dev->dev,				"%s: out of memory/n", __func__);			goto alloc_rb_urb_fail;		}		rcv->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;		rcv->instance = modem_port_ptr;	}	/* allocate multiple receive buffer */	for (i = 0; i < num_rx_buf; i++) {		struct ap_rb *rb = &(modem_port_ptr->rb[i]);		rb->base = usb_buffer_alloc(serial->dev, readsize,					GFP_KERNEL, &rb->dma);		if (!rb->base) {			dev_err(&serial->dev->dev,				 "%s : out of memory/n",				__func__);			goto alloc_rb_buffer_fail;		}	}	for (i = 0; i < AP_NW; i++) {		struct ap_wb *snd = &(modem_port_ptr->wb[i]);		snd->urb = usb_alloc_urb(0, GFP_KERNEL);		if (!snd->urb) {			dev_err(&serial->dev->dev, "%s : out of memory "				"(write urbs usb_alloc_urb)/n", __func__);			goto alloc_wb_urb_fail;		}		usb_fill_bulk_urb(snd->urb, serial->dev,				usb_sndbulkpipe(serial->dev,					epwrite->bEndpointAddress),				NULL, modem_port_ptr->writesize,				modem_write_bulk_callback, snd);		snd->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;		snd->instance = modem_port_ptr;	}	modem_port_ptr->modem_status = 0;	/* The modem has presented a usb interface, remove the shutdown timer. */	spin_lock_irqsave(&modem.lock, flags);	if (modem.connected == false) {		modem.connected = true;		cancel_delayed_work(&modem.delayed_pwr_shutdown);	}	spin_unlock_irqrestore(&modem.lock, flags);	/* install serial private data */	usb_set_serial_data(serial, modem_port_ptr);	if (modem_port_ptr->number == MODEM_INTERFACE_NUM) {		modem.wq = create_singlethread_workqueue("mdm6600_usb_wq");		wake_lock_init(&modem.wakelock, WAKE_LOCK_SUSPEND,				"mdm6600_usb_modem");		/* install the BP GPIO wakeup irq and disable it first */		if (modem_wake_irq) {			retval = request_irq(				modem_wake_irq,				gpio_wkup_interrupt_handler,				IRQ_DISABLED | IRQ_TYPE_EDGE_FALLING,				"mdm6600_usb_wakeup", modem_port_ptr);			if (retval)				dev_err(&interface->dev,					"%s request_irq failed /n", __func__);			else				disable_irq(modem_wake_irq);		}	}	return 0;alloc_wb_urb_fail:	for (i = 0; i < AP_NW; i++)		usb_free_urb(modem_port_ptr->wb[i].urb);alloc_rb_buffer_fail:	modem_read_buffers_free(modem_port_ptr, serial);alloc_rb_urb_fail:	for (i = 0; i < num_rx_buf; i++)		usb_free_urb(modem_port_ptr->ru[i].urb);alloc_write_buf_fail:	modem_write_buffers_free(modem_port_ptr, serial);	if (modem_port_ptr != NULL) {		kfree(modem_port_ptr);		usb_set_serial_data(serial, NULL);	}	modem_attached_ports--;	return -ENOMEM;}
开发者ID:Atrix-Dev-Team,项目名称:kernel-MB860,代码行数:101,


示例19: qcprobe

//.........这里部分代码省略.........		 * 3: QMI/net		 */		if (nintf < 3 || nintf > 4) {			dev_err(dev, "unknown number of interfaces: %d/n", nintf);			altsetting = -1;			goto done;		}		if (ifnum == 0) {			dev_dbg(dev, "Gobi 1K DM/DIAG interface found/n");			altsetting = 1;		} else if (ifnum == 2)			dev_dbg(dev, "Modem port found/n");		else			altsetting = -1;		break;	case QCSERIAL_G2K:		/*		 * Gobi 2K+ USB layout:		 * 0: QMI/net		 * 1: DM/DIAG (use libqcdm from ModemManager for communication)		 * 2: AT-capable modem port		 * 3: NMEA		 */		if (nintf < 3 || nintf > 4) {			dev_err(dev, "unknown number of interfaces: %d/n", nintf);			altsetting = -1;			goto done;		}		switch (ifnum) {		case 0:			/* Don't claim the QMI/net interface */			altsetting = -1;			break;		case 1:			dev_dbg(dev, "Gobi 2K+ DM/DIAG interface found/n");			break;		case 2:			dev_dbg(dev, "Modem port found/n");			break;		case 3:			/*			 * NMEA (serial line 9600 8N1)			 * # echo "/$GPS_START" > /dev/ttyUSBx			 * # echo "/$GPS_STOP"  > /dev/ttyUSBx			 */			dev_dbg(dev, "Gobi 2K+ NMEA GPS interface found/n");			break;		}		break;	case QCSERIAL_SWI:		/*		 * Sierra Wireless layout:		 * 0: DM/DIAG (use libqcdm from ModemManager for communication)		 * 2: NMEA		 * 3: AT-capable modem port		 * 8: QMI/net		 */		switch (ifnum) {		case 0:			dev_dbg(dev, "DM/DIAG interface found/n");			break;		case 2:			dev_dbg(dev, "NMEA GPS interface found/n");			break;		case 3:			dev_dbg(dev, "Modem port found/n");			break;		default:			/* don't claim any unsupported interface */			altsetting = -1;			break;		}		break;	default:		dev_err(dev, "unsupported device layout type: %lu/n",			id->driver_info);		break;	}done:	if (altsetting >= 0) {		retval = usb_set_interface(serial->dev, ifnum, altsetting);		if (retval < 0) {			dev_err(dev,				"Could not set interface, error %d/n",				retval);			retval = -ENODEV;		}	}	/* Set serial->private if not returning error */	if (retval == 0)		usb_set_serial_data(serial, data);	else		kfree(data);	return retval;}
开发者ID:jing-git,项目名称:rt-n56u,代码行数:101,



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


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