Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kinect refuses to be recognized as a microphone when gspca modules are loaded in the kernel #15

Open
gataria opened this issue Mar 13, 2021 · 1 comment

Comments

@gataria
Copy link

gataria commented Mar 13, 2021

OS/Package information

  • OS: Pop!_OS 20.10 x86_64, based on Ubuntu 20.10
  • Kernel: 5.8.0-7642-generic
  • Relevant package versions:
    • alsa-base: 1.0.25+dfsg-0ubuntu5

Issue

Had to do some troubleshooting to figure out the issue, but I got to it:
After compiling and installing this driver and restarting (@grandchild's fork in particular, using a slightly modified version of @SterlingButters's install-webcam.sh script that I have attached), the Kinect's webcam does appear to work as a v4l2 loopback device. However, after this, the Kinect's microphones came to be undetected by ALSA. Running ALSA's alsa-info.sh troubleshooting script (from https://www.alsa-project.org/wiki/AlsaInfo looked to only show the following sound cards:

!!Soundcards recognised by ALSA
!!-----------------------------

 0 [NVidia         ]: HDA-Intel - HDA NVidia
                      HDA NVidia at 0xf7080000 irq 107
 1 [Generic        ]: HDA-Intel - HD-Audio Generic
                      HD-Audio Generic at 0xf7900000 irq 110

However, after blacklisting the gspca_kinect2 and gspca_main modules by creating a *.conf file in /etc/modprobe.d, like so:

# Do not load gspca modules. Enabling them results in the Kinect refusing to work as a microphone.
blacklist gspca_kinect2
blacklist gspca_main

and rebooting, alsa-info.sh outputted this list of soundcards:

!!Soundcards recognised by ALSA
!!-----------------------------

 0 [NVidia         ]: HDA-Intel - HDA NVidia
                      HDA NVidia at 0xf7080000 irq 107
 1 [Sensor         ]: USB-Audio - Xbox NUI Sensor
                      Microsoft Xbox NUI Sensor at usb-0000:02:00.0-4, super speed
 2 [Generic        ]: HDA-Intel - HD-Audio Generic
                      HD-Audio Generic at 0xf7900000 irq 109

and the Kinect's microphone was recognized by pulseaudio then.

I'm not sure if there's just some conflict between ALSA and the modules that use the Kinect as a webcam, but hopefully there's a way to resolve this problem. I figure that not only would someone want to use the Kinect as a webcam, but also as a microphone as well.
It's also possible that this is just an issue with my own system -- I did have to screw around with multiple programs to be able to successfully use the Kinect as a webcam (which may have screwed with some things I'm unaware of), and I'm not certain if I ever did or did not see the webcam and microphone working at the same time -- so hopefully creating an issue helps in making sure whether or not this is a unique issue.

@gataria
Copy link
Author

gataria commented Mar 13, 2021

Sorry, forgot to attach install-webcam.sh. Here is what I used:

apt-get install ffmpeg

echo "Cloning GSPCA Repo..."
git clone https://github.com/grandchild/gspca-kinect2.git && cd gspca-kinect2
echo "Building & Installing Modules (copying into /lib/modules/`uname -r`/kernel/drivers/kinect)"
make -C /lib/modules/`uname -r`/build  M=`pwd` SRCROOT=`pwd` clean modules
cp gspca_main.ko gspca_kinect_main.ko
cp gspca_kinect_main.ko /lib/modules/`uname -r`/kernel/drivers/kinect/gspca_kinect_main.ko
cp gspca_kinect2.ko /lib/modules/`uname -r`/kernel/drivers/kinect/gspca_kinect2.ko
cd ..

echo "Cloning V4L2Loopback Repo..." 
git clone https://github.com/umlaeute/v4l2loopback.git && cd v4l2loopback
echo "Building and Installing Modules"
make && make install
cd ..
echo "Resolving Module Dependencies"
depmod -a
echo "Enabling GSPCA & V4L2Loopback Modules at boot"
for module in "videodev" "gspca_kinect_main" "gspca_kinect2" "v4l2loopback"
do
	if grep -Fxq $module /etc/modules
	then
    		echo "$module found - skipping..."
	else
    		echo "$module not found - adding to /etc/modules"
                echo $module >> /etc/modules
	fi
done

echo "options video_nr=10 card_label='Kinect v2'" > /etc/modprobe.d/v4l2loopback.conf
echo "Creating ffmpeg service v4l2-loopback.service"
echo "[Unit]
Description=V4L2 Loopback Service for Kinect Webcam

[Service]
Type=simple
ExecStart=ffmpeg -i /dev/video1 -vsync drop -filter:v fps=30,scale=1920:-1,hflip -pix_fmt yuyv422 -color_trc bt709 -color_primaries bt709 -color_range tv -f v4l2 /dev/video0

[Install]
WantedBy=multi-user.target" > /lib/systemd/system/v4l2-loopback.service

echo "Enabling v4l2-loopback.service at boot"
systemctl enable v4l2-loopback

I should also note that I disabled the v4l2-loopback.service by issuing systemctl disable v4l2-loopback and I commented out the modules that were added to /etc/modules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant