Ejemplo n.º 1
0
//-----------------------------------------------------------------
// usb_cdc_process_request:
//-----------------------------------------------------------------
void usb_cdc_process_request(unsigned char req, unsigned short wValue, unsigned short WIndex, unsigned char *data, unsigned short wLength)
{
	switch ( req )
	{
	case CDC_SEND_ENCAPSULATED_COMMAND:
        log_printf(USBLOG_CDC_INFO, "CDC: Send encap\n");
	    cdc_send_encapsulated_command();
	    break;
	case CDC_GET_ENCAPSULATED_RESPONSE:
        log_printf(USBLOG_CDC_INFO, "CDC: Get encap\n");
	    cdc_get_encapsulated_response(wLength);
	    break;
	case CDC_SET_LINE_CODING:
        log_printf(USBLOG_CDC_INFO, "CDC: Set line coding\n");
	    cdc_set_line_coding(data);
	    break;
	case CDC_GET_LINE_CODING:
        log_printf(USBLOG_CDC_INFO, "CDC: Get line coding\n");
	    cdc_get_line_coding(wLength);
	    break;
	case CDC_SET_CONTROL_LINE_STATE:
        log_printf(USBLOG_CDC_INFO, "CDC: Set line state\n");
	    cdc_set_control_line_state();
	    break;
	case CDC_SEND_BREAK:
        log_printf(USBLOG_CDC_INFO, "CDC: Send break\n");
	    cdc_send_break();
	    break;
	default:
        log_printf(USBLOG_CDC_INFO, "CDC: Unknown command\n");
		usbhw_control_endpoint_stall();
		break;
	}
}
Ejemplo n.º 2
0
/**
 * Send control packet
 *
 * @v acm		USB RNDIS device
 * @v iobuf		I/O buffer
 * @ret rc		Return status code
 */
static int acm_control_transmit ( struct acm_device *acm,
				  struct io_buffer *iobuf ) {
	struct rndis_device *rndis = acm->rndis;
	struct usb_device *usb = acm->usb;
	int rc;

	/* Send packet as an encapsulated command */
	if ( ( rc = cdc_send_encapsulated_command ( usb, acm->usbnet.comms,
						    iobuf->data,
						    iob_len ( iobuf ) ) ) != 0){
		DBGC ( acm, "ACM %p could not send encapsulated command: %s\n",
		       acm, strerror ( rc ) );
		return rc;
	}

	/* Complete packet immediately */
	rndis_tx_complete ( rndis, iobuf );

	return 0;
}