snd-usb-audio: Playback and MIDI support for Novation Twitch DJ controller
PATCH 1/2 snd-usb-audio: Playback and MIDI support for Novation Twitch DJ controller
The hardware also has a PCM capture device which is not implemented in this patch.
It may be possible to generalise this to Saffire 6 USB support and some of the other Focusrite interfaces, but as I don't have access to these devices we should wait until capture support is working first.
Capture support is not implemented because the code assumes the endpoint to have its own interface (instead, it shares the interface with playback) and some thought will be needed to lift this limitation.
--- sound/usb/quirks-table.h | 40 ++++++++++++++++++++++++++++++++++++++++ sound/usb/quirks.c | 15 +++++++++++++++ 2 files changed, 55 insertions(+)
sound/usb/quirks-table.h +40 -0
@@ -2677,6 +2677,46 @@ YAMAHA_DEVICE(0x7010, "UB99"), } }, { + USB_DEVICE(0x1235, 0x0018), + .driver_info = (unsigned long ) & (const struct snd_usb_audio_quirk ) { + .vendor_name ="Novation" , + .product_name ="Twitch" , + .ifnum =QUIRK_ANY_INTERFACE , + .type =QUIRK_COMPOSITE , + .data = (const struct snd_usb_audio_quirk []) { + { + .ifnum =0 , + .type =QUIRK_AUDIO_FIXED_ENDPOINT , + .data = & (const struct audioformat ) { + .formats =SNDRV_PCM_FMTBIT_S24_3LE , + .channels =4 , + .iface =0 , + .altsetting =1 , + .altset_idx =1 , + .attributes =UAC_EP_CS_ATTR_SAMPLE_RATE , + .endpoint =0x01 , + .ep_attr =USB_ENDPOINT_XFER_ISOC , + .rates =SNDRV_PCM_RATE_44100 | +SNDRV_PCM_RATE_48000 , + .rate_min =44100 , + .rate_max =48000 , + .nr_rates =2 , + .rate_table = (unsigned int []) { +44100 ,48000 + } + } + }, + { + .ifnum =1 , + .type =QUIRK_MIDI_RAW_BYTES + }, + { + .ifnum =-1 + } + } + } +}, +{ USB_DEVICE_VENDOR_SPEC(0x1235, 0x4661), .driver_info = (unsigned long ) & (const struct snd_usb_audio_quirk ) { .vendor_name ="Novation" ,
sound/usb/quirks.c +15 -0
@@ -446,6 +446,17 @@ static int snd_usb_cm6206_boot_quirk(struct usb_device *dev) }/* +* Novation Twitch DJ controller +*/ +static int snd_usb_twitch_boot_quirk (struct usb_device *dev) +{ +/* preemptively set up the device because otherwise the +* raw MIDI endpoints are not active */ +usb_set_interface (dev,0 ,1 ); +return 0 ; +} + +/* * This call will put the synth in "USB send" mode, i.e it will send MIDI * messages through USB (this is disabled at startup). The synth will * acknowledge by sending a sysex on endpoint 0x85 and by displaying a USB
@@ -746,6 +757,10 @@ int snd_usb_apply_boot_quirk(struct usb_device *dev,/* Digidesign Mbox 2 */ return snd_usb_mbox2_boot_quirk (dev); +case USB_ID (0x1235 ,0x0018 ): +/* Focusrite Novation Twitch */ +return snd_usb_twitch_boot_quirk (dev); +case USB_ID (0x133e ,0x0815 ):/* Access Music VirusTI Desktop */ return snd_usb_accessmusic_boot_quirk (dev);
Signature · 1 line
1.7.12.1
PATCH 2/2 snd-usb-audio: Trust fields given in the quirk
The maxpacksize field is given in some quirks, but it gets ignored (in favour of wMaxPacketSize from the first endpoint.) This patch favours the one in the quirk.
Digidesign Mbox and Mbox 2 are the only affected quirks and the devices are assumed to be working without this patch. So for safety against the values in the quirk being incorrect, remove them.
The datainterval is also ignored but there are not currently any quirks which choose to override this.
--- sound/usb/quirks-table.h | 3 --- sound/usb/quirks.c | 6 ++++-- 2 files changed, 4 insertions(+), 5 deletions(-)
sound/usb/quirks-table.h +0 -3
@@ -2965,7 +2965,6 @@ YAMAHA_DEVICE(0x7010, "UB99"), .attributes = UAC_EP_CS_ATTR_SAMPLE_RATE, .endpoint = 0x02, .ep_attr = 0x01, - .maxpacksize = 0x130, .rates =SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000, .rate_min = 44100,
@@ -3013,7 +3012,6 @@ YAMAHA_DEVICE(0x7010, "UB99"), .attributes = 0x00, .endpoint = 0x03, .ep_attr = USB_ENDPOINT_SYNC_ASYNC, - .maxpacksize = 0x128, .rates = SNDRV_PCM_RATE_48000, .rate_min = 48000, .rate_max = 48000,
@@ -3039,7 +3037,6 @@ YAMAHA_DEVICE(0x7010, "UB99"), .attributes = UAC_EP_CS_ATTR_SAMPLE_RATE, .endpoint = 0x85, .ep_attr = USB_ENDPOINT_SYNC_SYNC, - .maxpacksize = 0x128, .rates = SNDRV_PCM_RATE_48000, .rate_min = 48000, .rate_max = 48000,
sound/usb/quirks.c +4 -2
@@ -165,8 +165,10 @@ static int create_fixed_stream_quirk(struct snd_usb_audio *chip,return -EINVAL ; } alts = &iface->altsetting[fp->altset_idx]; - fp->datainterval =snd_usb_parse_datainterval (chip, alts); - fp->maxpacksize =le16_to_cpu (get_endpoint (alts,0 )->wMaxPacketSize); +if (fp->datainterval ==0 ) + fp->datainterval =snd_usb_parse_datainterval (chip, alts); +if (fp->maxpacksize ==0 ) + fp->maxpacksize =le16_to_cpu (get_endpoint (alts,0 )->wMaxPacketSize);usb_set_interface (chip->dev, fp->iface,0 );snd_usb_init_pitch (chip, fp->iface, alts, fp);snd_usb_init_sample_rate (chip, fp->iface, alts, fp, fp->rate_max);
Signature · 1 line
1.7.12.1
At Sat, 16 Mar 2013 13:22:57 +0000,
Quoted 11 lines · Mark Hills
The hardware also has a PCM capture device which is not implemented in this patch.
It may be possible to generalise this to Saffire 6 USB support and some of the other Focusrite interfaces, but as I don't have access to these devices we should wait until capture support is working first.
Capture support is not implemented because the code assumes the endpoint to have its own interface (instead, it shares the interface with playback) and some thought will be needed to lift this limitation.
Both patches look OK to apply, but could you give your sign-off?
thanks,
Takashi
Quoted 92 lines
--- sound/usb/quirks-table.h | 40 ++++++++++++++++++++++++++++++++++++++++ sound/usb/quirks.c | 15 +++++++++++++++ 2 files changed, 55 insertions(+)sound/usb/quirks-table.h +40
-0@@ -2677,6 +2677,46 @@ YAMAHA_DEVICE(0x7010, "UB99"), } }, { + USB_DEVICE(0x1235, 0x0018), + .driver_info = (unsigned long ) & (const struct snd_usb_audio_quirk ) { + .vendor_name ="Novation" , + .product_name ="Twitch" , + .ifnum =QUIRK_ANY_INTERFACE , + .type =QUIRK_COMPOSITE , + .data = (const struct snd_usb_audio_quirk []) { + { + .ifnum =0 , + .type =QUIRK_AUDIO_FIXED_ENDPOINT , + .data = & (const struct audioformat ) { + .formats =SNDRV_PCM_FMTBIT_S24_3LE , + .channels =4 , + .iface =0 , + .altsetting =1 , + .altset_idx =1 , + .attributes =UAC_EP_CS_ATTR_SAMPLE_RATE , + .endpoint =0x01 , + .ep_attr =USB_ENDPOINT_XFER_ISOC , + .rates =SNDRV_PCM_RATE_44100 | +SNDRV_PCM_RATE_48000 , + .rate_min =44100 , + .rate_max =48000 , + .nr_rates =2 , + .rate_table = (unsigned int []) { +44100 ,48000 + } + } + }, + { + .ifnum =1 , + .type =QUIRK_MIDI_RAW_BYTES + }, + { + .ifnum =-1 + } + } + } +}, +{ USB_DEVICE_VENDOR_SPEC(0x1235, 0x4661), .driver_info = (unsigned long ) & (const struct snd_usb_audio_quirk ) { .vendor_name ="Novation" ,sound/usb/quirks.c +15
-0@@ -446,6 +446,17 @@ static int snd_usb_cm6206_boot_quirk(struct usb_device *dev) }/* +* Novation Twitch DJ controller +*/ +static int snd_usb_twitch_boot_quirk (struct usb_device *dev) +{ +/* preemptively set up the device because otherwise the +* raw MIDI endpoints are not active */ +usb_set_interface (dev,0 ,1 ); +return 0 ; +} + +/* * This call will put the synth in "USB send" mode, i.e it will send MIDI * messages through USB (this is disabled at startup). The synth will * acknowledge by sending a sysex on endpoint 0x85 and by displaying a USB @@ -746,6 +757,10 @@ int snd_usb_apply_boot_quirk(struct usb_device *dev,/* Digidesign Mbox 2 */ return snd_usb_mbox2_boot_quirk (dev); +case USB_ID (0x1235 ,0x0018 ): +/* Focusrite Novation Twitch */ +return snd_usb_twitch_boot_quirk (dev); +case USB_ID (0x133e ,0x0815 ):/* Access Music VirusTI Desktop */ return snd_usb_accessmusic_boot_quirk (dev);Signature · 1 line
1.7.12.1
On Sun, 17 Mar 2013, Takashi Iwai wrote:
[...]
Quoted 1 line
Both patches look OK to apply, but could you give your sign-off?
Of course! Sorry about that. I re-sent the patches direct to you. Thanks
Signature · 1 line
Mark
At Sun, 17 Mar 2013 11:09:02 +0000 (GMT),
Quoted 7 lines · Mark Hills
On Sun, 17 Mar 2013, Takashi Iwai wrote:
[...]
Quoted 1 line
Both patches look OK to apply, but could you give your sign-off?
Of course! Sorry about that. I re-sent the patches direct to you. Thanks
Applied now. Thanks!
Takashi