[alsa-devel] [PATCH] MIDI driver for Behringer BCD2000 USB device

Daniel Mack daniel at zonque.org
Thu Feb 20 13:44:59 CET 2014


On 02/20/2014 01:31 PM, Mario Kicherer wrote:
> 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. 

...

> +static int bcd2000_probe(struct usb_interface *interface,
> +				const struct usb_device_id *usb_id)
> +{

...

> +	usb_set_intfdata(interface, bcd2k);
> +	devices_used[card_index/sizeof(int)*8] |=
> +		1 << (card_index%(sizeof(int)*8));
> +

...

> +static void bcd2000_disconnect(struct usb_interface *interface)
> +{

...

> +	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().




More information about the Alsa-devel mailing list