提交 ad1e34b5 编写于 作者: D Daniel Mack 提交者: Jaroslav Kysela

[ALSA] caiaq - support for Native Instrument's RigKontrol3

This patch adds support for Native Instrument's upcoming
RigKontrol3 sound interface.
Signed-off-by: NDaniel Mack <daniel@caiaq.de>
Signed-off-by: NTakashi Iwai <tiwai@suse.de>
Signed-off-by: NJaroslav Kysela <perex@suse.cz>
上级 1cf0bc7e
......@@ -40,6 +40,7 @@ config SND_USB_CAIAQ
namely:
* Native Instruments RigKontrol2
* Native Instruments RigKontrol3
* Native Instruments Kore Controller
* Native Instruments Audio Kontrol 1
* Native Instruments Audio 8 DJ
......@@ -55,6 +56,7 @@ config SND_USB_CAIAQ_INPUT
alpha dials and analog pedals on the following products:
* Native Instruments RigKontrol2
* Native Instruments RigKontrol3
* Native Instruments Audio Kontrol 1
endmenu
......
......@@ -648,6 +648,7 @@ int __devinit snd_usb_caiaq_audio_init(struct snd_usb_caiaqdev *dev)
dev->samplerates = dev->pcm_info.rates;
switch (dev->chip.usb_id) {
case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AK1):
case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL3):
dev->samplerates |= SNDRV_PCM_RATE_88200;
dev->samplerates |= SNDRV_PCM_RATE_192000;
break;
......
......@@ -41,9 +41,10 @@
#endif
MODULE_AUTHOR("Daniel Mack <daniel@caiaq.de>");
MODULE_DESCRIPTION("caiaq USB audio, version 1.1.0");
MODULE_DESCRIPTION("caiaq USB audio, version 1.2.0");
MODULE_LICENSE("GPL");
MODULE_SUPPORTED_DEVICE("{{Native Instruments, RigKontrol2},"
"{Native Instruments, RigKontrol3},"
"{Native Instruments, Kore Controller},"
"{Native Instruments, Audio Kontrol 1}"
"{Native Instruments, Audio 8 DJ}}");
......@@ -82,6 +83,11 @@ static struct usb_device_id snd_usb_id_table[] = {
.idVendor = USB_VID_NATIVEINSTRUMENTS,
.idProduct = USB_PID_RIGKONTROL2
},
{
.match_flags = USB_DEVICE_ID_MATCH_DEVICE,
.idVendor = USB_VID_NATIVEINSTRUMENTS,
.idProduct = USB_PID_RIGKONTROL3
},
{
.match_flags = USB_DEVICE_ID_MATCH_DEVICE,
.idVendor = USB_VID_NATIVEINSTRUMENTS,
......@@ -226,7 +232,7 @@ int snd_usb_caiaq_set_auto_msg (struct snd_usb_caiaqdev *dev,
static void setup_card(struct snd_usb_caiaqdev *dev)
{
int ret;
char val[3];
char val[4];
/* device-specific startup specials */
switch (dev->chip.usb_id) {
......@@ -237,6 +243,14 @@ static void setup_card(struct snd_usb_caiaqdev *dev)
val[2] = 0x01;
send_command(dev, EP1_CMD_WRITE_IO, val, 3);
break;
case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL3):
/* RigKontrol2 - display two centered dashes ('--') */
val[0] = 0x00;
val[1] = 0x40;
val[2] = 0x40;
val[3] = 0x00;
send_command(dev, EP1_CMD_WRITE_IO, val, 4);
break;
case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AK1):
/* Audio Kontrol 1 - make USB-LED stop blinking */
val[0] = 0x00;
......
......@@ -6,6 +6,7 @@
#define USB_VID_NATIVEINSTRUMENTS 0x17cc
#define USB_PID_RIGKONTROL2 0x1969
#define USB_PID_RIGKONTROL3 0x1940
#define USB_PID_KORECONTROLLER 0x4711
#define USB_PID_AK1 0x0815
#define USB_PID_AUDIO8DJ 0x1978
......
......@@ -34,6 +34,8 @@
static unsigned char keycode_ak1[] = { KEY_C, KEY_B, KEY_A };
static unsigned char keycode_rk2[] = { KEY_1, KEY_2, KEY_3, KEY_4,
KEY_5, KEY_6, KEY_7 };
static unsigned char keycode_rk3[] = { KEY_1, KEY_2, KEY_3, KEY_4,
KEY_5, KEY_6, KEY_7, KEY_5, KEY_6 };
#define DEG90 (range/2)
#define DEG180 (range)
......@@ -107,7 +109,8 @@ static unsigned int decode_erp(unsigned char a, unsigned char b)
static void snd_caiaq_input_read_analog(struct snd_usb_caiaqdev *dev,
const char *buf, unsigned int len)
const unsigned char *buf,
unsigned int len)
{
switch(dev->input_dev->id.product) {
case USB_PID_RIGKONTROL2:
......@@ -116,6 +119,12 @@ static void snd_caiaq_input_read_analog(struct snd_usb_caiaqdev *dev,
input_report_abs(dev->input_dev, ABS_Z, (buf[2] << 8) |buf[3]);
input_sync(dev->input_dev);
break;
case USB_PID_RIGKONTROL3:
input_report_abs(dev->input_dev, ABS_X, (buf[0] << 8) |buf[1]);
input_report_abs(dev->input_dev, ABS_Y, (buf[2] << 8) |buf[3]);
input_report_abs(dev->input_dev, ABS_Z, (buf[4] << 8) |buf[5]);
input_sync(dev->input_dev);
break;
}
}
......@@ -128,7 +137,7 @@ static void snd_caiaq_input_read_erp(struct snd_usb_caiaqdev *dev,
case USB_PID_AK1:
i = decode_erp(buf[0], buf[1]);
input_report_abs(dev->input_dev, ABS_X, i);
input_sync(dev->input_dev);
input_sync(dev->input_dev);
break;
}
}
......@@ -204,6 +213,20 @@ int snd_usb_caiaq_input_init(struct snd_usb_caiaqdev *dev)
input_set_abs_params(input, ABS_Z, 0, 4096, 0, 10);
snd_usb_caiaq_set_auto_msg(dev, 1, 10, 0);
break;
case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL3):
input->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
input->absbit[0] = BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_Z);
input->keycode = keycode_rk3;
input->keycodesize = sizeof(char);
input->keycodemax = ARRAY_SIZE(keycode_rk3);
for (i=0; i<ARRAY_SIZE(keycode_rk3); i++)
set_bit(keycode_rk3[i], input->keybit);
input_set_abs_params(input, ABS_X, 0, 1024, 0, 10);
input_set_abs_params(input, ABS_Y, 0, 1024, 0, 10);
input_set_abs_params(input, ABS_Z, 0, 1024, 0, 10);
snd_usb_caiaq_set_auto_msg(dev, 1, 10, 0);
break;
case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AK1):
input->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
input->absbit[0] = BIT(ABS_X);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册