Exemple #1
0
/*
	Setup Toneport device.
*/
static void toneport_setup(struct usb_line6_toneport *toneport)
{
	int ticks;
	struct usb_line6 *line6 = &toneport->line6;
	struct usb_device *usbdev = line6->usbdev;

	/* sync time on device with host: */
	ticks = (int)get_seconds();
	line6_write_data(line6, 0x80c6, &ticks, 4);

	/* enable device: */
	toneport_send_cmd(usbdev, 0x0301, 0x0000);

	/* initialize source select: */
	switch (usbdev->descriptor.idProduct) {
	case LINE6_DEVID_TONEPORT_UX1:
	case LINE6_DEVID_PODSTUDIO_UX1:
		toneport_send_cmd(usbdev,
				  toneport_source_info[toneport->source].code,
				  0x0000);
	}

	if (toneport_has_led(usbdev->descriptor.idProduct))
		toneport_update_led(&usbdev->dev);
}
Exemple #2
0
/*
	 Init Toneport device.
*/
int toneport_init(struct usb_interface *interface,
		  struct usb_line6_toneport *toneport)
{
	int err, ticks;
	struct usb_line6 *line6 = &toneport->line6;
	struct usb_device *usbdev;

	if ((interface == NULL) || (toneport == NULL))
		return -ENODEV;

	/* initialize audio system: */
	err = line6_init_audio(line6);
	if (err < 0) {
		toneport_destruct(interface);
		return err;
	}

	/* initialize PCM subsystem: */
	err = line6_init_pcm(line6, &toneport_pcm_properties);
	if (err < 0) {
		toneport_destruct(interface);
		return err;
	}

	/* register audio system: */
	err = line6_register_audio(line6);
	if (err < 0) {
		toneport_destruct(interface);
		return err;
	}

	usbdev = line6->usbdev;
	line6_read_serial_number(line6, &toneport->serial_number);
	line6_read_data(line6, 0x80c2, &toneport->firmware_version, 1);

	/* sync time on device with host: */
	ticks = (int)get_seconds();
	line6_write_data(line6, 0x80c6, &ticks, 4);

	/*
	   seems to work without the first two...
	 */
	/* toneport_send_cmd(usbdev, 0x0201, 0x0002); */
	/* toneport_send_cmd(usbdev, 0x0801, 0x0000); */
	/* only one that works for me; on GP, TP might be different? */
	toneport_send_cmd(usbdev, 0x0301, 0x0000);

	if (usbdev->descriptor.idProduct != LINE6_DEVID_GUITARPORT) {
		CHECK_RETURN(device_create_file
			     (&interface->dev, &dev_attr_led_red));
		CHECK_RETURN(device_create_file
			     (&interface->dev, &dev_attr_led_green));
		toneport_update_led(&usbdev->dev);
	}

	return 0;
}