Skip to contentSkip to conversation

MIDI driver for Behringer BCD2000 USB device

PATCH In review Mario Kicherer 2 participants 2 messages Feb 20, 2014 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 MIDI driver for Behringer BCD2000 USB device

This patch adds initial support for the Behringer BCD2000 USB DJ controller. At the moment, only the MIDI part of the device is working, i.e. knobs, buttons and LEDs.

I also plan to add support for the audio part, but I assume that this will require more effort than the rather simple MIDI interface. Progress can be tracked at https://github.com/anyc/snd-usb-bcd2000.

Changes since v4:
- devices_used as array to support arbitrary number of SNDRV_CARDS
- removed unused array "enable"

Changes since v3:
- applied style and snd_printk changes as suggested by Daniel Mack

Changes since v2:
- applied more changes from Daniel Mack and Clemens Ladisch

Changes since v1:
- fixed the various code style issues, thanks to Daniel Mack and checkpatch.pl.

---
 sound/usb/Kconfig           |  13 ++
 sound/usb/Makefile          |   2 +-
 sound/usb/bcd2000/Makefile  |   3 +
 sound/usb/bcd2000/bcd2000.c | 490 ++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 507 insertions(+), 1 deletion(-)
 create mode 100644 sound/usb/bcd2000/Makefile
 create mode 100644 sound/usb/bcd2000/bcd2000.c
sound/usb/Kconfig +13 -0
index de9408b..145653a 100644
@@ -146,5 +146,18 @@ config SND_USB_HIFACE
 	  To compile this driver as a module, choose M here: the module
 	  will be called snd-usb-hiface.
 
+config SND_BCD2000
+	tristate "Behringer BCD2000 MIDI driver"
+	select SND_RAWMIDI
+	help
+	  Say Y here to include MIDI support for the Behringer BCD2000 DJ
+	  controller.
+
+	  Audio support is still work-in-progress at
+	  https://github.com/anyc/snd-usb-bcd2000
+
+	  To compile this driver as a module, choose M here: the module
+	  will be called snd-bcd2000.
+
 endif	# SND_USB
 
sound/usb/Makefile +1 -1
index abe668f..2b92f0d 100644
@@ -23,4 +23,4 @@ obj-$(CONFIG_SND_USB_UA101) += snd-usbmidi-lib.o
 obj-$(CONFIG_SND_USB_USX2Y) += snd-usbmidi-lib.o
 obj-$(CONFIG_SND_USB_US122L) += snd-usbmidi-lib.o
 
-obj-$(CONFIG_SND) += misc/ usx2y/ caiaq/ 6fire/ hiface/
+obj-$(CONFIG_SND) += misc/ usx2y/ caiaq/ 6fire/ hiface/ bcd2000/
sound/usb/bcd2000/Makefile new file +3 -0
new file mode 100644
index 0000000..f09ccc0
@@ -0,0 +1,3 @@
+snd-bcd2000-y := bcd2000.o
+
+obj-$(CONFIG_SND_BCD2000) += snd-bcd2000.o
\ No newline at end of file
sound/usb/bcd2000/bcd2000.c new file +490 -0

490 lines not on this page · raw message

Signature · 1 line
1.8.3.2
#1 lore raw
Quoted 7 lines · Mario Kicherer

This patch adds initial support for the Behringer BCD2000 USB DJ controller. At the moment, only the MIDI part of the device is working, i.e. knobs, buttons and LEDs.

I also plan to add support for the audio part, but I assume that this will require more effort than the rather simple MIDI interface. Progress can be tracked at https://github.com/anyc/snd-usb-bcd2000.

...

Quoted 3 lines
sound/usb/bcd2000/bcd2000.c new file +3 -0
+static int bcd2000_probe(struct usb_interface *interface,
+				const struct usb_device_id *usb_id)
+{

...

Quoted 4 lines
sound/usb/bcd2000/bcd2000.c new file +4 -0
+	usb_set_intfdata(interface, bcd2k);
+	devices_used[card_index/sizeof(int)*8] |=
+		1 << (card_index%(sizeof(int)*8));
+

...

Quoted 2 lines
(quoted diff) +2 -0
+static void bcd2000_disconnect(struct usb_interface *interface)
+{

...

sound/usb/bcd2000/bcd2000.c line 455

Quoted 2 lines
sound/usb/bcd2000/bcd2000.c new file +2 -0
+	devices_used[bcd2k->card_index/sizeof(int)*8] &=
+		~(1 << (bcd2k->card_index%(sizeof(int)*8)));

We have much nicer ways of doing this :)

Have a look at include/linux/bitmap.h, especially set_bit(), clear_bit() and DECLARE_BITMAP().