コード例 #1
0
static void acm_read_bulk_callback(struct urb *urb)
{
	struct acm_rb *rb = urb->context;
	struct acm *acm = rb->instance;
	unsigned long flags;

	dev_vdbg(&acm->data->dev, "%s - urb %d, len %d\n", __func__,
					rb->index, urb->actual_length);
	set_bit(rb->index, &acm->read_urbs_free);

	if (!acm->dev) {
		dev_dbg(&acm->data->dev, "%s - disconnected\n", __func__);
		return;
	}
	usb_mark_last_busy(acm->dev);

	if (urb->status) {
		dev_dbg(&acm->data->dev, "%s - non-zero urb status: %d\n",
							__func__, urb->status);
		return;
	}
	acm_process_read_urb(acm, urb);

	/* throttle device if requested by tty */
	spin_lock_irqsave(&acm->read_lock, flags);
	acm->throttled = acm->throttle_req;
	if (!acm->throttled && !acm->susp_count) {
		spin_unlock_irqrestore(&acm->read_lock, flags);
		acm_submit_read_urb(acm, rb->index, GFP_ATOMIC);
	} else {
		spin_unlock_irqrestore(&acm->read_lock, flags);
	}
}
コード例 #2
0
static int acm_submit_read_urbs(struct acm *acm, gfp_t mem_flags)
{
	int res;
	int i;

	for (i = 0; i < acm->rx_buflimit; ++i) {
		res = acm_submit_read_urb(acm, i, mem_flags);
		if (res)
			return res;
	}

	return 0;
}
コード例 #3
0
ファイル: cdc-acm.c プロジェクト: maxwen/enrc2b-kernel-BLADE
static void acm_read_bulk_callback(struct urb *urb)
{
	struct acm_rb *rb = urb->context;
	struct acm *acm = rb->instance;
	unsigned long flags;
	static int eproto_count = 0;
	D("%s - urb %d, len %d\n", __func__,
					rb->index, urb->actual_length);
	set_bit(rb->index, &acm->read_urbs_free);

	if (!acm->dev) {
		D("%s - disconnected\n", __func__);
		return;
	}
	usb_mark_last_busy(acm->dev);

	if (urb->status && !urb->actual_length) {
		if (urb->status == -EPROTO && eproto_count < 20){
			D("%s: cdc-acm EPROTO Hit %d times!\n", __func__, eproto_count+1);			
			if(eproto_count == 0){
				debug_gpio_dump();
			}
			eproto_count++;
			return;
		}else{
			return;
		}
	}

	/* clear count if urb->status = 0 */
	eproto_count = 0;

	acm_process_read_urb(acm, urb);

	/* throttle device if requested by tty */
	spin_lock_irqsave(&acm->read_lock, flags);
	acm->throttled = acm->throttle_req;
	if (!acm->throttled && !acm->susp_count) {
		spin_unlock_irqrestore(&acm->read_lock, flags);
		acm_submit_read_urb(acm, rb->index, GFP_ATOMIC);
	} else {
		spin_unlock_irqrestore(&acm->read_lock, flags);
	}
}