anyc / snd-bcd2000

Linux driver for the Behringer BCD2000 DJ controller
GNU General Public License v2.0
24 stars 5 forks source link

I can compile but not working #5

Closed leo-combes closed 9 years ago

leo-combes commented 9 years ago

Hello. This project seems excellent, because the manufacturer does not provide new drivers and the option to use it in Linux is awesome. To test, I downloaded and compiled the whole thing. Then... modprobe snd_rawmidi modprobe snd_usbmidi-lib insmod snd-bcd2000.ko ...without errors.

However syslog output shows me the following:

Feb 10 23:13:15 leo-ThinkPad kernel: [ 2327.566736] usb 1-1.1: new full-speed USB device number 7 using ehci-pci Feb 10 23:13:15 leo-ThinkPad kernel: [ 2327.666870] usb 1-1.1: New USB device found, idVendor=1397, idProduct=00bd Feb 10 23:13:15 leo-ThinkPad kernel: [ 2327.666878] usb 1-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0 Feb 10 23:13:15 leo-ThinkPad kernel: [ 2327.666883] usb 1-1.1: Product: BCD2000
Feb 10 23:13:15 leo-ThinkPad kernel: [ 2327.666886] usb 1-1.1: Manufacturer: Behringer
Feb 10 23:13:15 leo-ThinkPad mtp-probe: checking bus 1, device 7: "/sys/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1" Feb 10 23:13:15 leo-ThinkPad mtp-probe: bus: 1, device: 7 was not an MTP device Feb 10 23:13:15 leo-ThinkPad pulseaudio[1787]: [pulseaudio] module-alsa-card.c: Failed to find a working profile. Feb 10 23:13:15 leo-ThinkPad pulseaudio[1787]: [pulseaudio] module.c: Failed to load module "module-alsa-card" (argument: "device_id="2" name="usb-Behringer_BCD2000-00-BCD2000" card_name="alsa_card.usb-Behringer_BCD2000-00-BCD2000" namereg_fail=false tsched=yes fixed_latency_range=no ignore_dB=no deferred_volume=yes use_ucm=no card_properties="module-udev-detect.discovered=1""): initialization failed.

aplay -l shows me: \ Lista de PLAYBACK dispositivos hardware ** tarjeta 0: MID [HDA Intel MID], dispositivo 0: CX20585 Analog [CX20585 Analog] Subdispositivos: 0/1 Subdispositivo #0: subdevice #0 tarjeta 1: NVidia [HDA NVidia], dispositivo 3: HDMI 0 [HDMI 0] Subdispositivos: 1/1 Subdispositivo #0: subdevice #0 tarjeta 1: NVidia [HDA NVidia], dispositivo 7: HDMI 0 [HDMI 0] Subdispositivos: 1/1 Subdispositivo #0: subdevice #0 tarjeta 1: NVidia [HDA NVidia], dispositivo 8: HDMI 0 [HDMI 0] Subdispositivos: 1/1 Subdispositivo #0: subdevice #0 tarjeta 1: NVidia [HDA NVidia], dispositivo 9: HDMI 0 [HDMI 0] Subdispositivos: 1/1 Subdispositivo #0: subdevice #0

(no Behringer in output...)

However amidi -l show: Dir Device Name IO hw:2,0 BCD2000

it may be failing? it is assumed that in this version the sound should work?

These are the kernel: uname -a Linux leo-ThinkPad 3.13.0-24-generic #47-Ubuntu SMP Fri May 2 23:30:00 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

Thanks for your effort!

anyc commented 9 years ago

Hi, as I wrote in the Readme, the audio part is only available in the audio branch of GIT. The master branch equals the MIDI-only part that was accepted for the official kernel sources. I'm working on submitting the audio support to upstream, too, but it may take a while as they suggested I merge the code with another driver. On the frontpage of this repo you can select different branches or you use this link: https://github.com/anyc/snd-bcd2000/tree/audio

leo-combes commented 9 years ago

You are right, sorry. I do not have much experience in the terminology of GIT. I achieved compile and load the module. I try to use the behringer output with Audacity, I select "BCD2000" as output and returns me an error "Error while opening sound device". Syslog shows me:

Feb 11 16:19:08 leo-ThinkPad kernel: [ 1205.364478] usb 1-1.2: snd-bcd2000: could not start pcm stream

I attempted use with Mixxx, I also returns an error. The log shows me Mixxx:

Debug [Main]: SoundManager::setupDevices() Debug [Main]: SoundDevicePortAudio::open() "5, BCD2000: - (hw:2,0)" Debug [Main]: framesPerBuffer: 1024 Debug [Main]: Requested sample rate: 44100 Hz, latency: 23.22 ms Debug [Main]: Output channels: 2 | Input channels: 0 Debug [Main]: Opening stream with id 5 Expression 'r' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2097 Expression 'PaAlsaStreamComponent_FinishConfigure( &self->playback, hwParamsPlayback, outParams, self->primeBuffers, realSr, outputLatency )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2738 Expression 'PaAlsaStream_Configure( stream, inputParameters, outputParameters, sampleRate, framesPerBuffer, &inputLatency, &outputLatency, &hostBufferSizeMode )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2843 Warning [Main]: Error opening stream: Unanticipated host error

Is there anything I can do?

Greetings.

leo-combes commented 9 years ago

Add more information that may be helpful, if I try to reload alsa, then I get an error:

leo-ThinkPad sub0 # alsa reload Unloading ALSA sound driver modules: snd-hrtimer snd-seq-dummy snd-bcd2000 snd-usbmidi-lib snd-hda-codec-hdmi snd-seq-midi snd-seq-midi-event snd-rawmidi snd-hda-codec-conexant snd-hda-intel snd-hda-codec snd-hwdep snd-pcm snd-seq snd-page-alloc snd-seq-device snd-timer (failed: modules still loaded: snd-bcd2000 snd-hda-codec-hdmi snd-rawmidi snd-hda-codec-conexant snd-hda-intel snd-hda-codec snd-hwdep snd-pcm snd-page-alloc snd-seq-device snd-timer). Loading ALSA sound driver modules: snd-hrtimer snd-seq-dummy snd-bcd2000 snd-usbmidi-lib snd-hda-codec-hdmi snd-seq-midi snd-seq-midi-event snd-rawmidi snd-hda-codec-conexant snd-hda-intel snd-hda-codec snd-hwdep snd-pcm snd-seq snd-page-alloc snd-seq-device snd-timermodprobe: FATAL: Module snd-bcd2000 not found. (failed).

However: leo-ThinkPad snd-bcd2000-audio # insmod snd-bcd2000.ko insmod: ERROR: could not insert module snd-bcd2000.ko: File exists

On the other hand, MIDI seems to operate normally.

anyc commented 9 years ago

Hm, I also use it with mixxx on my thinkpad and it works here. I also tried it once with an old Ubuntu.

According to the error message, something in bcd2000_pcm_stream_start() goes wrong. Could you change a line in the audio.c and recompile it?

Please change line 427&428 from: dev_err(&pcm->bcd2k->dev->dev, PREFIX "could not start pcm stream\n"); to: dev_err(&pcm->bcd2k->dev->dev, PREFIX "could not start pcm stream, error %d\n", ret); ?

So we get at least an error code.

leo-combes commented 9 years ago

Ok, here are the results and I add more details:

When I load the module, syslog says:

Feb 12 09:46:20 leo-ThinkPad kernel: [ 581.082994] snd_bcd2000: module verification failed: signature and/or required key missing - tainting kernel Feb 12 09:46:20 leo-ThinkPad kernel: [ 581.086132] usbcore: registered new interface driver snd-bcd2000

I disconnect the device and when reconnect:

Feb 12 09:47:23 leo-ThinkPad kernel: [ 643.842470] usb 1-1.2: new full-speed USB device number 6 using ehci-pci Feb 12 09:47:23 leo-ThinkPad kernel: [ 643.942460] usb 1-1.2: New USB device found, idVendor=1397, idProduct=00bd Feb 12 09:47:23 leo-ThinkPad kernel: [ 643.942468] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0 Feb 12 09:47:23 leo-ThinkPad kernel: [ 643.942472] usb 1-1.2: Product: BCD2000
Feb 12 09:47:23 leo-ThinkPad kernel: [ 643.942476] usb 1-1.2: Manufacturer: Behringer
Feb 12 09:47:23 leo-ThinkPad mtp-probe: checking bus 1, device 6: "/sys/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2" Feb 12 09:47:23 leo-ThinkPad mtp-probe: bus: 1, device: 6 was not an MTP device Feb 12 09:47:23 leo-ThinkPad rtkit-daemon[1777]: Successfully made thread 3263 of process 1775 (n/a) owned by '1000' RT at priority 5. Feb 12 09:47:23 leo-ThinkPad rtkit-daemon[1777]: Supervising 5 threads of 1 processes of 1 users.

Trying to use the output in audacity:

Feb 12 09:47:47 leo-ThinkPad kernel: [ 667.628132] usb 1-1.2: snd-bcd2000: could not start pcm stream, error -28 Feb 12 09:47:47 leo-ThinkPad kernel: [ 667.826802] usb 1-1.2: snd-bcd2000: could not start pcm stream, error -28 Feb 12 09:47:47 leo-ThinkPad kernel: [ 668.005999] usb 1-1.2: snd-bcd2000: could not start pcm stream, error -28

anyc commented 9 years ago

Okay, thanks. Error code 28 means ENOSPC "no space" and I think this is returned by usb_submit_urb(). I read this usually means that the driver is requesting too much bandwith over USB. Do you use it on a USB 1.1 port or with other USB devices that reserve (independent of if they use it or not) much bandwith like cameras or other sound devices?

leo-combes commented 9 years ago

I have just connected the BCD2000 and an optical mouse. Integrated webcam is shutdown.

lsusb output shows me this:

leo-ThinkPad snd-bcd2000-audio # lsusb Bus 002 Device 003: ID 046d:c05a Logitech, Inc. M90/M100 Optical Mouse Bus 002 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 001 Device 004: ID 17ef:480f Lenovo Integrated Webcam [R5U877] Bus 001 Device 003: ID 147e:2016 Upek Biometric Touchchip/Touchstrip Fingerprint Sensor Bus 001 Device 005: ID 1397:00bd BEHRINGER International GmbH Bus 001 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

I try in other USB port and get this:

Feb 12 14:58:00 leo-ThinkPad kernel: [ 560.239587] usb 2-1.2: snd-bcd2000: could not start pcm stream, error -28 Feb 12 14:58:00 leo-ThinkPad kernel: [ 560.239625] usb 2-1.2: snd-bcd2000: could not start pcm stream, error -28 Feb 12 14:58:00 leo-ThinkPad kernel: [ 560.239689] usb 2-1.2: snd-bcd2000: could not start pcm stream, error -28 Feb 12 14:58:00 leo-ThinkPad kernel: [ 560.239778] usb 2-1.2: snd-bcd2000: could not start pcm stream, error -28 Feb 12 14:58:00 leo-ThinkPad kernel: [ 560.239870] usb 2-1.2: snd-bcd2000: could not start pcm stream, error -28 Feb 12 14:58:00 leo-ThinkPad kernel: [ 560.240187] usb 2-1.2: snd-bcd2000: could not start pcm stream, error -28 Feb 12 14:58:00 leo-ThinkPad kernel: [ 560.240224] usb 2-1.2: snd-bcd2000: could not start pcm stream, error -28 Feb 12 14:58:00 leo-ThinkPad kernel: [ 560.240289] usb 2-1.2: snd-bcd2000: could not start pcm stream, error -28 Feb 12 14:58:00 leo-ThinkPad kernel: [ 560.240418] usb 2-1.2: snd-bcd2000: could not start pcm stream, error -28 Feb 12 14:58:00 leo-ThinkPad kernel: [ 560.240512] usb 2-1.2: snd-bcd2000: could not start pcm stream, error -28 Feb 12 14:58:00 leo-ThinkPad pulseaudio[1772]: [pulseaudio] module-udev-detect.c: Tried to configure /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.0/sound/card2 (alsa_card.usb-Behringer_BCD2000-00-BCD2000) more often than 5 times in 10s

anyc commented 9 years ago

Hm, okay. Could you change line 7 in audio.h from #define USB_N_PACKETS_PER_URB 16 to #define USB_N_PACKETS_PER_URB 8 and try again?

leo-combes commented 9 years ago

Same result:

Feb 12 15:53:26 leo-ThinkPad kernel: [ 396.486474] usb 1-1.1: snd-bcd2000: could not start pcm stream, error -28

anyc commented 9 years ago

Ok, I found no other explanation for this error. So, either another module or device is reserving too much bandwith or the port somehow operates in USB 1.x mode. You could only try to lower this value or USB_N_URBS in the same file further - maybe to 2 and 4 in the first step. If that doesn't help I'm out of ideas right now.

leo-combes commented 9 years ago

I have news. I tried on another computer and it worked perfect, without changing anything. It seems to be a problem with my USBs computer or the version of the kernel or anything else. I continue investigating ...

anyc commented 9 years ago

Ok, good news. It is quite possible that those two values are too high and lowering them would not hurt quality. I only tested it on my machine and it worked. If I have some spare time I'll check if there is a lower limit.

leo-combes commented 9 years ago

All, sound and MIDI, works fine without modifications in Lenovo G470, booting from linux Mint 17 in a USB stick.

Not working with Mint 17 in Thinkpad T410 at all. Maybe is a hardware problem, later I will continue trying. Luckily I need get it to work in G470, so... problem solved for a while.

Thanks for your help and for giving us the possibility to use this hardware in GNU/Linux!

anyc commented 9 years ago

You're welcome. If you find out what is causing the problem, please let me know.

alibabashack commented 6 years ago

I just want to mention, that it works for me on USB3 (xhci) host ports, but not on USB2 (ehci) (where I also get the "could not start pcm stream" error). This was tested on a lenovo X220/I7. However if I use all available channels with jackd, I get an xrun every second or so, which makes the card unusable for audio. However, I am having much fun using the MIDI part with Mixxx, so thank you very much for this driver! Regards Alex

anyc commented 6 years ago

There are parameters (in https://github.com/anyc/snd-bcd2000/blob/audio/audio.h) that control how the audio data is distributed among USB packets. Maybe some tuning would be necessary here but on my PC everything worked well so I could not test it.

davy39 commented 4 years ago

Hi, I've also noticed that the audio part of driver only works with USB3 ports. Could you tell me more about which parameters to try tuning in audio.h ? Thanks