anyc / snd-bcd2000

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

Trying to get audio working in Linux mint 19 #8

Open benuron opened 5 years ago

benuron commented 5 years ago

Hello and thanks for having time in develop a driver for linux!

I got the midi part working and now I would like to test the audio part. But this appears when I do make

make -C /lib/modules/4.15.0-51-generic/build M=/home/pedro/snd-bcd2000-audio modules
make[1]: Entering directory '/usr/src/linux-headers-4.15.0-51-generic'
  CC [M]  /home/pedro/snd-bcd2000-audio/audio.o
  CC [M]  /home/pedro/snd-bcd2000-audio/bcd2000.o
  CC [M]  /home/pedro/snd-bcd2000-audio/control.o
  CC [M]  /home/pedro/snd-bcd2000-audio/midi.o
/home/pedro/snd-bcd2000-audio/midi.c: In function ‘bcd2000_midi_handle_input’:
/home/pedro/snd-bcd2000-audio/midi.c:82:22: error: implicit declaration of function ‘ACCESS_ONCE’; did you mean ‘__READ_ONCE’? [-Werror=implicit-function-declaration]
  receive_substream = ACCESS_ONCE(bcd2k->midi.receive_substream);
                      ^~~~~~~~~~~
                      __READ_ONCE
/home/pedro/snd-bcd2000-audio/midi.c:82:20: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
  receive_substream = ACCESS_ONCE(bcd2k->midi.receive_substream);
                    ^
/home/pedro/snd-bcd2000-audio/midi.c: In function ‘bcd2000_midi_send’:
/home/pedro/snd-bcd2000-audio/midi.c:113:17: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
  send_substream = ACCESS_ONCE(bcd2k->midi.send_substream);
                 ^
cc1: some warnings being treated as errors
scripts/Makefile.build:330: recipe for target '/home/pedro/snd-bcd2000-audio/midi.o' failed
make[2]: *** [/home/pedro/snd-bcd2000-audio/midi.o] Error 1
Makefile:1552: recipe for target '_module_/home/pedro/snd-bcd2000-audio' failed
make[1]: *** [_module_/home/pedro/snd-bcd2000-audio] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-4.15.0-51-generic'
Makefile:5: recipe for target 'all' failed
make: *** [all] Error 2

Can you give me any hint how to overcome the errors?I am quite new to linux world so any help is appreciated.

anyc commented 5 years ago

I just pushed new commits. Please test if these work for you.

benuron commented 5 years ago

Thanks for your help!

the new commit returns this when I do sudo make

make -C /lib/modules/4.15.0-55-generic/build M= modules
make[1]: Entering directory '/usr/src/linux-headers-4.15.0-55-generic'
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/basic/bin2c
  HOSTCC  scripts/kconfig/conf.o
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTLD  scripts/kconfig/conf
scripts/kconfig/conf  --silentoldconfig Kconfig
security/Kconfig:393:warning: defaults for choice values not supported
security/Kconfig:397:warning: defaults for choice values not supported
security/Kconfig:401:warning: defaults for choice values not supported
security/Kconfig:405:warning: defaults for choice values not supported
security/Kconfig:409:warning: defaults for choice values not supported
make[2]: *** No rule to make target 'arch/x86/entry/syscalls/syscall_32.tbl', needed by 'arch/x86/include/generated/asm/syscalls_32.h'.  Stop.
arch/x86/Makefile:257: recipe for target 'archheaders' failed
make[1]: *** [archheaders] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-4.15.0-55-generic'
Makefile:5: recipe for target 'all' failed
make: *** [all] Error 2
anyc commented 5 years ago

Hm, I'd say there is something wrong with your setup. On my machine:

~/github/snd-bcd2000 $ make
make -C /lib/modules/5.1.12-gentoo/build M=/home/anyc/github/snd-bcd2000 modules
make[1]: Verzeichnis „/usr/src/linux-5.1.12-gentoo“ wird betreten
  CC [M]  /home/anyc/github/snd-bcd2000/audio.o
In file included from ./include/linux/mmzone.h:10,
                 from ./include/linux/gfp.h:6,
                 from ./include/linux/slab.h:15,
                 from /home/anyc/github/snd-bcd2000/audio.c:17:
/home/anyc/github/snd-bcd2000/audio.c: In Funktion »bcd2000_pcm_stream_start«:
./include/linux/wait.h:249:26: Anmerkung: byref variable will be forcibly initialized
  struct wait_queue_entry __wq_entry;     \
                          ^~~~~~~~~~
./include/linux/wait.h:335:2: Anmerkung: bei Substitution des Makros »___wait_event«
  ___wait_event(wq_head, ___wait_cond_timeout(condition),   \
  ^~~~~~~~~~~~~
./include/linux/wait.h:363:11: Anmerkung: bei Substitution des Makros »__wait_event_timeout«
   __ret = __wait_event_timeout(wq_head, condition, timeout); \
           ^~~~~~~~~~~~~~~~~~~~
/home/anyc/github/snd-bcd2000/audio.c:388:3: Anmerkung: bei Substitution des Makros »wait_event_timeout«
   wait_event_timeout(stream->wait_queue,
   ^~~~~~~~~~~~~~~~~~
  CC [M]  /home/anyc/github/snd-bcd2000/bcd2000.o
/home/anyc/github/snd-bcd2000/bcd2000.c: In Funktion »bcd2000_probe«:
/home/anyc/github/snd-bcd2000/bcd2000.c:90:7: Anmerkung: byref variable will be forcibly initialized
  char usb_path[32];
       ^~~~~~~~
/home/anyc/github/snd-bcd2000/bcd2000.c:87:19: Anmerkung: byref variable will be forcibly initialized
  struct snd_card *card;
                   ^~~~
  CC [M]  /home/anyc/github/snd-bcd2000/control.o
/home/anyc/github/snd-bcd2000/control.c: In Funktion »bcd2000_control_phono_mic_sw_update«:
/home/anyc/github/snd-bcd2000/control.c:36:6: Anmerkung: byref variable will be forcibly initialized
  int actual_length, ret;
      ^~~~~~~~~~~~~
  CC [M]  /home/anyc/github/snd-bcd2000/midi.o
/home/anyc/github/snd-bcd2000/midi.c: In Funktion »bcd2000_init_midi«:
/home/anyc/github/snd-bcd2000/midi.c:241:22: Anmerkung: byref variable will be forcibly initialized
  struct snd_rawmidi *rmidi;
                      ^~~~~
  LD [M]  /home/anyc/github/snd-bcd2000/snd-bcd2000.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /home/anyc/github/snd-bcd2000/snd-bcd2000.mod.o
  LD [M]  /home/anyc/github/snd-bcd2000/snd-bcd2000.ko
make[1]: Verzeichnis „/usr/src/linux-5.1.12-gentoo“ wird verlassen
benuron commented 5 years ago

No luck on this side :( and my linux knowledge is limited. Anyway I get to use the midi part with the mixxx software.

If you have anymore suggestions, let me know. Thank you for the support!

davy39 commented 4 years ago

Hello, I did compile the audio branch without problem with mint 19.3, and insmod it. However, I got an error in dmesg when I connect my BCD2000 : snd-bcd2000: could not start pcm stream and some urb->status: -71 I would love to have the audio part working on linux... Is there a way I could help debugging it ? Thanks for your time !

anyc commented 2 years ago

I stumbled over my BCD2000 today and gave it another try. I got the same "could not start pcm stream" and couldn't figure out why. I applied some upstream changes but the problem persists. Only if after I deactivated the capturing part, the playback works without error.

The usb_submit_urb() returns -28 which indicates that the driver cannot reserve enough bandwidth for the isochronous transfers. However, changing the size of the packets did not change anything and the values did not change anyway since it worked last time.

I also found another repo: https://github.com/CodeKill3r/BCD2000HIDplus where they offer an alternative firmware that provides a standard USB audio interface that should not need a special driver. I have not tested it though.

anyc commented 2 years ago

Looks like this bandwidth issue is not uncommon when using a USB2 device with USB3 ports [1]. So I am not sure if there is anything I can do in this driver. UVC has a quirk to recalculate an invalid bandwidth but I fail to see how we can do something similar here.

[1] https://bugs.launchpad.net/ubuntu/+source/linux/+bug/889953

anyc commented 2 years ago

There were also reports that enabling CONFIG_USB_EHCI_TT_NEWSCHED fixed their bandwidth problem.