aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb/caiaq/caiaq-input.c
diff options
context:
space:
mode:
authorDaniel Mack <daniel@caiaq.de>2007-09-17 08:45:14 -0400
committerJaroslav Kysela <perex@perex.cz>2007-10-16 10:50:46 -0400
commitad1e34b5653f86cbff2ea45dd166e2e58949d9bb (patch)
tree458dcaa4e760288957e819b745db2c0e0a42b713 /sound/usb/caiaq/caiaq-input.c
parent1cf0bc7e730c4148605164ac542c1c191c1d2e09 (diff)
[ALSA] caiaq - support for Native Instrument's RigKontrol3
This patch adds support for Native Instrument's upcoming RigKontrol3 sound interface. Signed-off-by: Daniel Mack <daniel@caiaq.de> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound/usb/caiaq/caiaq-input.c')
-rw-r--r--sound/usb/caiaq/caiaq-input.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/sound/usb/caiaq/caiaq-input.c b/sound/usb/caiaq/caiaq-input.c
index 6978dabb2258..a1de0c608957 100644
--- a/sound/usb/caiaq/caiaq-input.c
+++ b/sound/usb/caiaq/caiaq-input.c
@@ -34,6 +34,8 @@
34static unsigned char keycode_ak1[] = { KEY_C, KEY_B, KEY_A }; 34static unsigned char keycode_ak1[] = { KEY_C, KEY_B, KEY_A };
35static unsigned char keycode_rk2[] = { KEY_1, KEY_2, KEY_3, KEY_4, 35static unsigned char keycode_rk2[] = { KEY_1, KEY_2, KEY_3, KEY_4,
36 KEY_5, KEY_6, KEY_7 }; 36 KEY_5, KEY_6, KEY_7 };
37static unsigned char keycode_rk3[] = { KEY_1, KEY_2, KEY_3, KEY_4,
38 KEY_5, KEY_6, KEY_7, KEY_5, KEY_6 };
37 39
38#define DEG90 (range/2) 40#define DEG90 (range/2)
39#define DEG180 (range) 41#define DEG180 (range)
@@ -107,7 +109,8 @@ static unsigned int decode_erp(unsigned char a, unsigned char b)
107 109
108 110
109static void snd_caiaq_input_read_analog(struct snd_usb_caiaqdev *dev, 111static void snd_caiaq_input_read_analog(struct snd_usb_caiaqdev *dev,
110 const char *buf, unsigned int len) 112 const unsigned char *buf,
113 unsigned int len)
111{ 114{
112 switch(dev->input_dev->id.product) { 115 switch(dev->input_dev->id.product) {
113 case USB_PID_RIGKONTROL2: 116 case USB_PID_RIGKONTROL2:
@@ -116,6 +119,12 @@ static void snd_caiaq_input_read_analog(struct snd_usb_caiaqdev *dev,
116 input_report_abs(dev->input_dev, ABS_Z, (buf[2] << 8) |buf[3]); 119 input_report_abs(dev->input_dev, ABS_Z, (buf[2] << 8) |buf[3]);
117 input_sync(dev->input_dev); 120 input_sync(dev->input_dev);
118 break; 121 break;
122 case USB_PID_RIGKONTROL3:
123 input_report_abs(dev->input_dev, ABS_X, (buf[0] << 8) |buf[1]);
124 input_report_abs(dev->input_dev, ABS_Y, (buf[2] << 8) |buf[3]);
125 input_report_abs(dev->input_dev, ABS_Z, (buf[4] << 8) |buf[5]);
126 input_sync(dev->input_dev);
127 break;
119 } 128 }
120} 129}
121 130
@@ -128,7 +137,7 @@ static void snd_caiaq_input_read_erp(struct snd_usb_caiaqdev *dev,
128 case USB_PID_AK1: 137 case USB_PID_AK1:
129 i = decode_erp(buf[0], buf[1]); 138 i = decode_erp(buf[0], buf[1]);
130 input_report_abs(dev->input_dev, ABS_X, i); 139 input_report_abs(dev->input_dev, ABS_X, i);
131 input_sync(dev->input_dev); 140 input_sync(dev->input_dev);
132 break; 141 break;
133 } 142 }
134} 143}
@@ -204,6 +213,20 @@ int snd_usb_caiaq_input_init(struct snd_usb_caiaqdev *dev)
204 input_set_abs_params(input, ABS_Z, 0, 4096, 0, 10); 213 input_set_abs_params(input, ABS_Z, 0, 4096, 0, 10);
205 snd_usb_caiaq_set_auto_msg(dev, 1, 10, 0); 214 snd_usb_caiaq_set_auto_msg(dev, 1, 10, 0);
206 break; 215 break;
216 case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL3):
217 input->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
218 input->absbit[0] = BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_Z);
219 input->keycode = keycode_rk3;
220 input->keycodesize = sizeof(char);
221 input->keycodemax = ARRAY_SIZE(keycode_rk3);
222 for (i=0; i<ARRAY_SIZE(keycode_rk3); i++)
223 set_bit(keycode_rk3[i], input->keybit);
224
225 input_set_abs_params(input, ABS_X, 0, 1024, 0, 10);
226 input_set_abs_params(input, ABS_Y, 0, 1024, 0, 10);
227 input_set_abs_params(input, ABS_Z, 0, 1024, 0, 10);
228 snd_usb_caiaq_set_auto_msg(dev, 1, 10, 0);
229 break;
207 case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AK1): 230 case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AK1):
208 input->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 231 input->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
209 input->absbit[0] = BIT(ABS_X); 232 input->absbit[0] = BIT(ABS_X);