|
@@ -1,7 +1,7 @@
|
|
/*
|
|
/*
|
|
- * Line6 Linux USB driver - 0.8.0
|
|
|
|
|
|
+ * Line6 Linux USB driver - 0.9.0
|
|
*
|
|
*
|
|
- * Copyright (C) 2004-2009 Markus Grabner (grabner@icg.tugraz.at)
|
|
|
|
|
|
+ * Copyright (C) 2004-2010 Markus Grabner (grabner@icg.tugraz.at)
|
|
*
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License as
|
|
* modify it under the terms of the GNU General Public License as
|
|
@@ -9,8 +9,6 @@
|
|
*
|
|
*
|
|
*/
|
|
*/
|
|
|
|
|
|
-#include "driver.h"
|
|
|
|
-
|
|
|
|
#include <linux/kernel.h>
|
|
#include <linux/kernel.h>
|
|
#include <linux/module.h>
|
|
#include <linux/module.h>
|
|
#include <linux/slab.h>
|
|
#include <linux/slab.h>
|
|
@@ -19,6 +17,7 @@
|
|
#include "audio.h"
|
|
#include "audio.h"
|
|
#include "capture.h"
|
|
#include "capture.h"
|
|
#include "control.h"
|
|
#include "control.h"
|
|
|
|
+#include "driver.h"
|
|
#include "midi.h"
|
|
#include "midi.h"
|
|
#include "playback.h"
|
|
#include "playback.h"
|
|
#include "pod.h"
|
|
#include "pod.h"
|
|
@@ -30,7 +29,7 @@
|
|
|
|
|
|
#define DRIVER_AUTHOR "Markus Grabner <grabner@icg.tugraz.at>"
|
|
#define DRIVER_AUTHOR "Markus Grabner <grabner@icg.tugraz.at>"
|
|
#define DRIVER_DESC "Line6 USB Driver"
|
|
#define DRIVER_DESC "Line6 USB Driver"
|
|
-#define DRIVER_VERSION "0.8.0"
|
|
|
|
|
|
+#define DRIVER_VERSION "0.9.0"
|
|
|
|
|
|
|
|
|
|
/* table of devices that work with this driver */
|
|
/* table of devices that work with this driver */
|
|
@@ -40,6 +39,9 @@ static const struct usb_device_id line6_id_table[] = {
|
|
{ USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_BASSPODXTPRO) },
|
|
{ USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_BASSPODXTPRO) },
|
|
{ USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_GUITARPORT) },
|
|
{ USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_GUITARPORT) },
|
|
{ USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_POCKETPOD) },
|
|
{ USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_POCKETPOD) },
|
|
|
|
+ { USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODSTUDIO_GX) },
|
|
|
|
+ { USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODSTUDIO_UX1) },
|
|
|
|
+ { USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODSTUDIO_UX2) },
|
|
{ USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODX3) },
|
|
{ USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODX3) },
|
|
{ USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODX3LIVE) },
|
|
{ USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODX3LIVE) },
|
|
{ USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODXT) },
|
|
{ USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODXT) },
|
|
@@ -54,30 +56,48 @@ static const struct usb_device_id line6_id_table[] = {
|
|
MODULE_DEVICE_TABLE(usb, line6_id_table);
|
|
MODULE_DEVICE_TABLE(usb, line6_id_table);
|
|
|
|
|
|
static struct line6_properties line6_properties_table[] = {
|
|
static struct line6_properties line6_properties_table[] = {
|
|
- { "BassPODxt", LINE6_BIT_BASSPODXT, LINE6_BIT_CONTROL_PCM },
|
|
|
|
- { "BassPODxt Live", LINE6_BIT_BASSPODXTLIVE, LINE6_BIT_CONTROL_PCM },
|
|
|
|
- { "BassPODxt Pro", LINE6_BIT_BASSPODXTPRO, LINE6_BIT_CONTROL_PCM },
|
|
|
|
- { "GuitarPort", LINE6_BIT_GUITARPORT, LINE6_BIT_PCM },
|
|
|
|
- { "Pocket POD", LINE6_BIT_POCKETPOD, LINE6_BIT_CONTROL_PCM },
|
|
|
|
- { "POD X3", LINE6_BIT_PODX3, LINE6_BIT_PCM },
|
|
|
|
- { "POD X3 Live", LINE6_BIT_PODX3LIVE, LINE6_BIT_PCM },
|
|
|
|
- { "PODxt", LINE6_BIT_PODXT, LINE6_BIT_CONTROL_PCM },
|
|
|
|
- { "PODxt Live", LINE6_BIT_PODXTLIVE, LINE6_BIT_CONTROL_PCM },
|
|
|
|
- { "PODxt Pro", LINE6_BIT_PODXTPRO, LINE6_BIT_CONTROL_PCM },
|
|
|
|
- { "TonePort GX", LINE6_BIT_TONEPORT_GX, LINE6_BIT_PCM },
|
|
|
|
- { "TonePort UX1", LINE6_BIT_TONEPORT_UX1, LINE6_BIT_PCM },
|
|
|
|
- { "TonePort UX2", LINE6_BIT_TONEPORT_UX2, LINE6_BIT_PCM },
|
|
|
|
- { "Variax Workbench", LINE6_BIT_VARIAX, LINE6_BIT_CONTROL }
|
|
|
|
|
|
+ { "BassPODxt", "BassPODxt", LINE6_BIT_BASSPODXT, LINE6_BIT_CONTROL_PCM_HWMON },
|
|
|
|
+ { "BassPODxtLive", "BassPODxt Live", LINE6_BIT_BASSPODXTLIVE, LINE6_BIT_CONTROL_PCM_HWMON },
|
|
|
|
+ { "BassPODxtPro", "BassPODxt Pro", LINE6_BIT_BASSPODXTPRO, LINE6_BIT_CONTROL_PCM_HWMON },
|
|
|
|
+ { "GuitarPort", "GuitarPort", LINE6_BIT_GUITARPORT, LINE6_BIT_PCM },
|
|
|
|
+ { "PocketPOD", "Pocket POD", LINE6_BIT_POCKETPOD, LINE6_BIT_CONTROL },
|
|
|
|
+ { "PODStudioGX", "POD Studio GX", LINE6_BIT_PODSTUDIO_GX, LINE6_BIT_PCM },
|
|
|
|
+ { "PODStudioUX1", "POD Studio UX1", LINE6_BIT_PODSTUDIO_UX1, LINE6_BIT_PCM },
|
|
|
|
+ { "PODStudioUX2", "POD Studio UX2", LINE6_BIT_PODSTUDIO_UX2, LINE6_BIT_PCM },
|
|
|
|
+ { "PODX3", "POD X3", LINE6_BIT_PODX3, LINE6_BIT_PCM },
|
|
|
|
+ { "PODX3Live", "POD X3 Live", LINE6_BIT_PODX3LIVE, LINE6_BIT_PCM },
|
|
|
|
+ { "PODxt", "PODxt", LINE6_BIT_PODXT, LINE6_BIT_CONTROL_PCM_HWMON },
|
|
|
|
+ { "PODxtLive", "PODxt Live", LINE6_BIT_PODXTLIVE, LINE6_BIT_CONTROL_PCM_HWMON },
|
|
|
|
+ { "PODxtPro", "PODxt Pro", LINE6_BIT_PODXTPRO, LINE6_BIT_CONTROL_PCM_HWMON },
|
|
|
|
+ { "TonePortGX", "TonePort GX", LINE6_BIT_TONEPORT_GX, LINE6_BIT_PCM },
|
|
|
|
+ { "TonePortUX1", "TonePort UX1", LINE6_BIT_TONEPORT_UX1, LINE6_BIT_PCM },
|
|
|
|
+ { "TonePortUX2", "TonePort UX2", LINE6_BIT_TONEPORT_UX2, LINE6_BIT_PCM },
|
|
|
|
+ { "Variax", "Variax Workbench", LINE6_BIT_VARIAX, LINE6_BIT_CONTROL }
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
/*
|
|
/*
|
|
This is Line6's MIDI manufacturer ID.
|
|
This is Line6's MIDI manufacturer ID.
|
|
*/
|
|
*/
|
|
-const unsigned char line6_midi_id[] = { 0x00, 0x01, 0x0c };
|
|
|
|
|
|
+const unsigned char line6_midi_id[] = {
|
|
|
|
+ 0x00, 0x01, 0x0c
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+ Code to request version of POD, Variax interface
|
|
|
|
+ (and maybe other devices).
|
|
|
|
+*/
|
|
|
|
+static const char line6_request_version0[] = {
|
|
|
|
+ 0xf0, 0x7e, 0x7f, 0x06, 0x01, 0xf7
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+ Copy of version request code with GFP_KERNEL flag for use in URB.
|
|
|
|
+*/
|
|
|
|
+static const char *line6_request_version;
|
|
|
|
+
|
|
|
|
|
|
struct usb_line6 *line6_devices[LINE6_MAX_DEVICES];
|
|
struct usb_line6 *line6_devices[LINE6_MAX_DEVICES];
|
|
-struct workqueue_struct *line6_workqueue;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -104,15 +124,25 @@ static int line6_send_raw_message_async_part(struct message *msg,
|
|
*/
|
|
*/
|
|
static int line6_start_listen(struct usb_line6 *line6)
|
|
static int line6_start_listen(struct usb_line6 *line6)
|
|
{
|
|
{
|
|
|
|
+ int err;
|
|
usb_fill_int_urb(line6->urb_listen, line6->usbdev,
|
|
usb_fill_int_urb(line6->urb_listen, line6->usbdev,
|
|
usb_rcvintpipe(line6->usbdev, line6->ep_control_read),
|
|
usb_rcvintpipe(line6->usbdev, line6->ep_control_read),
|
|
line6->buffer_listen, LINE6_BUFSIZE_LISTEN,
|
|
line6->buffer_listen, LINE6_BUFSIZE_LISTEN,
|
|
line6_data_received, line6, line6->interval);
|
|
line6_data_received, line6, line6->interval);
|
|
line6->urb_listen->actual_length = 0;
|
|
line6->urb_listen->actual_length = 0;
|
|
- return usb_submit_urb(line6->urb_listen, GFP_KERNEL);
|
|
|
|
|
|
+ err = usb_submit_urb(line6->urb_listen, GFP_KERNEL);
|
|
|
|
+ return err;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+ Stop listening on endpoint.
|
|
|
|
+*/
|
|
|
|
+static void line6_stop_listen(struct usb_line6 *line6)
|
|
|
|
+{
|
|
|
|
+ usb_kill_urb(line6->urb_listen);
|
|
}
|
|
}
|
|
|
|
|
|
-#if DO_DUMP_ANY
|
|
|
|
|
|
+#ifdef CONFIG_LINE6_USB_DUMP_ANY
|
|
/*
|
|
/*
|
|
Write hexdump to syslog.
|
|
Write hexdump to syslog.
|
|
*/
|
|
*/
|
|
@@ -152,7 +182,7 @@ void line6_write_hexdump(struct usb_line6 *line6, char dir,
|
|
}
|
|
}
|
|
#endif
|
|
#endif
|
|
|
|
|
|
-#if DO_DUMP_URB_RECEIVE
|
|
|
|
|
|
+#ifdef CONFIG_LINE6_USB_DUMP_CTRL
|
|
/*
|
|
/*
|
|
Dump URB data to syslog.
|
|
Dump URB data to syslog.
|
|
*/
|
|
*/
|
|
@@ -169,19 +199,19 @@ static void line6_dump_urb(struct urb *urb)
|
|
#endif
|
|
#endif
|
|
|
|
|
|
/*
|
|
/*
|
|
- Send raw message in pieces of max_packet_size bytes.
|
|
|
|
|
|
+ Send raw message in pieces of wMaxPacketSize bytes.
|
|
*/
|
|
*/
|
|
int line6_send_raw_message(struct usb_line6 *line6, const char *buffer,
|
|
int line6_send_raw_message(struct usb_line6 *line6, const char *buffer,
|
|
int size)
|
|
int size)
|
|
{
|
|
{
|
|
int i, done = 0;
|
|
int i, done = 0;
|
|
- int actual_size;
|
|
|
|
|
|
|
|
-#if DO_DUMP_URB_SEND
|
|
|
|
|
|
+#ifdef CONFIG_LINE6_USB_DUMP_CTRL
|
|
line6_write_hexdump(line6, 'S', buffer, size);
|
|
line6_write_hexdump(line6, 'S', buffer, size);
|
|
#endif
|
|
#endif
|
|
|
|
|
|
- for (i = 0; i < size; i += actual_size) {
|
|
|
|
|
|
+ for (i = 0; i < size; i += line6->max_packet_size) {
|
|
|
|
+ int partial;
|
|
const char *frag_buf = buffer + i;
|
|
const char *frag_buf = buffer + i;
|
|
int frag_size = min(line6->max_packet_size, size - i);
|
|
int frag_size = min(line6->max_packet_size, size - i);
|
|
int retval;
|
|
int retval;
|
|
@@ -190,7 +220,7 @@ int line6_send_raw_message(struct usb_line6 *line6, const char *buffer,
|
|
usb_sndintpipe(line6->usbdev,
|
|
usb_sndintpipe(line6->usbdev,
|
|
line6->ep_control_write),
|
|
line6->ep_control_write),
|
|
(char *)frag_buf, frag_size,
|
|
(char *)frag_buf, frag_size,
|
|
- &actual_size, LINE6_TIMEOUT * HZ);
|
|
|
|
|
|
+ &partial, LINE6_TIMEOUT * HZ);
|
|
|
|
|
|
if (retval) {
|
|
if (retval) {
|
|
dev_err(line6->ifcdev,
|
|
dev_err(line6->ifcdev,
|
|
@@ -198,7 +228,7 @@ int line6_send_raw_message(struct usb_line6 *line6, const char *buffer,
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
- done += actual_size;
|
|
|
|
|
|
+ done += frag_size;
|
|
}
|
|
}
|
|
|
|
|
|
return done;
|
|
return done;
|
|
@@ -234,7 +264,7 @@ static int line6_send_raw_message_async_part(struct message *msg,
|
|
(char *)msg->buffer + done, bytes,
|
|
(char *)msg->buffer + done, bytes,
|
|
line6_async_request_sent, msg, line6->interval);
|
|
line6_async_request_sent, msg, line6->interval);
|
|
|
|
|
|
-#if DO_DUMP_URB_SEND
|
|
|
|
|
|
+#ifdef CONFIG_LINE6_USB_DUMP_CTRL
|
|
line6_write_hexdump(line6, 'S', (char *)msg->buffer + done, bytes);
|
|
line6_write_hexdump(line6, 'S', (char *)msg->buffer + done, bytes);
|
|
#endif
|
|
#endif
|
|
|
|
|
|
@@ -252,6 +282,17 @@ static int line6_send_raw_message_async_part(struct message *msg,
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+/*
|
|
|
|
+ Setup and start timer.
|
|
|
|
+*/
|
|
|
|
+void line6_start_timer(struct timer_list *timer, unsigned int msecs,
|
|
|
|
+ void (*function)(unsigned long), unsigned long data)
|
|
|
|
+{
|
|
|
|
+ setup_timer(timer, function, data);
|
|
|
|
+ timer->expires = jiffies + msecs * HZ / 1000;
|
|
|
|
+ add_timer(timer);
|
|
|
|
+}
|
|
|
|
+
|
|
/*
|
|
/*
|
|
Asynchronously send raw message.
|
|
Asynchronously send raw message.
|
|
*/
|
|
*/
|
|
@@ -288,6 +329,14 @@ int line6_send_raw_message_async(struct usb_line6 *line6, const char *buffer,
|
|
return line6_send_raw_message_async_part(msg, urb);
|
|
return line6_send_raw_message_async_part(msg, urb);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+/*
|
|
|
|
+ Send asynchronous device version request.
|
|
|
|
+*/
|
|
|
|
+int line6_version_request_async(struct usb_line6 *line6)
|
|
|
|
+{
|
|
|
|
+ return line6_send_raw_message_async(line6, line6_request_version, sizeof(line6_request_version0));
|
|
|
|
+}
|
|
|
|
+
|
|
/*
|
|
/*
|
|
Send sysex message in pieces of wMaxPacketSize bytes.
|
|
Send sysex message in pieces of wMaxPacketSize bytes.
|
|
*/
|
|
*/
|
|
@@ -297,6 +346,15 @@ int line6_send_sysex_message(struct usb_line6 *line6, const char *buffer,
|
|
return line6_send_raw_message(line6, buffer, size + SYSEX_EXTRA_SIZE) - SYSEX_EXTRA_SIZE;
|
|
return line6_send_raw_message(line6, buffer, size + SYSEX_EXTRA_SIZE) - SYSEX_EXTRA_SIZE;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+/*
|
|
|
|
+ Send sysex message in pieces of wMaxPacketSize bytes.
|
|
|
|
+*/
|
|
|
|
+int line6_send_sysex_message_async(struct usb_line6 *line6, const char *buffer,
|
|
|
|
+ int size)
|
|
|
|
+{
|
|
|
|
+ return line6_send_raw_message_async(line6, buffer, size + SYSEX_EXTRA_SIZE) - SYSEX_EXTRA_SIZE;
|
|
|
|
+}
|
|
|
|
+
|
|
/*
|
|
/*
|
|
Allocate buffer for sysex message and prepare header.
|
|
Allocate buffer for sysex message and prepare header.
|
|
@param code sysex message code
|
|
@param code sysex message code
|
|
@@ -305,7 +363,7 @@ int line6_send_sysex_message(struct usb_line6 *line6, const char *buffer,
|
|
char *line6_alloc_sysex_buffer(struct usb_line6 *line6, int code1, int code2,
|
|
char *line6_alloc_sysex_buffer(struct usb_line6 *line6, int code1, int code2,
|
|
int size)
|
|
int size)
|
|
{
|
|
{
|
|
- char *buffer = kmalloc(size + SYSEX_EXTRA_SIZE, GFP_KERNEL);
|
|
|
|
|
|
+ char *buffer = kmalloc(size + SYSEX_EXTRA_SIZE, GFP_ATOMIC);
|
|
|
|
|
|
if (!buffer) {
|
|
if (!buffer) {
|
|
dev_err(line6->ifcdev, "out of memory\n");
|
|
dev_err(line6->ifcdev, "out of memory\n");
|
|
@@ -332,29 +390,29 @@ static void line6_data_received(struct urb *urb)
|
|
if (urb->status == -ESHUTDOWN)
|
|
if (urb->status == -ESHUTDOWN)
|
|
return;
|
|
return;
|
|
|
|
|
|
-#if DO_DUMP_URB_RECEIVE
|
|
|
|
|
|
+#ifdef CONFIG_LINE6_USB_DUMP_CTRL
|
|
line6_dump_urb(urb);
|
|
line6_dump_urb(urb);
|
|
#endif
|
|
#endif
|
|
|
|
|
|
- done = midibuf_write(mb, urb->transfer_buffer, urb->actual_length);
|
|
|
|
|
|
+ done = line6_midibuf_write(mb, urb->transfer_buffer, urb->actual_length);
|
|
|
|
|
|
if (done < urb->actual_length) {
|
|
if (done < urb->actual_length) {
|
|
- midibuf_ignore(mb, done);
|
|
|
|
|
|
+ line6_midibuf_ignore(mb, done);
|
|
DEBUG_MESSAGES(dev_err(line6->ifcdev, "%d %d buffer overflow - message skipped\n", done, urb->actual_length));
|
|
DEBUG_MESSAGES(dev_err(line6->ifcdev, "%d %d buffer overflow - message skipped\n", done, urb->actual_length));
|
|
}
|
|
}
|
|
|
|
|
|
for (;;) {
|
|
for (;;) {
|
|
- done = midibuf_read(mb, line6->buffer_message, LINE6_MESSAGE_MAXLEN);
|
|
|
|
|
|
+ done = line6_midibuf_read(mb, line6->buffer_message, LINE6_MESSAGE_MAXLEN);
|
|
|
|
|
|
if (done == 0)
|
|
if (done == 0)
|
|
break;
|
|
break;
|
|
|
|
|
|
/* MIDI input filter */
|
|
/* MIDI input filter */
|
|
- if (midibuf_skip_message(mb, line6->line6midi->midi_mask_receive))
|
|
|
|
|
|
+ if (line6_midibuf_skip_message(mb, line6->line6midi->midi_mask_receive))
|
|
continue;
|
|
continue;
|
|
|
|
|
|
line6->message_length = done;
|
|
line6->message_length = done;
|
|
-#if DO_DUMP_MIDI_RECEIVE
|
|
|
|
|
|
+#ifdef CONFIG_LINE6_USB_DUMP_MIDI
|
|
line6_write_hexdump(line6, 'r', line6->buffer_message, done);
|
|
line6_write_hexdump(line6, 'r', line6->buffer_message, done);
|
|
#endif
|
|
#endif
|
|
line6_midi_receive(line6, line6->buffer_message, done);
|
|
line6_midi_receive(line6, line6->buffer_message, done);
|
|
@@ -366,17 +424,17 @@ static void line6_data_received(struct urb *urb)
|
|
case LINE6_DEVID_PODXT:
|
|
case LINE6_DEVID_PODXT:
|
|
case LINE6_DEVID_PODXTPRO:
|
|
case LINE6_DEVID_PODXTPRO:
|
|
case LINE6_DEVID_POCKETPOD:
|
|
case LINE6_DEVID_POCKETPOD:
|
|
- pod_process_message((struct usb_line6_pod *)line6);
|
|
|
|
|
|
+ line6_pod_process_message((struct usb_line6_pod *)line6);
|
|
break;
|
|
break;
|
|
|
|
|
|
case LINE6_DEVID_PODXTLIVE:
|
|
case LINE6_DEVID_PODXTLIVE:
|
|
switch (line6->interface_number) {
|
|
switch (line6->interface_number) {
|
|
case PODXTLIVE_INTERFACE_POD:
|
|
case PODXTLIVE_INTERFACE_POD:
|
|
- pod_process_message((struct usb_line6_pod *)line6);
|
|
|
|
|
|
+ line6_pod_process_message((struct usb_line6_pod *)line6);
|
|
break;
|
|
break;
|
|
|
|
|
|
case PODXTLIVE_INTERFACE_VARIAX:
|
|
case PODXTLIVE_INTERFACE_VARIAX:
|
|
- variax_process_message((struct usb_line6_variax *)line6);
|
|
|
|
|
|
+ line6_variax_process_message((struct usb_line6_variax *)line6);
|
|
break;
|
|
break;
|
|
|
|
|
|
default:
|
|
default:
|
|
@@ -385,7 +443,7 @@ static void line6_data_received(struct urb *urb)
|
|
break;
|
|
break;
|
|
|
|
|
|
case LINE6_DEVID_VARIAX:
|
|
case LINE6_DEVID_VARIAX:
|
|
- variax_process_message((struct usb_line6_variax *)line6);
|
|
|
|
|
|
+ line6_variax_process_message((struct usb_line6_variax *)line6);
|
|
break;
|
|
break;
|
|
|
|
|
|
default:
|
|
default:
|
|
@@ -396,44 +454,17 @@ static void line6_data_received(struct urb *urb)
|
|
line6_start_listen(line6);
|
|
line6_start_listen(line6);
|
|
}
|
|
}
|
|
|
|
|
|
-static int line6_send(struct usb_line6 *line6, unsigned char *buf, size_t len)
|
|
|
|
-{
|
|
|
|
- int retval;
|
|
|
|
- int partial;
|
|
|
|
-
|
|
|
|
-#if DO_DUMP_URB_SEND
|
|
|
|
- line6_write_hexdump(line6, 'S', buf, len);
|
|
|
|
-#endif
|
|
|
|
-
|
|
|
|
- retval = usb_interrupt_msg(line6->usbdev,
|
|
|
|
- usb_sndintpipe(line6->usbdev,
|
|
|
|
- line6->ep_control_write),
|
|
|
|
- buf, len, &partial,
|
|
|
|
- LINE6_TIMEOUT * HZ);
|
|
|
|
-
|
|
|
|
- if (retval) {
|
|
|
|
- dev_err(line6->ifcdev,
|
|
|
|
- "usb_interrupt_msg failed (%d)\n", retval);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (partial != len) {
|
|
|
|
- dev_err(line6->ifcdev,
|
|
|
|
- "usb_interrupt_msg sent partial message (%d)\n",
|
|
|
|
- retval);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return retval;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
/*
|
|
/*
|
|
Send channel number (i.e., switch to a different sound).
|
|
Send channel number (i.e., switch to a different sound).
|
|
*/
|
|
*/
|
|
int line6_send_program(struct usb_line6 *line6, int value)
|
|
int line6_send_program(struct usb_line6 *line6, int value)
|
|
{
|
|
{
|
|
|
|
+ int retval;
|
|
unsigned char *buffer;
|
|
unsigned char *buffer;
|
|
- size_t len = 2;
|
|
|
|
|
|
+ int partial;
|
|
|
|
+
|
|
|
|
+ buffer = kmalloc(2, GFP_KERNEL);
|
|
|
|
|
|
- buffer = kmalloc(len, GFP_KERNEL);
|
|
|
|
if (!buffer) {
|
|
if (!buffer) {
|
|
dev_err(line6->ifcdev, "out of memory\n");
|
|
dev_err(line6->ifcdev, "out of memory\n");
|
|
return -ENOMEM;
|
|
return -ENOMEM;
|
|
@@ -442,7 +473,20 @@ int line6_send_program(struct usb_line6 *line6, int value)
|
|
buffer[0] = LINE6_PROGRAM_CHANGE | LINE6_CHANNEL_HOST;
|
|
buffer[0] = LINE6_PROGRAM_CHANGE | LINE6_CHANNEL_HOST;
|
|
buffer[1] = value;
|
|
buffer[1] = value;
|
|
|
|
|
|
- return line6_send(line6, buffer, len);
|
|
|
|
|
|
+#ifdef CONFIG_LINE6_USB_DUMP_CTRL
|
|
|
|
+ line6_write_hexdump(line6, 'S', buffer, 2);
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
+ retval = usb_interrupt_msg(line6->usbdev,
|
|
|
|
+ usb_sndintpipe(line6->usbdev,
|
|
|
|
+ line6->ep_control_write),
|
|
|
|
+ buffer, 2, &partial, LINE6_TIMEOUT * HZ);
|
|
|
|
+
|
|
|
|
+ if (retval)
|
|
|
|
+ dev_err(line6->ifcdev, "usb_interrupt_msg failed (%d)\n", retval);
|
|
|
|
+
|
|
|
|
+ kfree(buffer);
|
|
|
|
+ return retval;
|
|
}
|
|
}
|
|
|
|
|
|
/*
|
|
/*
|
|
@@ -450,10 +494,12 @@ int line6_send_program(struct usb_line6 *line6, int value)
|
|
*/
|
|
*/
|
|
int line6_transmit_parameter(struct usb_line6 *line6, int param, int value)
|
|
int line6_transmit_parameter(struct usb_line6 *line6, int param, int value)
|
|
{
|
|
{
|
|
|
|
+ int retval;
|
|
unsigned char *buffer;
|
|
unsigned char *buffer;
|
|
- size_t len = 3;
|
|
|
|
|
|
+ int partial;
|
|
|
|
+
|
|
|
|
+ buffer = kmalloc(3, GFP_KERNEL);
|
|
|
|
|
|
- buffer = kmalloc(len, GFP_KERNEL);
|
|
|
|
if (!buffer) {
|
|
if (!buffer) {
|
|
dev_err(line6->ifcdev, "out of memory\n");
|
|
dev_err(line6->ifcdev, "out of memory\n");
|
|
return -ENOMEM;
|
|
return -ENOMEM;
|
|
@@ -463,7 +509,19 @@ int line6_transmit_parameter(struct usb_line6 *line6, int param, int value)
|
|
buffer[1] = param;
|
|
buffer[1] = param;
|
|
buffer[2] = value;
|
|
buffer[2] = value;
|
|
|
|
|
|
- return line6_send(line6, buffer, len);
|
|
|
|
|
|
+#ifdef CONFIG_LINE6_USB_DUMP_CTRL
|
|
|
|
+ line6_write_hexdump(line6, 'S', buffer, 3);
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
+ retval = usb_interrupt_msg(line6->usbdev,
|
|
|
|
+ usb_sndintpipe(line6->usbdev, line6->ep_control_write),
|
|
|
|
+ buffer, 3, &partial, LINE6_TIMEOUT * HZ);
|
|
|
|
+
|
|
|
|
+ if (retval)
|
|
|
|
+ dev_err(line6->ifcdev, "usb_interrupt_msg failed (%d)\n", retval);
|
|
|
|
+
|
|
|
|
+ kfree(buffer);
|
|
|
|
+ return retval;
|
|
}
|
|
}
|
|
|
|
|
|
/*
|
|
/*
|
|
@@ -477,10 +535,9 @@ int line6_read_data(struct usb_line6 *line6, int address, void *data, size_t dat
|
|
|
|
|
|
/* query the serial number: */
|
|
/* query the serial number: */
|
|
ret = usb_control_msg(usbdev, usb_sndctrlpipe(usbdev, 0), 0x67,
|
|
ret = usb_control_msg(usbdev, usb_sndctrlpipe(usbdev, 0), 0x67,
|
|
- USB_TYPE_VENDOR | USB_RECIP_DEVICE
|
|
|
|
- | USB_DIR_OUT,
|
|
|
|
- (datalen << 8) | 0x21, address,
|
|
|
|
- NULL, 0, LINE6_TIMEOUT * HZ);
|
|
|
|
|
|
+ USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT,
|
|
|
|
+ (datalen << 8) | 0x21, address,
|
|
|
|
+ NULL, 0, LINE6_TIMEOUT * HZ);
|
|
|
|
|
|
if (ret < 0) {
|
|
if (ret < 0) {
|
|
dev_err(line6->ifcdev, "read request failed (error %d)\n", ret);
|
|
dev_err(line6->ifcdev, "read request failed (error %d)\n", ret);
|
|
@@ -599,7 +656,7 @@ ssize_t line6_nop_write(struct device *dev, struct device_attribute *attr,
|
|
/*
|
|
/*
|
|
"write" request on "raw" special file.
|
|
"write" request on "raw" special file.
|
|
*/
|
|
*/
|
|
-#if CREATE_RAW_FILE
|
|
|
|
|
|
+#ifdef CONFIG_LINE6_USB_RAW
|
|
ssize_t line6_set_raw(struct device *dev, struct device_attribute *attr,
|
|
ssize_t line6_set_raw(struct device *dev, struct device_attribute *attr,
|
|
const char *buf, size_t count)
|
|
const char *buf, size_t count)
|
|
{
|
|
{
|
|
@@ -637,21 +694,6 @@ static void line6_destruct(struct usb_interface *interface)
|
|
kfree(line6);
|
|
kfree(line6);
|
|
}
|
|
}
|
|
|
|
|
|
-static void line6_list_devices(void)
|
|
|
|
-{
|
|
|
|
- int i;
|
|
|
|
-
|
|
|
|
- for (i = 0; i < LINE6_MAX_DEVICES; ++i) {
|
|
|
|
- struct usb_line6 *dev = line6_devices[i];
|
|
|
|
- printk(KERN_INFO "Line6 device %d: ", i);
|
|
|
|
-
|
|
|
|
- if (dev == NULL)
|
|
|
|
- printk("(not used)\n");
|
|
|
|
- else
|
|
|
|
- printk("%s:%d\n", dev->properties->name, dev->interface_number);
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
/*
|
|
/*
|
|
Probe USB device.
|
|
Probe USB device.
|
|
*/
|
|
*/
|
|
@@ -674,10 +716,6 @@ static int line6_probe(struct usb_interface *interface, const struct usb_device_
|
|
if (usbdev == NULL)
|
|
if (usbdev == NULL)
|
|
return -ENODEV;
|
|
return -ENODEV;
|
|
|
|
|
|
- /* increment reference counters: */
|
|
|
|
- usb_get_intf(interface);
|
|
|
|
- usb_get_dev(usbdev);
|
|
|
|
-
|
|
|
|
/* we don't handle multiple configurations */
|
|
/* we don't handle multiple configurations */
|
|
if (usbdev->descriptor.bNumConfigurations != 1) {
|
|
if (usbdev->descriptor.bNumConfigurations != 1) {
|
|
ret = -ENODEV;
|
|
ret = -ENODEV;
|
|
@@ -689,8 +727,8 @@ static int line6_probe(struct usb_interface *interface, const struct usb_device_
|
|
u16 idVendor = le16_to_cpu(usbdev->descriptor.idVendor);
|
|
u16 idVendor = le16_to_cpu(usbdev->descriptor.idVendor);
|
|
u16 idProduct = le16_to_cpu(usbdev->descriptor.idProduct);
|
|
u16 idProduct = le16_to_cpu(usbdev->descriptor.idProduct);
|
|
|
|
|
|
- if (idVendor == line6_id_table[devtype].idVendor
|
|
|
|
- && idProduct == line6_id_table[devtype].idProduct)
|
|
|
|
|
|
+ if (idVendor == line6_id_table[devtype].idVendor &&
|
|
|
|
+ idProduct == line6_id_table[devtype].idProduct)
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -719,12 +757,23 @@ static int line6_probe(struct usb_interface *interface, const struct usb_device_
|
|
|
|
|
|
switch (product) {
|
|
switch (product) {
|
|
case LINE6_DEVID_BASSPODXTLIVE:
|
|
case LINE6_DEVID_BASSPODXTLIVE:
|
|
- case LINE6_DEVID_POCKETPOD:
|
|
|
|
case LINE6_DEVID_PODXTLIVE:
|
|
case LINE6_DEVID_PODXTLIVE:
|
|
case LINE6_DEVID_VARIAX:
|
|
case LINE6_DEVID_VARIAX:
|
|
alternate = 1;
|
|
alternate = 1;
|
|
break;
|
|
break;
|
|
|
|
|
|
|
|
+ case LINE6_DEVID_POCKETPOD:
|
|
|
|
+ switch (interface_number) {
|
|
|
|
+ case 0:
|
|
|
|
+ return 0; /* this interface has no endpoints */
|
|
|
|
+ case 1:
|
|
|
|
+ alternate = 0;
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ MISSING_CASE;
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+
|
|
case LINE6_DEVID_PODX3:
|
|
case LINE6_DEVID_PODX3:
|
|
case LINE6_DEVID_PODX3LIVE:
|
|
case LINE6_DEVID_PODX3LIVE:
|
|
switch (interface_number) {
|
|
switch (interface_number) {
|
|
@@ -746,21 +795,27 @@ static int line6_probe(struct usb_interface *interface, const struct usb_device_
|
|
alternate = 5;
|
|
alternate = 5;
|
|
break;
|
|
break;
|
|
|
|
|
|
- case LINE6_DEVID_TONEPORT_GX:
|
|
|
|
case LINE6_DEVID_GUITARPORT:
|
|
case LINE6_DEVID_GUITARPORT:
|
|
|
|
+ case LINE6_DEVID_PODSTUDIO_GX:
|
|
|
|
+ case LINE6_DEVID_PODSTUDIO_UX1:
|
|
|
|
+ case LINE6_DEVID_TONEPORT_GX:
|
|
|
|
+ case LINE6_DEVID_TONEPORT_UX1:
|
|
alternate = 2; /* 1..4 seem to be ok */
|
|
alternate = 2; /* 1..4 seem to be ok */
|
|
break;
|
|
break;
|
|
|
|
|
|
- case LINE6_DEVID_TONEPORT_UX1:
|
|
|
|
case LINE6_DEVID_TONEPORT_UX2:
|
|
case LINE6_DEVID_TONEPORT_UX2:
|
|
|
|
+ case LINE6_DEVID_PODSTUDIO_UX2:
|
|
switch (interface_number) {
|
|
switch (interface_number) {
|
|
case 0:
|
|
case 0:
|
|
/* defaults to 44.1kHz, 16-bit */
|
|
/* defaults to 44.1kHz, 16-bit */
|
|
alternate = 2;
|
|
alternate = 2;
|
|
break;
|
|
break;
|
|
case 1:
|
|
case 1:
|
|
- alternate = 0;
|
|
|
|
|
|
+ /* don't know yet what this is ...
|
|
|
|
+ alternate = 1;
|
|
break;
|
|
break;
|
|
|
|
+ */
|
|
|
|
+ return -ENODEV;
|
|
default:
|
|
default:
|
|
MISSING_CASE;
|
|
MISSING_CASE;
|
|
}
|
|
}
|
|
@@ -783,7 +838,6 @@ static int line6_probe(struct usb_interface *interface, const struct usb_device_
|
|
case LINE6_DEVID_BASSPODXT:
|
|
case LINE6_DEVID_BASSPODXT:
|
|
case LINE6_DEVID_BASSPODXTLIVE:
|
|
case LINE6_DEVID_BASSPODXTLIVE:
|
|
case LINE6_DEVID_BASSPODXTPRO:
|
|
case LINE6_DEVID_BASSPODXTPRO:
|
|
- case LINE6_DEVID_POCKETPOD:
|
|
|
|
case LINE6_DEVID_PODXT:
|
|
case LINE6_DEVID_PODXT:
|
|
case LINE6_DEVID_PODXTPRO:
|
|
case LINE6_DEVID_PODXTPRO:
|
|
size = sizeof(struct usb_line6_pod);
|
|
size = sizeof(struct usb_line6_pod);
|
|
@@ -791,6 +845,12 @@ static int line6_probe(struct usb_interface *interface, const struct usb_device_
|
|
ep_write = 0x03;
|
|
ep_write = 0x03;
|
|
break;
|
|
break;
|
|
|
|
|
|
|
|
+ case LINE6_DEVID_POCKETPOD:
|
|
|
|
+ size = sizeof(struct usb_line6_pod);
|
|
|
|
+ ep_read = 0x82;
|
|
|
|
+ ep_write = 0x02;
|
|
|
|
+ break;
|
|
|
|
+
|
|
case LINE6_DEVID_PODX3:
|
|
case LINE6_DEVID_PODX3:
|
|
case LINE6_DEVID_PODX3LIVE:
|
|
case LINE6_DEVID_PODX3LIVE:
|
|
/* currently unused! */
|
|
/* currently unused! */
|
|
@@ -799,6 +859,9 @@ static int line6_probe(struct usb_interface *interface, const struct usb_device_
|
|
ep_write = 0x01;
|
|
ep_write = 0x01;
|
|
break;
|
|
break;
|
|
|
|
|
|
|
|
+ case LINE6_DEVID_PODSTUDIO_GX:
|
|
|
|
+ case LINE6_DEVID_PODSTUDIO_UX1:
|
|
|
|
+ case LINE6_DEVID_PODSTUDIO_UX2:
|
|
case LINE6_DEVID_TONEPORT_GX:
|
|
case LINE6_DEVID_TONEPORT_GX:
|
|
case LINE6_DEVID_TONEPORT_UX1:
|
|
case LINE6_DEVID_TONEPORT_UX1:
|
|
case LINE6_DEVID_TONEPORT_UX2:
|
|
case LINE6_DEVID_TONEPORT_UX2:
|
|
@@ -925,17 +988,17 @@ static int line6_probe(struct usb_interface *interface, const struct usb_device_
|
|
case LINE6_DEVID_PODX3LIVE:
|
|
case LINE6_DEVID_PODX3LIVE:
|
|
case LINE6_DEVID_PODXT:
|
|
case LINE6_DEVID_PODXT:
|
|
case LINE6_DEVID_PODXTPRO:
|
|
case LINE6_DEVID_PODXTPRO:
|
|
- ret = pod_init(interface, (struct usb_line6_pod *)line6);
|
|
|
|
|
|
+ ret = line6_pod_init(interface, (struct usb_line6_pod *)line6);
|
|
break;
|
|
break;
|
|
|
|
|
|
case LINE6_DEVID_PODXTLIVE:
|
|
case LINE6_DEVID_PODXTLIVE:
|
|
switch (interface_number) {
|
|
switch (interface_number) {
|
|
case PODXTLIVE_INTERFACE_POD:
|
|
case PODXTLIVE_INTERFACE_POD:
|
|
- ret = pod_init(interface, (struct usb_line6_pod *)line6);
|
|
|
|
|
|
+ ret = line6_pod_init(interface, (struct usb_line6_pod *)line6);
|
|
break;
|
|
break;
|
|
|
|
|
|
case PODXTLIVE_INTERFACE_VARIAX:
|
|
case PODXTLIVE_INTERFACE_VARIAX:
|
|
- ret = variax_init(interface, (struct usb_line6_variax *)line6);
|
|
|
|
|
|
+ ret = line6_variax_init(interface, (struct usb_line6_variax *)line6);
|
|
break;
|
|
break;
|
|
|
|
|
|
default:
|
|
default:
|
|
@@ -948,14 +1011,17 @@ static int line6_probe(struct usb_interface *interface, const struct usb_device_
|
|
break;
|
|
break;
|
|
|
|
|
|
case LINE6_DEVID_VARIAX:
|
|
case LINE6_DEVID_VARIAX:
|
|
- ret = variax_init(interface, (struct usb_line6_variax *)line6);
|
|
|
|
|
|
+ ret = line6_variax_init(interface, (struct usb_line6_variax *)line6);
|
|
break;
|
|
break;
|
|
|
|
|
|
|
|
+ case LINE6_DEVID_PODSTUDIO_GX:
|
|
|
|
+ case LINE6_DEVID_PODSTUDIO_UX1:
|
|
|
|
+ case LINE6_DEVID_PODSTUDIO_UX2:
|
|
case LINE6_DEVID_TONEPORT_GX:
|
|
case LINE6_DEVID_TONEPORT_GX:
|
|
case LINE6_DEVID_TONEPORT_UX1:
|
|
case LINE6_DEVID_TONEPORT_UX1:
|
|
case LINE6_DEVID_TONEPORT_UX2:
|
|
case LINE6_DEVID_TONEPORT_UX2:
|
|
case LINE6_DEVID_GUITARPORT:
|
|
case LINE6_DEVID_GUITARPORT:
|
|
- ret = toneport_init(interface, (struct usb_line6_toneport *)line6);
|
|
|
|
|
|
+ ret = line6_toneport_init(interface, (struct usb_line6_toneport *)line6);
|
|
break;
|
|
break;
|
|
|
|
|
|
default:
|
|
default:
|
|
@@ -971,10 +1037,23 @@ static int line6_probe(struct usb_interface *interface, const struct usb_device_
|
|
if (ret < 0)
|
|
if (ret < 0)
|
|
goto err_destruct;
|
|
goto err_destruct;
|
|
|
|
|
|
|
|
+ /* creation of additional special files should go here */
|
|
|
|
+
|
|
dev_info(&interface->dev, "Line6 %s now attached\n",
|
|
dev_info(&interface->dev, "Line6 %s now attached\n",
|
|
line6->properties->name);
|
|
line6->properties->name);
|
|
line6_devices[devnum] = line6;
|
|
line6_devices[devnum] = line6;
|
|
- line6_list_devices();
|
|
|
|
|
|
+
|
|
|
|
+ switch(product) {
|
|
|
|
+ case LINE6_DEVID_PODX3:
|
|
|
|
+ case LINE6_DEVID_PODX3LIVE:
|
|
|
|
+ dev_info(&interface->dev, "NOTE: the Line6 %s is detected, but not yet supported\n",
|
|
|
|
+ line6->properties->name);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /* increment reference counters: */
|
|
|
|
+ usb_get_intf(interface);
|
|
|
|
+ usb_get_dev(usbdev);
|
|
|
|
+
|
|
return 0;
|
|
return 0;
|
|
|
|
|
|
err_destruct:
|
|
err_destruct:
|
|
@@ -1000,6 +1079,8 @@ static void line6_disconnect(struct usb_interface *interface)
|
|
if (usbdev == NULL)
|
|
if (usbdev == NULL)
|
|
return;
|
|
return;
|
|
|
|
|
|
|
|
+ /* removal of additional special files should go here */
|
|
|
|
+
|
|
sysfs_remove_link(&interface->dev.kobj, "usb_device");
|
|
sysfs_remove_link(&interface->dev.kobj, "usb_device");
|
|
|
|
|
|
interface_number = interface->cur_altsetting->desc.bInterfaceNumber;
|
|
interface_number = interface->cur_altsetting->desc.bInterfaceNumber;
|
|
@@ -1007,7 +1088,7 @@ static void line6_disconnect(struct usb_interface *interface)
|
|
|
|
|
|
if (line6 != NULL) {
|
|
if (line6 != NULL) {
|
|
if (line6->urb_listen != NULL)
|
|
if (line6->urb_listen != NULL)
|
|
- usb_kill_urb(line6->urb_listen);
|
|
|
|
|
|
+ line6_stop_listen(line6);
|
|
|
|
|
|
if (usbdev != line6->usbdev)
|
|
if (usbdev != line6->usbdev)
|
|
dev_err(line6->ifcdev,
|
|
dev_err(line6->ifcdev,
|
|
@@ -1022,31 +1103,34 @@ static void line6_disconnect(struct usb_interface *interface)
|
|
case LINE6_DEVID_PODX3LIVE:
|
|
case LINE6_DEVID_PODX3LIVE:
|
|
case LINE6_DEVID_PODXT:
|
|
case LINE6_DEVID_PODXT:
|
|
case LINE6_DEVID_PODXTPRO:
|
|
case LINE6_DEVID_PODXTPRO:
|
|
- pod_disconnect(interface);
|
|
|
|
|
|
+ line6_pod_disconnect(interface);
|
|
break;
|
|
break;
|
|
|
|
|
|
case LINE6_DEVID_PODXTLIVE:
|
|
case LINE6_DEVID_PODXTLIVE:
|
|
switch (interface_number) {
|
|
switch (interface_number) {
|
|
case PODXTLIVE_INTERFACE_POD:
|
|
case PODXTLIVE_INTERFACE_POD:
|
|
- pod_disconnect(interface);
|
|
|
|
|
|
+ line6_pod_disconnect(interface);
|
|
break;
|
|
break;
|
|
|
|
|
|
case PODXTLIVE_INTERFACE_VARIAX:
|
|
case PODXTLIVE_INTERFACE_VARIAX:
|
|
- variax_disconnect(interface);
|
|
|
|
|
|
+ line6_variax_disconnect(interface);
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
break;
|
|
break;
|
|
|
|
|
|
case LINE6_DEVID_VARIAX:
|
|
case LINE6_DEVID_VARIAX:
|
|
- variax_disconnect(interface);
|
|
|
|
|
|
+ line6_variax_disconnect(interface);
|
|
break;
|
|
break;
|
|
|
|
|
|
|
|
+ case LINE6_DEVID_PODSTUDIO_GX:
|
|
|
|
+ case LINE6_DEVID_PODSTUDIO_UX1:
|
|
|
|
+ case LINE6_DEVID_PODSTUDIO_UX2:
|
|
case LINE6_DEVID_TONEPORT_GX:
|
|
case LINE6_DEVID_TONEPORT_GX:
|
|
case LINE6_DEVID_TONEPORT_UX1:
|
|
case LINE6_DEVID_TONEPORT_UX1:
|
|
case LINE6_DEVID_TONEPORT_UX2:
|
|
case LINE6_DEVID_TONEPORT_UX2:
|
|
case LINE6_DEVID_GUITARPORT:
|
|
case LINE6_DEVID_GUITARPORT:
|
|
- toneport_disconnect(interface);
|
|
|
|
|
|
+ line6_toneport_disconnect(interface);
|
|
break;
|
|
break;
|
|
|
|
|
|
default:
|
|
default:
|
|
@@ -1055,10 +1139,9 @@ static void line6_disconnect(struct usb_interface *interface)
|
|
|
|
|
|
dev_info(&interface->dev, "Line6 %s now disconnected\n", line6->properties->name);
|
|
dev_info(&interface->dev, "Line6 %s now disconnected\n", line6->properties->name);
|
|
|
|
|
|
- for (i = LINE6_MAX_DEVICES; i--;) {
|
|
|
|
|
|
+ for (i = LINE6_MAX_DEVICES; i--;)
|
|
if (line6_devices[i] == line6)
|
|
if (line6_devices[i] == line6)
|
|
line6_devices[i] = NULL;
|
|
line6_devices[i] = NULL;
|
|
- }
|
|
|
|
}
|
|
}
|
|
|
|
|
|
line6_destruct(interface);
|
|
line6_destruct(interface);
|
|
@@ -1066,14 +1149,78 @@ static void line6_disconnect(struct usb_interface *interface)
|
|
/* decrement reference counters: */
|
|
/* decrement reference counters: */
|
|
usb_put_intf(interface);
|
|
usb_put_intf(interface);
|
|
usb_put_dev(usbdev);
|
|
usb_put_dev(usbdev);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+#ifdef CONFIG_PM
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+ Suspend Line6 device.
|
|
|
|
+*/
|
|
|
|
+static int line6_suspend(struct usb_interface *interface, pm_message_t message)
|
|
|
|
+{
|
|
|
|
+ struct usb_line6 *line6 = usb_get_intfdata(interface);
|
|
|
|
+ struct snd_line6_pcm *line6pcm = line6->line6pcm;
|
|
|
|
+
|
|
|
|
+ snd_power_change_state(line6->card, SNDRV_CTL_POWER_D3hot);
|
|
|
|
+
|
|
|
|
+ if (line6->properties->capabilities & LINE6_BIT_CONTROL)
|
|
|
|
+ line6_stop_listen(line6);
|
|
|
|
+
|
|
|
|
+ if (line6pcm != NULL) {
|
|
|
|
+ snd_pcm_suspend_all(line6pcm->pcm);
|
|
|
|
+ line6_pcm_disconnect(line6pcm);
|
|
|
|
+ line6pcm->flags = 0;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+ Resume Line6 device.
|
|
|
|
+*/
|
|
|
|
+static int line6_resume(struct usb_interface *interface)
|
|
|
|
+{
|
|
|
|
+ struct usb_line6 *line6 = usb_get_intfdata(interface);
|
|
|
|
+
|
|
|
|
+ if (line6->properties->capabilities & LINE6_BIT_CONTROL)
|
|
|
|
+ line6_start_listen(line6);
|
|
|
|
+
|
|
|
|
+ snd_power_change_state(line6->card, SNDRV_CTL_POWER_D0);
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+ Resume Line6 device after reset.
|
|
|
|
+*/
|
|
|
|
+static int line6_reset_resume(struct usb_interface *interface)
|
|
|
|
+{
|
|
|
|
+ struct usb_line6 *line6 = usb_get_intfdata(interface);
|
|
|
|
|
|
- line6_list_devices();
|
|
|
|
|
|
+ switch (line6->usbdev->descriptor.idProduct) {
|
|
|
|
+ case LINE6_DEVID_PODSTUDIO_GX:
|
|
|
|
+ case LINE6_DEVID_PODSTUDIO_UX1:
|
|
|
|
+ case LINE6_DEVID_PODSTUDIO_UX2:
|
|
|
|
+ case LINE6_DEVID_TONEPORT_GX:
|
|
|
|
+ case LINE6_DEVID_TONEPORT_UX1:
|
|
|
|
+ case LINE6_DEVID_TONEPORT_UX2:
|
|
|
|
+ case LINE6_DEVID_GUITARPORT:
|
|
|
|
+ line6_toneport_reset_resume((struct usb_line6_toneport *)line6);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return line6_resume(interface);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+#endif /* CONFIG_PM */
|
|
|
|
+
|
|
static struct usb_driver line6_driver = {
|
|
static struct usb_driver line6_driver = {
|
|
.name = DRIVER_NAME,
|
|
.name = DRIVER_NAME,
|
|
.probe = line6_probe,
|
|
.probe = line6_probe,
|
|
.disconnect = line6_disconnect,
|
|
.disconnect = line6_disconnect,
|
|
|
|
+#ifdef CONFIG_PM
|
|
|
|
+ .suspend = line6_suspend,
|
|
|
|
+ .resume = line6_resume,
|
|
|
|
+ .reset_resume = line6_reset_resume,
|
|
|
|
+#endif
|
|
.id_table = line6_id_table,
|
|
.id_table = line6_id_table,
|
|
};
|
|
};
|
|
|
|
|
|
@@ -1086,20 +1233,27 @@ static int __init line6_init(void)
|
|
|
|
|
|
printk(KERN_INFO "%s driver version %s%s\n",
|
|
printk(KERN_INFO "%s driver version %s%s\n",
|
|
DRIVER_NAME, DRIVER_VERSION, DRIVER_REVISION);
|
|
DRIVER_NAME, DRIVER_VERSION, DRIVER_REVISION);
|
|
- line6_workqueue = create_workqueue(DRIVER_NAME);
|
|
|
|
-
|
|
|
|
- if (line6_workqueue == NULL) {
|
|
|
|
- err("couldn't create workqueue");
|
|
|
|
- return -EINVAL;
|
|
|
|
- }
|
|
|
|
|
|
|
|
for (i = LINE6_MAX_DEVICES; i--;)
|
|
for (i = LINE6_MAX_DEVICES; i--;)
|
|
line6_devices[i] = NULL;
|
|
line6_devices[i] = NULL;
|
|
|
|
|
|
retval = usb_register(&line6_driver);
|
|
retval = usb_register(&line6_driver);
|
|
|
|
|
|
- if (retval)
|
|
|
|
|
|
+ if (retval) {
|
|
err("usb_register failed. Error number %d", retval);
|
|
err("usb_register failed. Error number %d", retval);
|
|
|
|
+ return retval;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ line6_request_version = kmalloc(sizeof(line6_request_version0),
|
|
|
|
+ GFP_KERNEL);
|
|
|
|
+
|
|
|
|
+ if (line6_request_version == NULL) {
|
|
|
|
+ err("Out of memory");
|
|
|
|
+ return -ENOMEM;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ memcpy((char *)line6_request_version, line6_request_version0,
|
|
|
|
+ sizeof(line6_request_version0));
|
|
|
|
|
|
return retval;
|
|
return retval;
|
|
}
|
|
}
|
|
@@ -1109,7 +1263,7 @@ static int __init line6_init(void)
|
|
*/
|
|
*/
|
|
static void __exit line6_exit(void)
|
|
static void __exit line6_exit(void)
|
|
{
|
|
{
|
|
- destroy_workqueue(line6_workqueue);
|
|
|
|
|
|
+ kfree(line6_request_version);
|
|
usb_deregister(&line6_driver);
|
|
usb_deregister(&line6_driver);
|
|
}
|
|
}
|
|
|
|
|