Skip to content

Instantly share code, notes, and snippets.

@notgne2
Last active August 4, 2024 19:28
Show Gist options
  • Save notgne2/41ec4ce08982d42d803aac2dc485e27d to your computer and use it in GitHub Desktop.
Save notgne2/41ec4ce08982d42d803aac2dc485e27d to your computer and use it in GitHub Desktop.
It Just Works ™️
{
config,
pkgs,
lib,
inputs,
...
}: let
ipu6-camera-bin = with pkgs;
stdenv.mkDerivation rec {
pname = "ipu6-camera-bin";
version = "main";
src = pkgs.fetchFromGitHub {
owner = "intel";
repo = "ipu6-camera-bins";
rev = "main";
sha256 = "sha256-XPT3dbV6Kl1/TEeiQESF4Q4s95hjtiv4VLlqlahQXqE=";
};
installPhase = ''
mkdir $out
cp -r $src/ipu6ep/* $out
for pc in $out/lib/pkgconfig/*; do
substituteInPlace $pc \
--replace "exec_prefix=/usr" "exec_prefix=\''${prefix}" \
--replace "prefix=/usr" "prefix=$out" \
--replace "libdir=/usr/lib" "libdir=$out/lib" \
--replace "includedir=/usr/include" "includedir=$out/include"
done
'';
};
ivsc-firmware = with pkgs;
stdenv.mkDerivation rec {
pname = "ivsc-firmware";
version = "main";
src = pkgs.fetchFromGitHub {
owner = "intel";
repo = "ivsc-firmware";
rev = "main";
sha256 = "sha256-GuD1oTnDEs0HslJjXx26DkVQIe0eS+js4UoaTDa77ME=";
};
installPhase = ''
mkdir -p $out/lib/firmware/vsc/soc_a1_prod
cp firmware/ivsc_pkg_ovti01a0_0.bin $out/lib/firmware/vsc/soc_a1_prod/ivsc_pkg_ovti01a0_0_a1_prod.bin
cp firmware/ivsc_skucfg_ovti01a0_0_1.bin $out/lib/firmware/vsc/soc_a1_prod/ivsc_skucfg_ovti01a0_0_1_a1_prod.bin
cp firmware/ivsc_fw.bin $out/lib/firmware/vsc/soc_a1_prod/ivsc_fw_a1_prod.bin
'';
};
ipu6-camera-hal = with pkgs;
stdenv.mkDerivation rec {
pname = "ipu6-camera-hal";
version = "main";
src = pkgs.fetchFromGitHub {
owner = "intel";
repo = "ipu6-camera-hal";
rev = "main";
sha256 = "sha256-dJvTZt85rt5/v2JXOsfbSY933qffyXW74L0nWdIlqug=";
};
nativeBuildInputs = [cmake pkg-config];
cmakeFlags = [
"-DIPU_VER=ipu6ep"
"-DENABLE_VIRTUAL_IPU_PIPE=OFF"
"-DUSE_PG_LITE_PIPE=ON"
"-DUSE_STATIC_GRAPH=OFF"
"-DCMAKE_INSTALL_PREFIX=${placeholder "out"}"
"-DCMAKE_INSTALL_LIBDIR=lib"
"-DCMAKE_INSTALL_INCLUDEDIR=include"
];
buildInputs = [
ipu6-camera-bin
expat.dev
libtool
];
};
icamerasrc = with pkgs;
stdenv.mkDerivation rec {
pname = "icamerasrc";
version = "icamerasrc_slim_api";
src = pkgs.fetchFromGitHub {
owner = "intel";
repo = "icamerasrc";
rev = "icamerasrc_slim_api";
sha256 = "sha256-qlV363l4tUjUAa1LiZQq55byKpz1tLESKAXEmgiYHVo=";
};
nativeBuildInputs = [automake autoconf autoreconfHook pkg-config];
# gstreamer cannot otherwise be found
NIX_CFLAGS_COMPILE = "-I${gst_all_1.gst-plugins-base.dev}/include/gstreamer-1.0";
CHROME_SLIM_CAMHAL = "ON";
STRIP_VIRTUAL_CHANNEL_CAMHAL = "ON";
buildInputs = [
ipu6-camera-bin
ipu6-camera-hal
expat.dev
libtool
gst_all_1.gstreamer.dev
gst_all_1.gst-plugins-base.dev
libdrm.dev
];
};
ivsc-driver = with pkgs;
stdenv.mkDerivation rec {
pname = "ivsc-driver";
version = "master";
src = pkgs.fetchFromGitHub {
owner = "intel";
repo = "ivsc-driver";
rev = "master";
sha256 = "sha256-Q7iyKw4WFSX42E4AtoW/zYRKpknWZSU66V5VPAx6AjA=";
};
nativeBuildInputs = config.boot.kernelPackages.kernel.moduleBuildDependencies;
installTargets = ["modules_install"];
makeFlags =
config.boot.kernelPackages.kernel.makeFlags
++ [
"KERNELRELEASE=${config.boot.kernelPackages.kernel.modDirVersion}"
"KERNEL_SRC=${config.boot.kernelPackages.kernel.dev}/lib/modules/${config.boot.kernelPackages.kernel.modDirVersion}/build"
"INSTALL_MOD_PATH=${placeholder "out"}"
];
};
ipu6-drivers = with pkgs;
stdenv.mkDerivation rec {
pname = "ipu6-drivers";
version = "master";
src = builtins.fetchGit {
url = "https://git.launchpad.net/~vicamo/+git/intel-ipu6-dkms";
rev = "d44f973c27aa7dc77512f808ae84fda9846cdd4b";
ref = "ubuntu/devel";
};
nativeBuildInputs = config.boot.kernelPackages.kernel.moduleBuildDependencies;
prePatch = ''
patches="$(echo debian/patches/*.patch)$(echo patches/*.patch)"
'';
installTargets = ["modules_install"];
makeFlags =
config.boot.kernelPackages.kernel.makeFlags
++ [
"KERNELRELEASE=${config.boot.kernelPackages.kernel.modDirVersion}"
"KERNEL_SRC=${config.boot.kernelPackages.kernel.dev}/lib/modules/${config.boot.kernelPackages.kernel.modDirVersion}/build"
"INSTALL_MOD_PATH=${placeholder "out"}"
];
};
v4l2-relayd = with pkgs;
stdenv.mkDerivation rec {
pname = "v4l2-relayd";
version = "main";
src = pkgs.fetchFromGitLab {
owner = "vicamo";
repo = "v4l2-relayd";
rev = "main";
sha256 = "sha256-3F1ySkGOGlSIPMi+p1NFip4wOsJ0gOdi08s9oQsZsG4=";
};
nativeBuildInputs = [automake autoconf autoreconfHook pkg-config];
preInstall = ''
mkdir -p $out/lib/systemd/system $out/etc
${pkgs.coreutils}/bin/cp -r $src/data/etc/* $out/etc
${pkgs.coreutils}/bin/cp -r $src/data/systemd/* $out/lib/systemd/system
'';
buildInputs = [
gst_all_1.gstreamer.dev
gst_all_1.gst-plugins-base.dev
];
};
v4l2loopback = config.boot.kernelPackages.v4l2loopback.overrideAttrs (super: {
src = builtins.fetchGit {
url = "https://git.launchpad.net/ubuntu/+source/v4l2loopback";
ref = "ubuntu/devel";
rev = "b37d72d783e2605447858ab8bcdf80ddf5ea906a";
};
prePatch = ''
patches="$(echo debian/patches/*.patch)$(echo patches/*.patch)"
'';
});
webcamName = "Stupid Webcam";
in {
imports = [
inputs.nixos-hardware.nixosModules.common-pc-ssd
inputs.nixos-hardware.nixosModules.common-pc-laptop
inputs.nixos-hardware.nixosModules.common-cpu-intel
];
hardware.enableAllFirmware = true;
services.hardware.bolt.enable = true;
services.colord.enable = true;
services.fprintd.enable = true;
environment.etc.camera.source = "${ipu6-camera-hal}/share/defaults/etc/camera";
systemd.services.v4l2-relayd = {
environment = {
GST_PLUGIN_SYSTEM_PATH_1_0 = lib.makeSearchPathOutput "lib" "lib/gstreamer-1.0" (with pkgs.gst_all_1; [icamerasrc gstreamer gst-plugins-base gst-plugins-good]);
LD_LIBRARY_PATH = "${ipu6-camera-bin}/lib";
};
script = ''
export GST_DEBUG=2
export DEVICE=$(grep -l -m1 -E "^${webcamName}$" /sys/devices/virtual/video4linux/*/name | cut -d/ -f6);
exec ${v4l2-relayd}/bin/v4l2-relayd \
--debug \
-i "icamerasrc" \
-o "appsrc name=appsrc caps=video/x-raw,format=NV12,width=1280,height=720,framerate=30/1 ! videoconvert ! video/x-raw,format=YUY2 ! v4l2sink name=v4l2sink device=/dev/$DEVICE"
'';
wantedBy = ["multi-user.target"];
serviceConfig = {
User = "root";
Group = "root";
};
};
hardware.firmware = [
ipu6-camera-bin
ivsc-firmware
];
boot.extraModulePackages = [
ipu6-drivers
ivsc-driver
v4l2loopback
];
boot.kernelModules = [
"v4l2loopback"
];
boot.extraModprobeConfig = ''
options v4l2loopback exclusive_caps=1 card_label="${webcamName}"
'';
}
@p-alik
Copy link

p-alik commented Mar 7, 2024

It helped me indeed. There're no issues with webcam nor with the mic. My settings based on this one is linked in Missing ivsc-firmware on Dell XPS 13 Plus 9320

$ nix-info 
system: "x86_64-linux", multi-user?: yes, version: nix-env (Nix) 2.18.1, channels(root): "nixos-23.11", nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos
$ uname -a
Linux ls03064 6.1.80 #1-NixOS SMP PREEMPT_DYNAMIC Fri Mar  1 12:26:39 UTC 2024 x86_64 GNU/Linux

@tobiasBora
Copy link

Oh good to know… have you done anything special for the mic to work? Do you have the exact commit of nixpkgs that you follow for maximum reproducibility? (I guess you don't use flake, so maybe https://stackoverflow.com/questions/66124085/how-to-find-the-commit-a-nix-channel-points-to is helpful)

@p-alik
Copy link

p-alik commented Mar 7, 2024

No I didn't anything else. I'm using flake with home-manager only.

$ nix-info -m
 - system: `"x86_64-linux"`
 - host os: `Linux 6.1.80, NixOS, 23.11 (Tapir), 23.11.5060.617579a78725`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.1`
 - channels(root): `"nixos-23.11"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos

@tobiasBora
Copy link

Hum interesting, we are using the same version basically. Sorry to bother you, but do you mind sending me:

  • a screenshot in pavucontrol of the input device and configuration tabs to see if the port/...) match mine
  • the output of inxi -Fazy to check if you loaded the same driver as me
  • the output of dmesg to see if you also get the same warnings as me

Thanks!

@p-alik
Copy link

p-alik commented Mar 7, 2024

  • pavucontrol
  • inxi -Fazy
System:
  Kernel: 6.1.80 x86_64 bits: 64 compiler: gcc v: 12.3.0 
  parameters: initrd=\efi\nixos\ybv6sgckgd8m20yskg9ryvlcgm65pr6p-initrd-linux-6.1.80-initrd.efi 
  init=/nix/store/azx0mhiva8kd1vmgmhqiwy1hwp8pmwy3-nixos-system-ls03064-23.11.5060.617579a78725/init 
  i915.enable_psr=0 loglevel=4 
  Desktop: GNOME 45.4 tk: GTK 3.24.41 info: docker wm: gnome-shell dm: GDM 
  Distro: NixOS 23.11 (Tapir) 
Machine:
  Type: Laptop System: Dell product: XPS 9320 v: N/A serial: <filter> Chassis: 
  type: 10 serial: <filter> 
  Mobo: Dell model: 0CW9KM v: A00 serial: <filter> UEFI: Dell v: 1.3.0 
  date: 04/19/2022 
Battery:
  ID-1: BAT0 charge: 54.4 Wh (100.0%) condition: 54.4/54.4 Wh (100.0%) 
  volts: 13.4 min: 11.6 model: SMP DELL J7H5M23 type: Li-poly serial: <filter> 
  status: Full 
CPU:
  Info: 8-Core model: 12th Gen Intel Core i7-1260P bits: 64 type: MT MCP 
  arch: N/A family: 6 model-id: 9A (154) stepping: 3 microcode: 430 cache: 
  L2: 18 MiB 
  flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx 
  bogomips: 79872 
  Speed: 400 MHz min/max: 400/4700 MHz Core speeds (MHz): 1: 992 2: 400 3: 400 
  4: 400 5: 684 6: 400 7: 400 8: 831 9: 1084 10: 400 11: 1289 12: 400 13: 1133 
  14: 400 15: 400 16: 400 
  Vulnerabilities: Type: gather_data_sampling status: Not affected 
  Type: itlb_multihit status: Not affected 
  Type: l1tf status: Not affected 
  Type: mds status: Not affected 
  Type: meltdown status: Not affected 
  Type: mmio_stale_data status: Not affected 
  Type: retbleed status: Not affected 
  Type: spec_rstack_overflow status: Not affected 
  Type: spec_store_bypass 
  mitigation: Speculative Store Bypass disabled via prctl 
  Type: spectre_v1 
  mitigation: usercopy/swapgs barriers and __user pointer sanitization 
  Type: spectre_v2 mitigation: Enhanced IBRS, IBPB: conditional, RSB filling, 
  PBRSB-eIBRS: SW sequence 
  Type: srbds status: Not affected 
  Type: tsx_async_abort status: Not affected 
Graphics:
  Device-1: Intel Alder Lake-P GT2 [Iris Xe Graphics] vendor: Dell 
  driver: i915 v: kernel bus-ID: 00:02.0 chip-ID: 8086:46a6 class-ID: 0300 
  Display: wayland server: X.org 1.21.1.11 compositor: gnome-shell driver: 
  loaded: i915 note: n/a (using device driver) display-ID: 0 
  resolution: <missing: xdpyinfo> 
  OpenGL: renderer: Mesa Intel Graphics (ADL GT2) v: 4.6 Mesa 23.1.9 
  direct render: Yes 
Audio:
  Device-1: Intel Alder Lake Imaging Signal Processor vendor: Dell 
  driver: intel-ipu6 alternate: intel_ipu6,intel_ipu6_psys,intel_ipu6_isys 
  bus-ID: 00:05.0 chip-ID: 8086:465d class-ID: 0480 
  Device-2: Intel Alder Lake PCH-P High Definition Audio vendor: Dell 
  driver: sof-audio-pci-intel-tgl 
  alternate: snd_hda_intel,snd_sof_pci_intel_tgl bus-ID: 00:1f.3 
  chip-ID: 8086:51c8 class-ID: 0401 
  Sound Server-1: ALSA v: k6.1.80 running: yes 
  Sound Server-2: PipeWire v: 1.0.1 running: yes 
Network:
  Device-1: Intel Alder Lake-P PCH CNVi WiFi driver: iwlwifi v: kernel 
  port: 3000 bus-ID: 00:14.3 chip-ID: 8086:51f0 class-ID: 0280 
  IF: wlp0s20f3 state: up mac: <filter> 
  IF-ID-1: br-03de7d75dfae state: down mac: <filter> 
  IF-ID-2: br-4ea918a2c549 state: down mac: <filter> 
  IF-ID-3: docker0 state: down mac: <filter> 
  IF-ID-4: enp0s13f0u1u1c2 state: down mac: <filter> 
  IF-ID-5: tun0 state: unknown speed: 10 Mbps duplex: full mac: N/A 
Bluetooth:
  Device-1: N/A type: USB driver: btusb v: 0.8 bus-ID: 1-10:5 
  chip-ID: 8087:0033 class-ID: e001 
  Report: hciconfig ID: hci0 rfk-id: 0 state: up address: <filter> 
  Info: acl-mtu: 1021:4 sco-mtu: 96:6 link-policy: rswitch sniff 
  link-mode: peripheral accept 
  service-classes: rendering, capturing, object transfer, audio, telephony 
Drives:
  Local Storage: total: 953.87 GiB used: 204.31 GiB (21.4%) 
  SMART Message: Required tool smartctl not installed. Check --recommends 
  ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: SK Hynix model: PC801 NVMe 1TB 
  size: 953.87 GiB block-size: physical: 512 B logical: 512 B speed: 63.2 Gb/s 
  lanes: 4 rotation: SSD serial: <filter> rev: 51002141 scheme: GPT 
Partition:
  ID-1: / raw-size: 466.79 GiB size: 458.39 GiB (98.20%) 
  used: 204.15 GiB (44.5%) fs: ext4 dev: /dev/dm-0 maj-min: 254:0 
  mapped: luks-5f6a700d-cfdb-492c-b52d-d875e818631c 
  ID-2: /boot raw-size: 240 MiB size: 236 MiB (98.33%) used: 168.2 MiB (71.3%) 
  fs: vfat dev: /dev/nvme0n1p1 maj-min: 259:1 
Swap:
  Alert: No swap data was found. 
Sensors:
  Missing: Required tool sensors not installed. Check --recommends 
Info:
  Processes: 385 
  Uptime: 11:43:56  up 1 day 22:16,  2 users,  load average: 0.60, 0.44, 0.43 
  wakeups: 10848 Memory: 30.98 GiB used: 7.04 GiB (22.7%) Init: systemd v: 254 
  target: graphical.target tool: systemctl Compilers: gcc: N/A clang: 16.0.6 
  Packages: 1462 nix-default: 0 nix-sys: 1060 lib: 239 nix-usr: 402 lib: 111 
  Shell: Bash v: 5.2.15 running-in: .kgx-wrapped inxi: 3.3.04 

@tobiasBora
Copy link

Thanks a lot! Interestingly, you use volume at 8%, is there any reason for that? What happens if you put it 100%?

Also, if you can send me the output of dmesg and the configuration tab of pulseaudio (there are two modes) it would be helpful.

@p-alik
Copy link

p-alik commented Mar 7, 2024

I've sent dmesg output to your profile email.

What happens if you put it 100%?

I suppose my teammates will kill me.

Screenshot from 2024-03-07 14-49-46
Screenshot from 2024-03-07 14-49-53

@tobiasBora
Copy link

tobiasBora commented Mar 7, 2024

Oh thank you so much, I just realized that you sent me an email. Interesting, you also have the same "errors" as mine

Just realized you sent me dmesg via mail. Interesting to see that you also have the error sof_sdw sof_sdw: ASoC: Parent card not yet available, widget card binding deferred:

$ cat dmesg.2024-03-07.log | rg -i "(audio|snd|sof)"
[    0.047408] software IO TLB: area num 16.
[    0.981880] PCI-DMA: Using software bounce buffering for IO (SWIOTLB)
[    0.981881] software IO TLB: mapped [mem 0x00000000480cc000-0x000000004c0cc000] (64MB)
[    3.335462] usb 1-1.3.4: Product: USB Audio
[   12.927579] snd_hda_intel 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if info 0x040100
[   12.927713] snd_hda_intel 0000:00:1f.3: SoundWire enabled on CannonLake+ platform, using SOF driver
[   13.158365] sof-audio-pci-intel-tgl 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if info 0x040100
[   13.158594] sof-audio-pci-intel-tgl 0000:00:1f.3: SoundWire enabled on CannonLake+ platform, using SOF driver
[   13.158607] sof-audio-pci-intel-tgl 0000:00:1f.3: enabling device (0000 -> 0002)
[   13.158745] sof-audio-pci-intel-tgl 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if 0x040100
[   13.158819] sof-audio-pci-intel-tgl 0000:00:1f.3: bound 0000:00:02.0 (ops i915_audio_component_bind_ops [i915])
[   13.169837] sof-audio-pci-intel-tgl 0000:00:1f.3: use msi interrupt mode
[   13.185238] sof-audio-pci-intel-tgl 0000:00:1f.3: hda codecs found, mask 4
[   13.199047] sof-audio-pci-intel-tgl 0000:00:1f.3: Firmware info: version 2:2:0-57864
[   13.199050] sof-audio-pci-intel-tgl 0000:00:1f.3: Firmware: ABI 3:22:1 Kernel ABI 3:23:0
[   13.199054] sof-audio-pci-intel-tgl 0000:00:1f.3: unknown sof_ext_man header type 3 size 0x30
[   13.291867] sof-audio-pci-intel-tgl 0000:00:1f.3: Firmware info: version 2:2:0-57864
[   13.291870] sof-audio-pci-intel-tgl 0000:00:1f.3: Firmware: ABI 3:22:1 Kernel ABI 3:23:0
[   13.322341] sof-audio-pci-intel-tgl 0000:00:1f.3: Topology: ABI 3:22:1 Kernel ABI 3:23:0
[   13.322431] sof_sdw sof_sdw: ASoC: Parent card not yet available, widget card binding deferred
[   13.338662] sof_sdw sof_sdw: hda_dsp_hdmi_build_controls: no PCM in topology for HDMI converter 3
[   13.357236] input: sof-soundwire HDMI/DP,pcm=5 as /devices/pci0000:00/0000:00:1f.3/sof_sdw/sound/card2/input23
[   13.357261] input: sof-soundwire HDMI/DP,pcm=6 as /devices/pci0000:00/0000:00:1f.3/sof_sdw/sound/card2/input24
[   13.357279] input: sof-soundwire HDMI/DP,pcm=7 as /devices/pci0000:00/0000:00:1f.3/sof_sdw/sound/card2/input25
[   13.872286] usbcore: registered new interface driver snd-usb-audio

So it is a mystery, I have basically the same outputs/configuration/… still no working microphone. When I get back to the computer I'll try sudo alsactl init to see if it changes anything, and double check if I've not muted the hardware of the microphone via some stupid key stokes…

Can I ask you one more favor, to give me a screenshot of your alsamixer, after using F6 to select the right card? Sorry for all of this but it drives me crazy.

@p-alik
Copy link

p-alik commented Mar 7, 2024

I didn't face any troubles with sound settings at all.
Screenshot from 2024-03-07 15-36-23

@tobiasBora
Copy link

tobiasBora commented Mar 8, 2024

Ohhhh finally!! The solution is so simple sudo alsactl init (module a simple bug here NixOS/nixpkgs#294170) Thank you soo much for your help, as it eliminated all questions related to softwares/kernel/…

Now, let's go to the webcam. First, it was working great with your code for browsers, thanks! (just, why is there a dummy webcam as well? It makes it hard to select the good one). But it is still not working for some softwares, like Cheese. Any idea how to get it working here?

@tobiasBora
Copy link

Also, I wanted to ask about the comment "leave browsers here for sake of camera support" in the user-installed packages. Why is it working here and not outside?

@p-alik
Copy link

p-alik commented Mar 8, 2024

Great your mic is finally working. The browser is the only application I need camera support so far. I tried to install the browsers my home-manager also. But that way camera support vanished.
Looks like cheese would have the same issue on my laptop

[nix-shell:]$ cheese 

(cheese:539286): Gdk-WARNING **: 09:16:52.061: Native Windows taller than 65535 pixels are not supported
** Message: 09:16:52.518: cheese-application.vala:222: Error during camera setup: No device found


(cheese:539286): cheese-CRITICAL **: 09:16:52.525: cheese_camera_device_get_name: assertion 'CHEESE_IS_CAMERA_DEVICE (device)' failed

(cheese:539286): GLib-CRITICAL **: 09:16:52.525: g_variant_new_string: assertion 'string != NULL' failed

(cheese:539286): GLib-CRITICAL **: 09:16:52.525: g_variant_ref_sink: assertion 'value != NULL' failed

(cheese:539286): GLib-GIO-CRITICAL **: 09:16:52.525: g_settings_schema_key_type_check: assertion 'value != NULL' failed

(cheese:539286): GLib-CRITICAL **: 09:16:52.525: g_variant_get_type_string: assertion 'value != NULL' failed

(cheese:539286): GLib-GIO-CRITICAL **: 09:16:52.525: g_settings_set_value: key 'camera' in 'org.gnome.Cheese' expects type 's', but a GVariant of type '(null)' was given

(cheese:539286): GLib-CRITICAL **: 09:16:52.525: g_variant_unref: assertion 'value != NULL' failed

** (cheese:539286): CRITICAL **: 09:16:52.525: cheese_preferences_dialog_setup_resolutions_for_device: assertion 'device != NULL' failed

(cheese:539286): Clutter-CRITICAL **: 09:17:25.786: Unable to create dummy onscreen: No foreign surface, and wl_shell unsupported by the compositor

@tobiasBora
Copy link

Note that I needed sound.enable = true; for this to persist across reboots (this runs alsactl store).

But that way camera support vanished.

oh, surprising

Cheese is for me the only application that I cannot get to work, irrespective of what I do. zoom/obs/firefox/chrome work, but not cheese.

@tobiasBora
Copy link

tobiasBora commented Mar 8, 2024

Actually, I can get cheese to work if I run it as root, change in the preferences the app to select the good camera, and restart it. Not sure how to fix this as I get:

(cheese:13230): cheese-WARNING **: 15:47:35.995: stream error: can't negotiate buffers on port: ../src/gst/gstpipewiresrc.c(689): on_state_changed (): /GstCameraBin:camerabin/GstWrapperCameraBinSrc:camera_source/GstBin:bin36/GstPipeWireSrc:pipewiresrc1

I read this morning a notification of someone suggesting me this fix, with a link, but impossible to find it again!?

Seems like this is an upstream bug of cheese https://bugs.launchpad.net/ubuntu/+source/cheese/+bug/1978757

@notgne2
Copy link
Author

notgne2 commented Mar 8, 2024

It's been a very long time since I last used this laptop, and have no idea how much of what I know or this Gist is still relevant. Are the current drivers able to automatically create a v4l2 device? Because if not, you might still need the v4l2-relayd stuff (create a virtual v4l2 device and automatically stream your webcam through it when an application wants to use it), unless everything has been updated to support whatever new protocol there is instead.

I do also remember the sudo alsactl init thing, and think I ended up needing to run it every reboot but forgot to mention it.

@tobiasBora
Copy link

Thanks for the answer. So the code of p-alik seems to be the minimal set of changes to apply. To avoid typing alsactl init, it seems like enabling sound.enable = true; does a thing to preserve the setting.

@p-alik
Copy link

p-alik commented Mar 11, 2024

Sorry I didn't mention sound.enable = true before. :-(

@tobiasBora
Copy link

@p-alik do you plan to submit your changes to https://github.com/NixOS/nixos-hardware? If yes, maybe add the sound.enable line and a comment on alsactl init (see also NixOS/nixpkgs#294170), and a line mentionning that cheese is broken due to an upstream bug. I also slightly improved your setting to hide the dummy camera (not even sure why it appears from the start) as it was confusing some softwares, see my changes here NixOS/nixpkgs#225743 (comment)

@p-alik
Copy link

p-alik commented Mar 11, 2024

@p-alik do you plan to submit your changes to https://github.com/NixOS/nixos-hardware?

will do on coming weekend

I also slightly improved your setting to hide the dummy camera (not even sure why it appears from the start) as it was confusing some softwares, see my changes here NixOS/nixpkgs#225743 (comment)

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment