static void adu_interrupt_out_callback(struct urb *urb)
{
	struct adu_device *dev = urb->context;
	int status = urb->status;

	dbg(4," %s : enter, status %d", __func__, status);
	adu_debug_data(5,__func__, urb->actual_length, urb->transfer_buffer);

	if (status != 0) {
		if ((status != -ENOENT) &&
		    (status != -ECONNRESET)) {
			dbg(1, " %s :nonzero status received: %d",
			    __func__, status);
		}
		goto exit;
	}

	spin_lock(&dev->buflock);
	dev->out_urb_finished = 1;
	wake_up(&dev->write_wait);
	spin_unlock(&dev->buflock);
exit:

	adu_debug_data(5, __func__, urb->actual_length,
		       urb->transfer_buffer);
	dbg(4," %s : leave, status %d", __func__, status);
}
static void adu_interrupt_in_callback(struct urb *urb)
{
	struct adu_device *dev = urb->context;
	int status = urb->status;

	dbg(4," %s : enter, status %d", __func__, status);
	adu_debug_data(5, __func__, urb->actual_length,
		       urb->transfer_buffer);

	spin_lock(&dev->buflock);

	if (status != 0) {
		if ((status != -ENOENT) && (status != -ECONNRESET) &&
			(status != -ESHUTDOWN)) {
			dbg(1," %s : nonzero status received: %d",
			    __func__, status);
		}
		goto exit;
	}

	if (urb->actual_length > 0 && dev->interrupt_in_buffer[0] != 0x00) {
		if (dev->read_buffer_length <
		    (4 * usb_endpoint_maxp(dev->interrupt_in_endpoint)) -
		     (urb->actual_length)) {
			memcpy (dev->read_buffer_primary +
				dev->read_buffer_length,
				dev->interrupt_in_buffer, urb->actual_length);

			dev->read_buffer_length += urb->actual_length;
			dbg(2," %s reading  %d ", __func__,
			    urb->actual_length);
		} else {
			dbg(1," %s : read_buffer overflow", __func__);
		}
	}

exit:
	dev->read_urb_finished = 1;
	spin_unlock(&dev->buflock);
	/* always wake up so we recover from errors */
	wake_up_interruptible(&dev->read_wait);
	adu_debug_data(5, __func__, urb->actual_length,
		       urb->transfer_buffer);
	dbg(4," %s : leave, status %d", __func__, status);
}
Ejemplo n.º 3
0
static void adu_interrupt_out_callback(struct urb *urb)
{
	struct adu_device *dev = urb->context;

	dbg(4," %s : enter, status %d", __FUNCTION__, urb->status);
	adu_debug_data(5,__FUNCTION__, urb->actual_length, urb->transfer_buffer);

	if (urb->status != 0) {
		if ((urb->status != -ENOENT) &&
		    (urb->status != -ECONNRESET)) {
			dbg(1, " %s :nonzero status received: %d",
			    __FUNCTION__, urb->status);
		}
		goto exit;
	}

	wake_up_interruptible(&dev->write_wait);
exit:

	adu_debug_data(5, __FUNCTION__, urb->actual_length,
		       urb->transfer_buffer);
	dbg(4," %s : leave, status %d", __FUNCTION__, urb->status);
}