respeaker / seeed-voicecard

2 Mic Hat, 4 Mic Array, 6-Mic Circular Array Kit, and 4-Mic Linear Array Kit for Raspberry Pi
GNU General Public License v3.0
475 stars 287 forks source link

Add support for Ubuntu (aarch64) #211

Closed mxklb closed 3 years ago

mxklb commented 4 years ago

When trying to install the driver on Ubuntu with Raspberry PI 4

root@ubuntu:/# uname -a
Linux ubuntu 5.3.0-1018-raspi2 #20-Ubuntu SMP Mon Feb 3 19:45:46 UTC 2020 aarch64 aarch64 aarch64 GNU/Linux

I get /boot/overlays not found or not a directory error:

root@ubuntu:/seeed-voicecard# ./install.sh 
/boot/overlays not found or not a directory
dtparam not found
dtoverlay not found
Errors found, exiting.

It would be nice to be able to install the driver on other Linux distributions commonly used with a PI.

Is there any chance to install/compile the driver with Ubuntu aarch64 on a PI 4?

haoyangw commented 4 years ago

@HinTak sorry for the trouble, I tried installing this driver from your repo, by running ubuntu-prerequisite.sh first followed by install.sh and reboot, on Ubuntu Mate 20.04 kernel 5.4-1015 on Raspberry Pi 4. But I rebooted a couple times and the HAT is intermittently working and not working(when it's not working, it's detected under aplay/arecord -l, but the subdevice count would be 0/1, while when it's working, that same count is 1/1). I have the 2Mic HAT. Do you have any suggestions/fixes for this? I'm happy to donate you a coffee or sdcard for this

HinTak commented 4 years ago

@haoyangw - could you compare the output of dmesg right after boot for a success and failure? Also lsmod? Also see if adding dtoverlay=seeed-2mic-voicecard to /boot/firmware/usercfg.txt helps. I also wonder about loose connection or a flawed device though.

haoyangw commented 4 years ago

@HinTak Hmm dmesg looks the same, both for success and failure. lsmod and dtoverlay -l looks the same too, seeed-2mic-voicecard dtoverlay and kernel module were both loaded successfully. The only clue I've noticed is that when the HAT is working, pulseaudio would only detect the HAT but fail to detect the onboard Headphone Jack and HDMI Input as audio devices, leaving only 2 audio devices in Pulseaudio, Dummy Output and seeed-2mic-voicecard. When I do a alsa force-reload, and get all 3 audio devices detected by pulseaudio, the HAT would stop working and arecord -l would indicate subdevices of seeed-2mic-voicecard as '0/1'. Do you have any ideas as to what's happening here? It doesn't make sense to me. I can rule out a fault device or connection as I've tested the HAT through multiple reboots on 32bit Raspbian OS running linux 5.4 kernel, and it consistently works and is detected by Pulseaudio, plus the 3.5mm headphone jack and HDMI audio is detected and works too.

HinTak commented 4 years ago

@haoyangw try adding dtparam=audio=on to the beginning of /boot/firmware/usercfg.txt ?

While you are at it, put dtparam=i2c_arm=on in too (I think it is already in the other /boot/firmware/*.txt - does not hurt to put it in twice.

The other thing is - it sounds a lot like multiple drivers trying to bind to the same device - did you experimented with the other wm8860-based drivers mentioned earlier by any chance?

haoyangw commented 4 years ago

@HinTak Yeah I did, before I found ur repo, I tried installing drivers from the official repo, both using manual dkms commands and 'make' followed by 'make install', and I tried the wm8960 repo linked above when that didn't work. Then I finally tried ur repo. But I've tried my best to delete/uninstall the previous drivers completely by undoing the commands detailed in the installation procedure for each of my installation attempts, I'm not sure if that has left over any code that is conflicting with the currently-installed drivers? Hope there's any way to fix this without re-installing my system from scratch xP

HinTak commented 4 years ago

@haoyangw argh, that makes life complicated...

haoyangw commented 4 years ago

@HinTak Thanks so much for taking the time for this, but I've checked all 4 items u mentioned and there are no duplicates/conflicts. But the most curious discovery I just made is that currently: after a reboot and not touching anything(no alsa force-reload or anything), I found all my devices detected by Pulseaudio(checked via pacmd list-sources and pacmd list-sinks), and arecord -l shows the seeed-voicecard device having subdevice: 1/1, and after testing, audio is recorded just fine, but amazingly, dtoverlay -l lists only the 2 dtparams(i2c_arm and spi), and no seeed-2mic-voicecard. However, checking systemctl status seeed-voicecard, I see the line true, probably from the dtoverlay -d $OVERLAYS $overlay || true statement. I'm guessing that means the dtoverlay was already loaded before that command? This is the first time I've managed to get all 3 audio devices detected by pulseaudio and recording works(arecord -l has subdevice 1/1), and curiously all those times before where the recording didn't work, dtoverlay -l lists seeed-2mic-voicecard, and systemctl status seeed-voicecard does not show true, but shows dtoverlay -d /boot/firmsare/overlays seeed-2mic-voicecard in place of that line. Do you happen to have any ideas what is going on? I wanna reboot a few times to confirm the stability of this system, but I'm worried it's only temporary. Thanks so much for your help once again

HinTak commented 4 years ago

@haoyangw so do you have a dtoverlay=seeed-2mic-voicecard in /boot/firmware/usercfg.txt, and it does not have a # before it, right? Leave it at that. Find the line dtoverlay -d $OVERLAYS $overlay || true in /usr/bin/seeed-voicecard, change it to just true. That should improve stability.

@Pillar1989 - why did you do both dynamic and static overlay in 277aeac ?

haoyangw commented 4 years ago

@HinTak yeah I do, that line without being commented(#). Weirdly, just now I checked pacmd list-sources again and it's back to Dummy Output despite me not rebooting or touching anything(just left the device alone). I tried replacing the line you mentioned with just true, but after a reboot, all 3 of my audio devices are loaded, but seeed-voicecard does not work(arecord -l shows subdevice 0/1 again). After some alsa force-reloads, it's back to dummy output + seeed-voicecard working again, but I made one observation: Previously when all 3 of my audio devices worked and arecord recorded fine, the seeed-voicecard audio device was card 0 under aplay -l. Also, the other scenario when the voicecard works was when it was only dummy output + the seeed-voicecard, which made me feel like seeed-voicecard needs to be loaded first/by itself for it to work. Do you have any further ideas? Really confused here other than this observation. If you have any debugging I can help with(logs or testing), I would be glad to help. Sorry for the trouble and thanks so much!

HinTak commented 4 years ago

@haoyangw This still sounds a lot like multiple drivers trying to bind to the same device. Besides the wm2860 itself (which has multiple drivers), the on-board audio apparently also have multiple drivers for 5.4... Anyway, the way to diagnose problems with multiple drivers is this:

Good luck...

mxklb commented 4 years ago

This issue handling unsatisfied me. Ok I know it should be possible to install the driver on ubuntu, and it's nice to get some hints on it here but this also looks like seeed-voicecard doesn't want to officially support ubuntu aarch64 in near future.

I'm Ok with this "you'll have to hack it yourself", but I think this issue could be closed, marked as "won't be resolved".

This issue is alive since over a year now. For me this looks like it's possible but won't be supported out of the box.

What do you think, is there any chance to get official (production ready end user) support for ubuntu aarch64?

HinTak commented 4 years ago

@mxklb I wouldn't go as far as that. I think when this was first filed, it was still two months beffore Ubuntu 20.04 (first official release to support raspberry pi) - and it was unreasonable to demand support for an event that haven't happened. However, with Raspbian /Rasp OS or whatever it is called now with the rebranding - the official raspberry pi distro - moving onto kernel 5.4+ lately, it is quite unsatisfactory that Seeed Studio staff still insist / recommand that users use 2/3-years-old outdated kernels.

Anyway, I have written a few times that if Seeed Studio wants to fund / sponsor me to get this to work, please get in touch. You'd find my name and e-mail at the top-level MAINTAINERS file in the kernel source tree, and it has been there for over a decade. That shows that I have decades of experiences in other parts of the kernel. (and I am finding my way around audio and ARMs).

StuartIanNaylor commented 4 years ago

@mxklb maybe just try https://github.com/pguyot/wm8960 if you have the 2 mic

mxklb commented 4 years ago

If I'll find time to I'll give it another try, but sadly over 1 year later I use alternative more plug'n'play audio capturing solutions ..

HinTak commented 4 years ago

@mxklb yes, just buy from another brand, of something else, is quite wise - considering how cheap these gadgets are. My time spent is certainly worth a lot more than one of these. (for me, it is more a learning exercise and finding myself around the audio part of the kernel) . Just throw it away and get a different vendor's...

Btw, the square 4-mics device ( https://github.com/respeaker/seeed-voicecard/issues/246 ) just started to work against current OSes. So it is okay across all 4(?) seeed studio devices now.

The lack of response /action from seeed studio staff is certainly disappointing...

HinTak commented 3 years ago

It is funny that Seeed Studio staff said Ubuntu support will be available in the "next release", https://forum.seeedstudio.com/t/support-for-ubuntu/5949/3 , just overctwo years ago... Still has not happened :)

mxklb commented 3 years ago

closed due to inactivity of seeed studio ..

I don't think this will ever be productive, so I'll advice to better sick to some other more plug'n'play vendors.

P.S. If seeed studio deosn't agree with this, this issue may be reopened, or even better linked by another new issue to fix this.

HinTak commented 3 years ago

Fwiw, matrix.one and audioinjector.net's products are discussed in a different issue item. Their staff are much more helpful and both look quite well supported.