zynthian / zynthian-issue-tracking

Centralized Issue Tracking for Zynthian Project
https://github.com/orgs/zynthian/projects/1
11 stars 3 forks source link

"Generic Usb Device" not user friendly, can crash GUI if misconfigured #587

Open probonopd opened 2 years ago

probonopd commented 2 years ago

TL;dr: "Generic Usb Device" should automatically detect the attached USB sound devices and select the one that was plugged in last, and offer the detected USB sound devices in a drop-down menu rather than relying on cryptic command line parameters.

Describe the bug

Crashes out of the box on RPi 4. I have no hardware other than

I want to play on the M-Audio Keystation Mini 32 and hear the sound on the C-Media USB sound card.

I chose Zythian in the hope that everything would just work right out of the box because setting up Jack manually is such a pain.

To Reproduce Steps to reproduce the behavior:

  1. Write Zynthian image to SD card
  2. Put SD card into Raspberry Pi 4 1GB
  3. Attach network cable
  4. Boot
  5. Access http://zynthian.local/
  6. Configure Hardware -> Kit -> Custom (I have no hardware Kit)
  7. Configure Hardware -> Audio -> Generic Usb Device (I have a C-Media USB audio device)
  8. Configure Hardware -> Display -> Generic HDMI Display (I have a normal HDMI screen)
  9. Configure Hardware -> Wiring -> Dummies (I have no devices wired to the Raspberry Pi)
  10. Reboot
  11. When ?Login:` appears on the scren, it seems like the Zynthian GUI is starting up but then crashes, then the whole thing repeats immediately
  12. Hence logging in as root via ssh, and doing systemctl stop zynthian && /zynthian/zynthian-sys/sbin/zynthian.sh

Getting a big red "ERROR" screen on HDMI, showing the IP address of the device.

X.Org X Server 1.20.4
X Protocol Version 11, Revision 0
Build Operating System: Linux 5.10.17-v8+ aarch64 Raspbian
Current Operating System: Linux zynthian 5.10.60-v7l+ #1449 SMP Wed Aug 25 15:00:44 BST 2021 armv7l
Kernel command line: coherent_pool=1M 8250.nr_uarts=1 snd_bcm2835.enable_compat_alsa=0 snd_bcm2835.enable_hdmi=1 bcm2708_fb.fbwidth=1920 bcm2708_fb.fbheight=1080 bcm2708_fb.fbswap=1 smsc95xx.macaddr=DC:A6:32:00:6A:FF vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000  dwc_otg.lpm_enable=0 console=tty3 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait logo.nologo quiet splash
Build Date: 19 April 2021  03:23:36PM
xorg-server 2:1.20.4-1+rpt3+deb10u3 (https://www.debian.org/support) 
Current version of pixman: 0.36.0
        Before reporting problems, check http://wiki.x.org
        to make sure that you have the latest version.
Markers: (--) probed, (**) from config file, (==) default setting,
        (++) from command line, (!!) notice, (II) informational,
        (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.0.log", Time: Wed Jan  5 19:40:14 2022
(==) Using config directory: "/etc/X11/xorg.conf.d"
(==) Using system config directory "/usr/share/X11/xorg.conf.d"
./zynthian.sh: line 55: /sys/class/backlight/*/bl_power: No such file or directory
didn't find evidence of prior run.
INFO:zynthian_gui_config.<module>: ZYNTHIAN-UI CONFIG ...
INFO:zynthian_gui_config.<module>: No Wiring Layout configured. Only touch interface is available.
DEBUG:zynthian_gui_config.<module>: ZYNCODER A: [0, 0, 0, 0]
DEBUG:zynthian_gui_config.<module>: ZYNCODER B: [0, 0, 0, 0]
DEBUG:zynthian_gui_config.<module>: SWITCHES layout: [0, 0, 0, 0]
DEBUG:zynthian_config.get_disabled_midi_in_ports: DISABLED_MIDI_IN = ['']
DEBUG:zynthian_config.get_enabled_midi_out_ports: ENABLED_MIDI_OUT = ['ttymidi:MIDI_out']
DEBUG:zynthian_config.get_enabled_midi_fb_ports: ENABLED_MIDI_FB = ['']
DEBUG:zynthian_gui_config.set_midi_config: MMC Bank Change CCNum: 0
DEBUG:zynthian_gui_config.set_midi_config: MMC Bank Change UP: None
DEBUG:zynthian_gui_config.set_midi_config: MMC Bank Change DOWN: None
DEBUG:zynthian_gui_config.set_midi_config: MMC Program Change UP: None
DEBUG:zynthian_gui_config.set_midi_config: MMC Program Change DOWN: None
lilv_world_load_bundle(): warning: Replacing version 2071.7 of <http://gareus.org/oss/lv2/b_whirl#extended> from <file:///zynthian/zynthian-plugins/lv2/b_whirl.lv2/>
lilv_world_load_bundle(): note: New version 2071.11 found in <file:///zynthian/zynthian-plugins/lv2/b_whirl/>
lilv_world_load_bundle(): warning: Replacing version 2071.7 of <http://gareus.org/oss/lv2/b_whirl#simple> from <file:///zynthian/zynthian-plugins/lv2/b_whirl.lv2/>
lilv_world_load_bundle(): note: New version 2071.11 found in <file:///zynthian/zynthian-plugins/lv2/b_whirl/>
lilv_world_load_bundle(): warning: Ignoring bundle <file:///zynthian/zynthian-plugins/lv2/b_synth.lv2/>
lilv_world_load_bundle(): note: Newer version of <http://gareus.org/oss/lv2/b_synth> loaded from <file:///zynthian/zynthian-plugins/lv2/b_synth/>
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
libzynseq failed to start jack client: 17
INFO:zynthian_gui.<module>: STARTING ZYNTHIAN-UI ...
INFO:zynthian_gui_keybinding.load: Loading key binding from keybinding.yaml
DEBUG:zynthian_gui_keybinding.load: Loading default keyboard bindings.
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
libjackpeak failed to start jack client: 17

Expected behavior

Zynthian is launched and I can see its GUI

Screenshots If applicable, add screenshots to help explain your problem.

Setup:

image

Additional context

Why do I get jack server is not running or cannot be started?

probonopd commented 2 years ago

Checking "RBPi Headphones: " in Hardware -> Audio does not make a difference.

probonopd commented 2 years ago

https://wiki.zynthian.org/index.php/Configuration_Users_Guide#Audio says

Audio is probably the setting that most affects the behaviour. Get it wrong and the GUI probably won’t start (You'll see an error display). Luckily the webconf allows you to set the device up in spite of a non start of the GUI and the generic USB will generally work. If it doesn’t you will need to play around with the USB alsa settings. Understanding of the jackd start up settings is probably what’s required. It’s normally the hw: setting.

Argh.

probonopd commented 2 years ago

Selecting "Dummy Device" in Hardware -> Audio and rebooting does no longer crash the user interface.

But how can I get the C-Media USB audio device to work?

image

There is still the default -P 70 -t 2000 -s -d alsa -d hw:0 -r 44100 -p 256 -n 2 -X raw. This is all Chinese to me. (I chose Zythian so that I wouldn't have to spend hours fighting stuff like this...)

probonopd commented 2 years ago
root@zynthian:~# cat /proc/asound/cards
(...)
 4 [Set            ]: USB-Audio - C-Media USB Headphone Set
                      C-Media USB Headphone Set at usb-0000:01:00.0-1.1, full speed

With another, almost identically looking, device I get:

 3 [Device         ]: USB-Audio - USB PnP Sound Device
                      USB PnP Sound Device at usb-0000:01:00.0-1.1, full speed

After a lot of trial and error, going to http://zynthian.local/hw-audio, selecting "Generic Usb Device" and changing the "Jackd Options:" line there to -P 70 -t 2000 -s -d alsa -d hw:Set -r 44100 -p 256 -n 2 -X raw worked for me.

I can only guess that one has to run cat /proc/asound/cards, and use the string in [...] as the -d hw:... parameter.

It is totally unclear what the -d parameter needs to be, and why the web interface doesn't just show Jabra SPEAK 510 USB nor C-Media USB Headphone Set as options from some drop-down menu and rather requires one to guess cryptic command line options out of thin air.

After making some changes on http://zynthian.local/hw-audio the system becomes unresponsive and/or reboots and/or an existing ssh connection is just closed. This is not user-friendly and make it seem like the system is crashing all the time, especially when making sound hardware related changes.

probonopd commented 2 years ago

Also, it would be nice if the last/only plugged in USB sound card would be detected and configured automatically. Plug and play!

probonopd commented 2 years ago

Also, it is beyond me why merely changing to another USB sound device would require a reboot of the whole system which it apparently does. On other systems (e.g., the Mac) this works on-the-fly, instantly.

Having to wait minutes(!) after every chnage is making trial-and-error and working with multiple USB sound devices very cumbersome.

probonopd commented 2 years ago

https://discourse.zynthian.org/t/audio-setup/2647/41

Only selecting Generic USB Device seems to get me nowhere and I can’t find any hints or documentation how to get this soundcard as an Generic USB Device connected.

probonopd commented 2 years ago

Looking at https://forums.raspberrypi.com/viewtopic.php?t=37873, the line

options snd-usb-audio index=-2

should be commented out so that USB sound devices can appear as device 0, giving the default -d hw:0 even the slightest chance to work. Also, I wonder whether -d plughw:0 would be more universally compatible with various USB sound devices.