/*-
 * Copyright (c) 1999, 2000 MAEKAWA Masahide <maekawa@math.sci.kobe-u.ac.jp>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 *	$Maekawa: cs.c,v 1.21 2000/04/01 05:27:48 maekawa Exp $
 */

/*
 * Class Specific
 */

#include <stdio.h>
#include <unistd.h>

#include <dev/usb/usb.h>

#include "main.h"
#include "audio.h"
#include "hid.h"

extern struct devinfo usbdev;

void
dump_cs_device(desc, interface)
	usb_descriptor_t *desc;
{
	switch (usbdev.class) {
	case UICLASS_HID:
		hid_device(desc, interface);
		break;
	default:
		dump_descriptor(desc, "\t\t");
		dump_raw((u_int8_t *)desc, "\t\t");
	}

	return;
}

void
dump_cs_interface(desc)
	usb_descriptor_t *desc;
{
	if (usbdev.vendor == 0x0499 && usbdev.product == 0x1000) {
		/* YAMAHA UX256 USB MIDI */
		audio_midi_interface(desc);
		return;
	}

	switch (usbdev.class) {
	case UICLASS_AUDIO:
		audio_interface(desc, usbdev.subclass);
		break;
	default:
		dump_descriptor(desc, "\t\t");
		dump_raw((u_int8_t *)desc, "\t\t");
	}

	return;
}

void
dump_cs_endpoint(desc)
	usb_descriptor_t *desc;
{
	switch (usbdev.class) {
	case UICLASS_AUDIO:
		audio_endpoint(desc, usbdev.subclass);
		break;
	default:
		dump_descriptor(desc, "\t\t");
		dump_raw((u_int8_t *)desc, "\t\t");
	}

	return;
}
