Sc0710 - Linux driver for the Elgato 4k60 Pro Mk.2

Related tags

Miscellaneous sc0710
Overview

sc0710

Linux driver for the Elgato 4k60 Pro Mk.2

This is a reverse engineering project. The goal is to bring support for the Elgato 4k60 card to the linux platform.

The primary development platform for the project is Centos 7.5.1804 (Core), although the driver is expected to work on multiple distributions.

License

Driver for the Elgato 4k60 Pro mk.2 HDMI capture card.

Copyright (c) 2021 Steven Toth [email protected]

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

Background

Most of the investigation work is being done on Windows 10. I'm instrumenting the hardware with debug wiring, identifying common buses, sketching out a basic hardware digram, understanding the individual components, monitoring hardware behavior and outlining a plan for the linux implementation.

The project started Early Jan 2021. One month in, early feb, I understand enough of the basic design, hardware layout, board debug points to start making an early linux driver - enough to perform signal detection of the HDMI port and do some basic hardware servicing.

All of my working notes, analyzer traces, daily journal notes will be stored in this repository - as a single source for any interested viewers.

I'm maintaining a basic 'developer journal' so interested readers can follow along. It's not my intension to do a "how to reverse engineer step-by-step" intro guide, it's really to describe the process, show some of the tooling, highlight things that worked and things that didn't work. I'm not writing an essay, its random utterances that may help another developer on a similar project.

At this stage, everything is contained in master. We don't have any branches. As the project progresses and the driver becomes usable, almost certainly, a new 'cleaner' repo will emerge and users will not be expected to download this entire repo, with huge images, analyzer traces, random notes - just to use the driver.

Status

  • Feb 15 2021 - Detected colorimetry and colospace HDMI support.
  • Feb 15 2021 - Added basic DV Timing support to expose resolution / rate material through the v4l api.
  • Feb 14 2021 - Added audio support, PCM 16bit 48KHz.
  • Feb 14 2021 - Driver is usable for certain resolutions for video and audio capture via ffmpeg.
  • Feb 13 2021 - Overhauled the scatter gather subsystem to support 4k video.
  • Feb 11 2021 - First every colorbar still iage captured via the driver.
  • Aug 1 2021 - Driver adjusts to auto detect 1280x720p vs 1920x1080p and work accordingly.
  • Aug 1 2021 - 4k is untested with the latest changes, but should be full supported.

TODO

  • Test/Support HDR 10bit.
  • Intermittent issue during capture, possible short video frame, casuses ffmpeg to error and stall.

Comments / Support

Email: [email protected]

Content

  • Project root - Driver source code.
  • Docs - Daily journal, random notes.
  • Traces - Various dump files taken from analyzers.
  • Pics - Interesting or curious pictures I've taken during the process.
Comments
  • No rule to make target?

    No rule to make target?

    I hope this is an easy fix wold be nice if i cold use my elgato 4k60mk2 on my linux ubuntu system (yes i know this isn't especially written for ubuntu but hope dies last). Thanks for future help.

    Commands: git clone https://github.com/stoth68000/sc0710.git cd sc0710 sudo make

    Outputs: make -C /lib/modules/5.11.0-17-generic/build M= modules make[1]: Entering directory '/usr/src/linux-headers-5.11.0-17-generic' make[2]: *** No rule to make target 'arch/x86/tools/relocs_32.c', needed by 'arch/x86/tools/relocs_32.o'. Stop. make[1]: *** [arch/x86/Makefile:210: archscripts] Error 2 make[1]: Leaving directory '/usr/src/linux-headers-5.11.0-17-generic' make: *** [Makefile:14: all] Error 2

    opened by marvin1099 7
  • I cannot compile driver on linux kernel version 5.13.0-52

    I cannot compile driver on linux kernel version 5.13.0-52

    @stoth68000

    make[1]: Entering directory '/usr/src/linux-headers-5.13.0-52-generic' CC [M] /home/igor/sc0710/sc0710-cards.o CC [M] /home/igor/sc0710/sc0710-core.o CC [M] /home/igor/sc0710/sc0710-i2c.o CC [M] /home/igor/sc0710/sc0710-dma-channel.o CC [M] /home/igor/sc0710/sc0710-dma-channels.o CC [M] /home/igor/sc0710/sc0710-dma-chains.o CC [M] /home/igor/sc0710/sc0710-dma-chain.o CC [M] /home/igor/sc0710/sc0710-things-per-second.o CC [M] /home/igor/sc0710/sc0710-video.o CC [M] /home/igor/sc0710/sc0710-audio.o LD [M] /home/igor/sc0710/sc0710.o MODPOST /home/igor/sc0710/Module.symvers CC [M] /home/igor/sc0710/sc0710.mod.o LD [M] /home/igor/sc0710/sc0710.ko BTF [M] /home/igor/sc0710/sc0710.ko /home/igor/sc0710/sc0710.ko due to unavailability of vmlinux make[1]: Leaving directory '/usr/src/linux-headers-5.13.0-52-generic'

    opened by igorzg 6
  • sc0710/sc0710.h:103:18: error: field ‘lastTime’ has incomplete type

    sc0710/sc0710.h:103:18: error: field ‘lastTime’ has incomplete type

    What is the state of this project?

    robin@debian:~/git/sc0710$ make make -C /lib/modules/5.10.0-8-amd64/build M=/home/robin/git/sc0710 modules make[1]: Entering directory '/usr/src/linux-headers-5.10.0-8-amd64' CC [M] /home/robin/git/sc0710/sc0710-cards.o In file included from /home/robin/git/sc0710/sc0710-cards.c:21: /home/robin/git/sc0710/sc0710.h:103:18: error: field ‘lastTime’ has incomplete type 103 | struct timespec lastTime; | ^~~~~~~~ make[3]: *** [/usr/src/linux-headers-5.10.0-8-common/scripts/Makefile.build:285: /home/robin/git/sc0710/sc0710-cards.o] Error 1 make[2]: *** [/usr/src/linux-headers-5.10.0-8-common/Makefile:1845: /home/robin/git/sc0710] Error 2 make[1]: *** [/usr/src/linux-headers-5.10.0-8-common/Makefile:185: __sub-make] Error 2 make[1]: Leaving directory '/usr/src/linux-headers-5.10.0-8-amd64' make: *** [Makefile:14: all] Error 2

    opened by tribbin 5
  • Updating &

    Updating & "patching" for newer Kernels

    Hello,

    As I would like to use my Elgato to retrieve another PC video and audio (1440p60). No choice but to update a bit your driver (huge thanks to your for your time on this project.)

    EDIT: I may say, actually your module is quite talkative in dmesg, maybe I will add a little option debug. It's really flooding for now :grin:

    I drop here the patch for an Archlinux 5.13.7 (5.13.7-arch1-1 from official repository) I did not edit the Makefile as I don't know how to check the Linux kernel version on it :smile: In the Makefile (For any Linux kernel above 5.0 uname -r :eyes:) just change sudo modprobe videobuf2_core to sudo modprobe videobuf_core in the load part. Here is the patch 5.13.7.patch.txt

    As for right now, it doesn't work. It properly register ALSA device. But not the Video part.

    If you have any free time, I'm really curious to make it work, this way it would be one step ahead for people who which to use their remnant PC to stream without using a Windows. (And I admit, I look forward to make it work for myself either :grin: )

    EDIT 2: Adding some details to dmesg (after adding a parameter to avoid HDMI messages for now :grin: ) It appear that the error happening at the video_register_device() function return a code 22. Which seems to be a bad argument. Due to the code update for newer kernel, I will look deeper to find which settings I misunderstood.

    Here is the dmesg report

    [ 4522.909350] sc0710 device found at 0000:04:00.0, rev: 0, irq: 40, latency: 0
    [ 4522.909352] sc0710 bar[0]: 0xfc300000 [0x100000 bytes]
    [ 4522.909353] sc0710 bar[1]: 0xfc400000 [0x10000 bytes]
    [ 4522.909378] sc0710[0]: subsystem: 1cfa:000e, board: Elgato 4k60 Pro mk.2 [card=1,autodetected]
    [ 4522.909380] sc0710_initdev() MSI interrupts disabled (driver default)
    [ 4522.909400] sc0710 device at 0000:04:00.0
    [ 4522.909401] sc0710 page-size 4096 bytes
    [ 4522.909402] Allocating channel for size 1843200
    [ 4522.909956] sc0710[0] channel 0 allocated
    [ 4522.909958] sc0710[0] ch#0 pt_cpu 0000000065bb2b89  pt_dma a292000  pt_size 8192
    [ 4522.909960]                chain[00]  000000001e90ea30 -- enabled 1 total_transfer_size 0x1c2000 numAllocations 1
    [ 4522.909961]                           [00] enabled 1 buf_size 0x1c2000 buf_dma 1600000 buf_cpu 000000003b877715  wbm: 00000000538c0f5d / 00000000e9e2b875
    [ 4522.909963]                                ad4b0000 001c2000 0a293000 00000000 01600000 00000000 0a292020 00000000
    [ 4522.909965]                chain[01]  0000000058fba1b1 -- enabled 1 total_transfer_size 0x1c2000 numAllocations 1
    [ 4522.909966]                           [00] enabled 1 buf_size 0x1c2000 buf_dma 33000000 buf_cpu 000000002631fa34  wbm: 000000008d261df1 / 0000000042a882c7
    [ 4522.909967]                                ad4b0000 001c2000 0a293020 00000000 33000000 00000000 0a292040 00000000
    [ 4522.909969]                chain[02]  0000000093ad6d4f -- enabled 1 total_transfer_size 0x1c2000 numAllocations 1
    [ 4522.909970]                           [00] enabled 1 buf_size 0x1c2000 buf_dma 33200000 buf_cpu 000000005d41e6c2  wbm: 000000000c5a6e25 / 00000000a558c215
    [ 4522.909972]                                ad4b0000 001c2000 0a293040 00000000 33200000 00000000 0a292060 00000000
    [ 4522.909973]                chain[03]  00000000abac3c3d -- enabled 1 total_transfer_size 0x1c2000 numAllocations 1
    [ 4522.909974]                           [00] enabled 1 buf_size 0x1c2000 buf_dma 32c00000 buf_cpu 000000000b020805  wbm: 000000000bbdfb0f / 000000006e59a6e0
    [ 4522.909976]                                ad4b0000 001c2000 0a293060 00000000 32c00000 00000000 0a292000 00000000
    [ 4522.909983] ------------[ cut here ]------------
    [ 4522.909984] WARNING: CPU: 6 PID: 17159 at drivers/media/v4l2-core/v4l2-dev.c:901 __video_register_device+0xe94/0x11f0 [videodev]
    [ 4522.909994] Modules linked in: sc0710(OE+) videobuf_vmalloc videodev mc videobuf_core mptcp_diag tcp_diag udp_diag raw_diag inet_diag unix_diag snd_hda_codec_generic ledtrig_audio btusb btrtl btbcm btintel bluetooth ecdh_generic ecc crc16 intel_rapl_msr intel_rapl_common joydev mousedev cfg80211 rfkill 8021q garp mrp stp llc edac_mce_amd gigabyte_wmi wmi_bmof kvm_amd snd_hda_codec_ca0132 snd_hda_codec_hdmi kvm snd_hda_intel snd_intel_dspcfg snd_intel_sdw_acpi snd_hda_codec irqbypass crct10dif_pclmul snd_hda_core crc32c_intel ghash_clmulni_intel snd_hwdep aesni_intel snd_pcm crypto_simd dm_mod cryptd r8169 ucsi_ccg sp5100_tco snd_timer usbhid rapl typec_ucsi pcspkr k10temp i2c_piix4 tpm_crb realtek typec snd mdio_devres roles ccp soundcore libphy wmi tpm_tis tpm_tis_core tpm rng_core pinctrl_amd mac_hid vboxnetflt(OE) vboxnetadp(OE) vboxdrv(OE) fuse bpf_preload ip_tables x_tables f2fs crc32_generic lz4hc_compress crc32_pclmul xhci_pci xhci_pci_renesas amdgpu drm_ttm_helper ttm gpu_sched
    [ 4522.910027]  i2c_algo_bit drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops cec drm agpgart [last unloaded: sc0710]
    [ 4522.910032] CPU: 6 PID: 17159 Comm: insmod Tainted: G  R   D W  OE     5.13.7-arch1-1 #1
    [ 4522.910034] Hardware name: Gigabyte Technology Co., Ltd. X570 GAMING X/X570 GAMING X, BIOS F35 07/08/2021
    [ 4522.910035] RIP: 0010:__video_register_device+0xe94/0x11f0 [videodev]
    [ 4522.910043] Code: 83 b8 58 02 00 00 00 0f 85 89 f4 ff ff 48 83 b8 60 02 00 00 00 0f 85 8f f4 ff ff eb a0 0f 0b 41 bf ea ff ff ff e9 33 fb ff ff <0f> 0b 41 bf ea ff ff ff e9 26 fb ff ff 83 f9 01 0f 85 ee f6 ff ff
    [ 4522.910045] RSP: 0018:ffff9d0500a8b9d8 EFLAGS: 00010246
    [ 4522.910046] RAX: 0000000000000000 RBX: ffff8a4dba1d6000 RCX: 0000000000000001
    [ 4522.910048] RDX: 00000000ffffffff RSI: 0000000000000000 RDI: ffff8a4dba1d6000
    [ 4522.910049] RBP: ffff8a4db94f803c R08: ffffffffc0e8bb00 R09: ffff8a4dba1d6000
    [ 4522.910050] R10: ffff9d0500a8b820 R11: ffff8a5c3f275630 R12: ffff8a4db94f8000
    [ 4522.910051] R13: ffff8a4db94f8818 R14: 0000000000000000 R15: 0000000000000000
    [ 4522.910052] FS:  00007f67f19be740(0000) GS:ffff8a5bfeb80000(0000) knlGS:0000000000000000
    [ 4522.910053] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [ 4522.910055] CR2: 000055cc0ec5f660 CR3: 00000001dbbc6000 CR4: 0000000000350ee0
    [ 4522.910056] Call Trace:
    [ 4522.910059]  ? kmem_cache_alloc_trace+0x16c/0x2e0
    [ 4522.910063]  sc0710_video_register+0xdb/0xf0 [sc0710]
    [ 4522.910069]  sc0710_dma_channel_alloc+0x29e/0x2a0 [sc0710]
    [ 4522.910074]  sc0710_dma_channels_alloc+0x27/0x50 [sc0710]
    [ 4522.910078]  sc0710_initdev.cold+0x458/0x5ab [sc0710]
    [ 4522.910082]  local_pci_probe+0x42/0x80
    [ 4522.910084]  ? pci_match_device+0xd7/0x110
    [ 4522.910086]  pci_device_probe+0xfa/0x1b0
    [ 4522.910089]  really_probe+0xf2/0x460
    [ 4522.910092]  driver_probe_device+0xe8/0x160
    [ 4522.910094]  device_driver_attach+0xa1/0xb0
    [ 4522.910096]  __driver_attach+0x8f/0x150
    [ 4522.910098]  ? device_driver_attach+0xb0/0xb0
    [ 4522.910100]  ? device_driver_attach+0xb0/0xb0
    [ 4522.910102]  bus_for_each_dev+0x89/0xd0
    [ 4522.910104]  bus_add_driver+0x12b/0x1e0
    [ 4522.910106]  driver_register+0x8f/0xe0
    [ 4522.910108]  ? 0xffffffffc112f000
    [ 4522.910109]  do_one_initcall+0x57/0x220
    [ 4522.910113]  do_init_module+0x5c/0x270
    [ 4522.910115]  load_module+0x2545/0x2740
    [ 4522.910119]  ? __do_sys_finit_module+0xb1/0x110
    [ 4522.910120]  __do_sys_finit_module+0xb1/0x110
    [ 4522.910123]  do_syscall_64+0x40/0x80
    [ 4522.910125]  entry_SYSCALL_64_after_hwframe+0x44/0xae
    [ 4522.910128] RIP: 0033:0x7f67f1ae418d
    [ 4522.910129] Code: b4 0c 00 0f 05 eb a9 66 0f 1f 44 00 00 f3 0f 1e fa 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d b3 6c 0c 00 f7 d8 64 89 01 48
    [ 4522.910131] RSP: 002b:00007fffdca87098 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
    [ 4522.910133] RAX: ffffffffffffffda RBX: 000055cc108697e0 RCX: 00007f67f1ae418d
    [ 4522.910134] RDX: 0000000000000000 RSI: 000055cc108692a0 RDI: 0000000000000003
    [ 4522.910135] RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
    [ 4522.910135] R10: 0000000000000003 R11: 0000000000000246 R12: 000055cc108692a0
    [ 4522.910136] R13: 0000000000000000 R14: 000055cc108697a0 R15: 000055cc108692a0
    [ 4522.910138] ---[ end trace 1243a4b080390f09 ]---
    [ 4522.910139] sc0710[0]: can't register video device
    [ 4522.910145] sc0710[0] channel 1 allocated
    [ 4522.910146] sc0710[0] ch#1 pt_cpu 00000000fa5f2023  pt_dma a294000  pt_size 8192
    [ 4522.910148]                chain[00]  00000000124e8c9a -- enabled 1 total_transfer_size 0x4000 numAllocations 1
    [ 4522.910149]                           [00] enabled 1 buf_size 0x4000 buf_dma a298000 buf_cpu 00000000fb934588  wbm: 00000000a33f0a8f / 000000004d3f92c5
    [ 4522.910151]                                ad4b0000 00004000 0a295000 00000000 0a298000 00000000 0a294020 00000000
    [ 4522.910152]                chain[01]  000000001e6d4be7 -- enabled 1 total_transfer_size 0x4000 numAllocations 1
    [ 4522.910153]                           [00] enabled 1 buf_size 0x4000 buf_dma a29c000 buf_cpu 0000000010a8af4f  wbm: 00000000c309b846 / 0000000090840455
    [ 4522.910155]                                ad4b0000 00004000 0a295020 00000000 0a29c000 00000000 0a294040 00000000
    [ 4522.910156]                chain[02]  00000000319bc3a2 -- enabled 1 total_transfer_size 0x4000 numAllocations 1
    [ 4522.910157]                           [00] enabled 1 buf_size 0x4000 buf_dma a2a0000 buf_cpu 00000000d8b922b5  wbm: 00000000b0974108 / 000000003cc1cf89
    [ 4522.910159]                                ad4b0000 00004000 0a295040 00000000 0a2a0000 00000000 0a294060 00000000
    [ 4522.910160]                chain[03]  00000000f9b1b53c -- enabled 1 total_transfer_size 0x4000 numAllocations 1
    [ 4522.910161]                           [00] enabled 1 buf_size 0x4000 buf_dma a2a4000 buf_cpu 0000000035d8b5a9  wbm: 00000000869bfdd7 / 0000000072b5095a
    [ 4522.910163]                                ad4b0000 00004000 0a295060 00000000 0a2a4000 00000000 0a294000 00000000
    [ 4522.910266] sc0710[0]/0: Registered ALSA audio device 0000000080e8b046 card 0000000098c91220
    [ 4522.918231] sc0710[0]/0: snd_sc0710_capture_open()
    [ 4522.918272] sc0710[0]/0: snd_sc0710_hw_capture_params() buffer_bytes 19188
    [ 4522.918283] sc0710[0]/0: snd_sc0710_prepare() requested rate = 48000
    [ 4522.919493] sc0710[0]/0: snd_sc0710_hw_capture_free() rate = 48000```
    opened by NogradThGin 4
  • Mk.1 support plans?

    Mk.1 support plans?

    This isn't an issue per se, I'm just curious how likely there will be research into the Mk.1 variant will be as I'm unfortunately the owner of one.
    I'm unaware of how great the differences are between them, I know there's a slight feature change but generally they support the same things, but because they're significantly different on the board it may be worth inquiring about this.

    opened by ProtoFgt 2
  • Centos 8 - Kernel 4.18 - Motherboard X79-UP4

    Centos 8 - Kernel 4.18 - Motherboard X79-UP4

    Install:

    make

    Error:

    Enter Kernel Folder

    make -C /lib/modules/4.18.0-240.15.1.el8_3.x86_64/build M=/home/user/Documents/sc0710-master modules
    make[1]: Entering directory '/usr/src/kernels/4.18.0-240.15.1.el8_3.x86_64'
      CC [M]  /home/user/Documents/sc0710-master/sc0710-cards.o
      CC [M]  /home/user/Documents/sc0710-master/sc0710-core.o
    

    Function not found

    /home/user/Documents/sc0710-master/sc0710-core.c: In function ‘sc0710_initdev’:
    /home/user/Documents/sc0710-master/sc0710-core.c:475:7: error: implicit declaration of function ‘pci_dma_supported’; did you mean ‘acpi_dma_supported’? [-Werror=implicit-function-declaration]
      if (!pci_dma_supported(pci_dev, 0xffffffff)) {
           ^~~~~~~~~~~~~~~~~
           acpi_dma_supported
    /home/user/Documents/sc0710-master/sc0710-core.c:490:4: error: ‘IRQF_DISABLED’ undeclared (first use in this function); did you mean ‘UMH_DISABLED’?
        IRQF_DISABLED, dev->name, dev);
        ^~~~~~~~~~~~~
        UMH_DISABLED
    

    Further errors

    /home/user/Documents/sc0710-master/sc0710-core.c:490:4: note: each undeclared identifier is reported only once for each function it appears in
    cc1: some warnings being treated as errors
    make[2]: *** [scripts/Makefile.build:316: /home/user/Documents/sc0710-master/sc0710-core.o] Error 1
    make[1]: *** [Makefile:1544: _module_/home/user/Documents/sc0710-master] Error 2
    make[1]: Leaving directory '/usr/src/kernels/4.18.0-240.15.1.el8_3.x86_64'
    make: *** [Makefile:14: all] Error 2
    

    I'm unsure of what to do, but I enjoy this project.

    opened by milesmiles902 1
  • bus_to_virt deprecated and changes to dma on 6.0 Kernel

    bus_to_virt deprecated and changes to dma on 6.0 Kernel

    make -C /lib/modules/6.0.12-gentoo-dist/build M=/home/bmorgan/repos/sc0710 modules
    make[1]: Entering directory '/usr/src/linux-6.0.12-gentoo-dist'
    warning: the compiler differs from the one used to build the kernel
      The kernel was built by: x86_64-pc-linux-gnu-gcc (Gentoo 11.3.0 p7) 11.3.0
      You are using:           gcc (Gentoo 11.3.0 p7) 11.3.0
      CC [M]  /home/bmorgan/repos/sc0710/sc0710-cards.o
      CC [M]  /home/bmorgan/repos/sc0710/sc0710-core.o
      CC [M]  /home/bmorgan/repos/sc0710/sc0710-i2c.o
    /home/bmorgan/repos/sc0710/sc0710-i2c.c: In function ‘sc0710_i2c_read_hdmi_status’:
    /home/bmorgan/repos/sc0710/sc0710-i2c.c:177:13: warning: unused variable ‘i’ [-Wunused-variable]
      177 |         int i;
          |             ^
      CC [M]  /home/bmorgan/repos/sc0710/sc0710-dma-channel.o
    /home/bmorgan/repos/sc0710/sc0710-dma-channel.c: In function ‘sc0710_dma_channel_chains_link’:
    /home/bmorgan/repos/sc0710/sc0710-dma-channel.c:369:50: error: implicit declaration of function ‘bus_to_virt’; did you mean ‘fix_to_virt’? [-Werror=implicit-function-declaration]
      369 |                         dca->wbm[0]            = bus_to_virt(curr_wbm);
          |                                                  ^~~~~~~~~~~
          |                                                  fix_to_virt
    /home/bmorgan/repos/sc0710/sc0710-dma-channel.c:369:48: warning: assignment to ‘u32 *’ {aka ‘unsigned int *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
      369 |                         dca->wbm[0]            = bus_to_virt(curr_wbm);
          |                                                ^
    /home/bmorgan/repos/sc0710/sc0710-dma-channel.c:370:48: warning: assignment to ‘u32 *’ {aka ‘unsigned int *’} from ‘long unsigned int’ makes pointer from integer without a cast [-Wint-conversion]
      370 |                         dca->wbm[1]            = bus_to_virt(curr_wbm) + sizeof(u32);
          |                                                ^
    /home/bmorgan/repos/sc0710/sc0710-dma-channel.c: In function ‘sc0710_dma_channel_alloc’:
    /home/bmorgan/repos/sc0710/sc0710-dma-channel.c:428:22: error: implicit declaration of function ‘pci_alloc_consistent’ [-Werror=implicit-function-declaration]
      428 |         ch->pt_cpu = pci_alloc_consistent(dev->pci, ch->pt_size, &ch->pt_dma);
          |                      ^~~~~~~~~~~~~~~~~~~~
    /home/bmorgan/repos/sc0710/sc0710-dma-channel.c:428:20: warning: assignment to ‘u64 *’ {aka ‘long long unsigned int *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
      428 |         ch->pt_cpu = pci_alloc_consistent(dev->pci, ch->pt_size, &ch->pt_dma);
          |                    ^
    /home/bmorgan/repos/sc0710/sc0710-dma-channel.c: In function ‘sc0710_dma_channel_resize’:
    /home/bmorgan/repos/sc0710/sc0710-dma-channel.c:532:20: warning: assignment to ‘u64 *’ {aka ‘long long unsigned int *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
      532 |         ch->pt_cpu = pci_alloc_consistent(dev->pci, ch->pt_size, &ch->pt_dma);
          |                    ^
    cc1: some warnings being treated as errors
    make[2]: *** [scripts/Makefile.build:249: /home/bmorgan/repos/sc0710/sc0710-dma-channel.o] Error 1
    make[1]: *** [Makefile:1852: /home/bmorgan/repos/sc0710] Error 2
    make[1]: Leaving directory '/usr/src/linux-6.0.12-gentoo-dist'
    make: *** [Makefile:14: all] Error 2
    

    Looking at the kernel documentation there is no direct replacement for bus_to_virt. pci_alloc_consistent and pci_free_consistent can be almost directly replaced with dma_alloc_consistent and dma_free_consistent however.

    opened by QuantumGerbil 0
  • Cam Link Pro support?

    Cam Link Pro support?

    I just found this project while looking to see if there was any Linux support for the Cam Link Pro, which also uses DirectShow.

    Is there any possibility that this driver might support that card?

    opened by josswright 1
  • Unstable stream from /dev/video0

    Unstable stream from /dev/video0

    Hello. As a newcomer I want to report unstable streaming from /dev/video0 block device. I tried to encode from it with ffmpeg from your Makefile and it stopped after a few tens of seconds.

    In my theory, something in the module resets and the block device is not available for a short period of time.


    Command and its output:

     ~/tempie % ffmpeg -r 59.94 -f rawvideo -pixel_format yuyv422 -video_size 1920x1080 -i /dev/video0 -vcodec libx264 -f mpegts -y -report encoder0.ts
    ffmpeg started on 2022-09-18 at 21:50:33
    Report written to "ffmpeg-20220918-215033.log"
    Log level: 48
    ffmpeg version 4.4.2-0ubuntu0.22.04.1 Copyright (c) 2000-2021 the FFmpeg developers
      built with gcc 11 (Ubuntu 11.2.0-19ubuntu1)
      configuration: --prefix=/usr --extra-version=0ubuntu0.22.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
      libavutil      56. 70.100 / 56. 70.100
      libavcodec     58.134.100 / 58.134.100
      libavformat    58. 76.100 / 58. 76.100
      libavdevice    58. 13.100 / 58. 13.100
      libavfilter     7.110.100 /  7.110.100
      libswscale      5.  9.100 /  5.  9.100
      libswresample   3.  9.100 /  3.  9.100
      libpostproc    55.  9.100 / 55.  9.100
    Input #0, rawvideo, from '/dev/video0':
      Duration: N/A, start: 0.000000, bitrate: 1988665 kb/s
      Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 1920x1080, 1988665 kb/s, 59.94 tbr, 59.94 tbn, 59.94 tbc
    Stream mapping:
      Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
    Press [q] to stop, [?] for help
    [libx264 @ 0x563ada966ec0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
    [libx264 @ 0x563ada966ec0] profile High 4:2:2, level 4.2, 4:2:2, 8-bit
    Output #0, mpegts, to 'encoder0.ts':
      Metadata:
        encoder         : Lavf58.76.100
      Stream #0:0: Video: h264, yuv422p(tv, progressive), 1920x1080, q=2-31, 59.94 fps, 90k tbn
        Metadata:
          encoder         : Lavc58.134.100 libx264
        Side data:
          cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
    /dev/video0: Invalid argumentze=    3072kB time=00:00:24.24 bitrate=1038.2kbits/s speed=0.952x    
    frame= 1535 fps= 58 q=-1.0 Lsize=    4117kB time=00:00:25.55 bitrate=1319.7kbits/s speed=0.973x    
    video:3758kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 9.571123%
    [libx264 @ 0x563ada966ec0] frame I:8     Avg QP:20.88  size: 56744
    [libx264 @ 0x563ada966ec0] frame P:417   Avg QP:23.71  size:  5662
    [libx264 @ 0x563ada966ec0] frame B:1110  Avg QP:23.98  size:   931
    [libx264 @ 0x563ada966ec0] consecutive B-frames:  3.1%  0.5%  2.5% 93.8%
    [libx264 @ 0x563ada966ec0] mb I  I16..4: 73.1% 18.5%  8.4%
    [libx264 @ 0x563ada966ec0] mb P  I16..4:  3.6%  2.5%  0.3%  P16..4: 11.6%  1.3%  1.1%  0.0%  0.0%    skip:79.6%
    [libx264 @ 0x563ada966ec0] mb B  I16..4:  0.1%  0.0%  0.0%  B16..8:  7.8%  0.2%  0.0%  direct: 0.3%  skip:91.6%  L0:38.0% L1:60.7% BI: 1.4%
    [libx264 @ 0x563ada966ec0] 8x8 transform intra:33.3% inter:80.1%
    [libx264 @ 0x563ada966ec0] coded y,uvDC,uvAC intra: 8.9% 37.1% 7.0% inter: 0.7% 2.8% 0.2%
    [libx264 @ 0x563ada966ec0] i16 v,h,dc,p: 29% 57%  6%  9%
    [libx264 @ 0x563ada966ec0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 13% 24% 55%  2%  1%  1%  2%  1%  1%
    [libx264 @ 0x563ada966ec0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 29% 23% 22%  4%  5%  4%  4%  4%  3%
    [libx264 @ 0x563ada966ec0] i8c dc,h,v,p: 54% 31% 12%  3%
    [libx264 @ 0x563ada966ec0] Weighted P-Frames: Y:4.1% UV:1.9%
    [libx264 @ 0x563ada966ec0] ref P L0: 60.0%  6.9% 25.1%  7.6%  0.5%
    [libx264 @ 0x563ada966ec0] ref B L0: 90.8%  8.0%  1.2%
    [libx264 @ 0x563ada966ec0] ref B L1: 97.1%  2.9%
    [libx264 @ 0x563ada966ec0] kb/s:1202.07
    

    Filtered out error:

    /dev/video0: Invalid argument
    

    ffmpeg log: ffmpeg-20220918-215033.log dmesg: dmesg-cap.log

    I am using 64-bit Ubuntu 22.04.1 LTS with Linux kernel in version 5.15.0-47-generic. PlayStation 4 Pro is the source of video.

    opened by dehahost 1
  • It built and loaded, now how the heck do I use it?

    It built and loaded, now how the heck do I use it?

    Sorry if this is a pretty elementary question, as i am new to Linux in general. I am pretty familiar with building projects and all seems well upon a sudo make load. you can see the output below.

    make -C /lib/modules/5.15.60-1-MANJARO/build M=/home/hisashiasm/sc0710 modules
    make[1]: Entering directory '/usr/lib/modules/5.15.60-1-MANJARO/build'
    make[1]: Leaving directory '/usr/lib/modules/5.15.60-1-MANJARO/build'
    sudo dmesg -c >/dev/null
    sudo cp /dev/null /var/log/debug
    #sudo modprobe videobuf2-core
    sudo modprobe videobuf2-common
    sudo modprobe videodev
    #sudo modprobe videobuf-dma-sg
    sudo modprobe videobuf-vmalloc
    sudo insmod ./sc0710.ko \
    	thread_dma_poll_interval_ms=2 \
    	dma_status=0
    

    Now how do I see the visual output of said device?

    opened by HisashiASM 4
  • Installation help

    Installation help

    Hello, I'm trying to install the driver on my machine but I got no success... as far I understood I should make the objects (which seems ok):

    escribano@escribano:/media/dados/sources/sc0710$ make all
    make -C /lib/modules/5.15.0-41-generic/build M=/media/dados/sources/sc0710 modules
    make[1]: Entrando no diretório '/usr/src/linux-headers-5.15.0-41-generic'
      CC [M]  /media/dados/sources/sc0710/sc0710-cards.o
      CC [M]  /media/dados/sources/sc0710/sc0710-core.o
      CC [M]  /media/dados/sources/sc0710/sc0710-i2c.o
    /media/dados/sources/sc0710/sc0710-i2c.c: In function ‘sc0710_i2c_read_hdmi_status’:
    /media/dados/sources/sc0710/sc0710-i2c.c:177:6: warning: unused variable ‘i’ [-Wunused-variable]
      177 |  int i;
          |      ^
      CC [M]  /media/dados/sources/sc0710/sc0710-dma-channel.o
      CC [M]  /media/dados/sources/sc0710/sc0710-dma-channels.o
      CC [M]  /media/dados/sources/sc0710/sc0710-dma-chains.o
      CC [M]  /media/dados/sources/sc0710/sc0710-dma-chain.o
      CC [M]  /media/dados/sources/sc0710/sc0710-things-per-second.o
      CC [M]  /media/dados/sources/sc0710/sc0710-video.o
      CC [M]  /media/dados/sources/sc0710/sc0710-audio.o
      LD [M]  /media/dados/sources/sc0710/sc0710.o
      MODPOST /media/dados/sources/sc0710/Module.symvers
      CC [M]  /media/dados/sources/sc0710/sc0710.mod.o
      LD [M]  /media/dados/sources/sc0710/sc0710.ko
    make[1]: Saindo do diretório '/usr/src/linux-headers-5.15.0-41-generic'
    

    But when i try to "load" (as i understood it will load the module into my kernel) i got this message:

    escribano@escribano:/media/dados/sources/sc0710$ sudo make load
    make -C /lib/modules/5.15.0-41-generic/build M= modules
    make[1]: Entering in directory '/usr/src/linux-headers-5.15.0-41-generic'
    make[2]: *** No rule to make target 'arch/x86/entry/syscalls/syscall_32.tbl', needed by 'arch/x86/include/generated/uapi/asm/unistd_32.h'.  Stop.
    make[1]: *** [arch/x86/Makefile:213: archheaders] Erro 2
    make[1]: Leaving directory '/usr/src/linux-headers-5.15.0-41-generic'
    make: *** [Makefile:14: all] Erro 2
    

    When i try to run without sudo, i got a different error output:

    escribano@escribano:/media/dados/sources/sc0710$ make load
    make -C /lib/modules/5.15.0-41-generic/build M=/media/dados/sources/sc0710 modules
    make[1]: Entering in directory '/usr/src/linux-headers-5.15.0-41-generic'
    make[1]: Leaving directory '/usr/src/linux-headers-5.15.0-41-generic'
    sudo dmesg -c >/dev/null
    sudo cp /dev/null /var/log/debug
    #sudo modprobe videobuf2-core
    sudo modprobe videobuf2-common
    sudo modprobe videodev
    #sudo modprobe videobuf-dma-sg
    sudo modprobe videobuf-vmalloc
    sudo insmod ./sc0710.ko \
    	thread_dma_poll_interval_ms=2 \
    	dma_status=0
    insmod: ERROR: could not insert module ./sc0710.ko: Invalid module format
    

    I want to put my elgato to run on Linux and stream with my PS5, I'm also a developer with knowledge in disassembling, I could help if you could show me where to start to debug the card.

    PS: When I try to compile, I got a few dependencies errors which I solved by running: sudo apt install flex bison v4l-utils

    Thanks

    opened by joaoescribano 11
Owner
Steven Toth
Steven Toth
Loads a signed kernel driver which allows you to map any driver to kernel mode without any traces of the signed / mapped driver.

CosMapper Loads a signed kernel driver (signed with leaked cert) which allows you to map any driver to kernel mode without any traces of the signed /

null 157 Jan 2, 2023
User space configuration tool for RME HDSPe MADI / AES / RayDAT / AIO and AIO Pro cards driven by the snd-hdspe driver.

hdspeconf User space configuration tool for RME HDSPe MADI / AES / RayDAT / AIO and AIO Pro cards, driven by the snd-hdspe driver. Building hdspeconf

Philippe Bekaert 10 Nov 29, 2022
VEX v5 Pro program that records driver movements and plays them back during the autonomous period.

Autonomous Recorder This code was written for team 5588R, but it can be easily modified to work with your team's robot. Notes Code isn't fully finishe

brett 2 Jun 21, 2022
Allows to swap the Fn key and left Control key and other tweaks on Macbook Pro and Apple keyboards in GNU/Linux

A patched hid-apple kernel module UPDATE August 2020: swap_fn_leftctrl is now built-in in Linux 5.8 ?? UPDATE Jun 2020: New feature added (swap_fn_f13

Zakhar Semenov 305 Dec 29, 2022
x64 Windows kernel driver mapper, inject unsigned driver using anycall

anymapper x64 Windows kernel driver mapper, inject unsigned driver using anycall This project is WIP. Todo Fix: Can't make API calls from IAT nor func

Kento Oki 72 Dec 26, 2022
Driver leap - Self-sustainable fork of SteamVR driver for Leap Motion controller with updated vendor libraries

Driver Leap Self-sustainable fork of SteamVR driver for Leap Motion controller with updated vendor libraries Installation (for users) Install Ultralea

null 68 Jan 5, 2023
Hygieia, a vulnerable driver traces scanner written in C++ as an x64 Windows kernel driver.

Hygieia The Greek goddess of health, her name is the source for the word "hygiene". Hygieia is a windows driver that works similarly to how pagewalkr

Deputation 103 Dec 4, 2022
SinMapper - usermode driver mapper that forcefully loads any signed kernel driver

usermode driver mapper that forcefully loads any signed kernel driver (legit cert) with a big enough section (example: .data, .rdata) to map your driver over. the main focus of this project is to prevent modern anti-cheats (BattlEye, EAC) from finding your driver and having the power to hook anything due to being inside of legit memory (signed legit driver).

null 170 Dec 29, 2022
A CAF rebased kernel for Mi 9 & RedMi K20 Pro MIUI 12.5

Linux kernel ============ This file was moved to Documentation/admin-guide/README.rst Please notice that there are several guides for kernel develop

Stephen Sin 76 Jan 8, 2023
Device configuration for the Redmi Note 10 Pro / Max

Device configuration for the Redmi Note 10 Pro / Pro Max Copyright (C) 2021 ArrowOS The Redmi Note 10 Pro / Pro Max (sweet) is a mid-range smartphone

ArrowOS-Devices 29 Dec 16, 2022
A proposition for a fully intergrated kext for all Surface Pro hardwares

BigSurface The name comes from macOS Big Sur. Big Sur + Surface -> Big Surface (LOL) PS:If you have a better name, please let me know. A proposition f

null 174 Dec 31, 2022
Delta Kernel for Redmi Note 10 Pro (Max) (sweet/sweetin)

Linux kernel ============ This file was moved to Documentation/admin-guide/README.rst Please notice that there are several guides for kernel develop

Static Design Studio 13 Jul 31, 2022
split89 keyboard - a 3d printed 89 key split TKL keyboard base powered by ATmega32U4 Pro Micro controllers with QMK Configurator support.

split89 keyboard - a 3d printed 89 key split TKL keyboard base powered by ATmega32U4 Pro Micro controllers with QMK Configurator support. This keyboar

null 54 Jan 7, 2023
IDA Pro key checker tool

IDA Key Checker IDA Pro (6.x-7.x) key checker tool Usage A list of available options can be retrieved using: ida_key_checker --help Arguments: Option

null 58 Dec 26, 2022
Macro keypad and rotary input based on the ATmega32U4 Pro Micro board

JC-Pro-Macro Macro keypad and rotary input based on the ATmega32U4 Pro Micro Videos: Development: https://www.youtube.com/watch?v=g-XJLiv03rI Assembly

Jeremy S Cook 13 Oct 26, 2022
A cheap,simple,Ongeki controller Use Keyboard Simulation and Mouse Simulation to controller the ongeki game. Using Pro-micro control.

N.A.G.E.K.I. A cheap,simple,Ongeki controller Use Keyboard Simulation and Mouse Simulation to controller the ongeki game. Using Pro-micro control. 中文版

NanaNana 39 Dec 8, 2022
A cheap,simple,Ongeki controller Use Keyboard Simulation and Mouse Simulation to controller the ongeki game. Using Pro-micro control.

N.A.G.E.K.I. PLEASE CHECK Main Project A cheap,simple,Ongeki controller Use Keyboard Simulation and Mouse Simulation to controller the ongeki game. Us

NanaNana 11 Dec 30, 2021
Common Device Source For Xiaomi Redmi Note 5 Pro (whyred)

The Redmi Note 5 Pro (codenamed "whyred") are high-end mid-range smartphones from Xiaomi announced and released in February 2018. Device specification

Yash Biyani 0 Dec 22, 2021
Pixel 6 and Pixel 6 Pro kernel sources.

How do I submit patches to Android Common Kernels BEST: Make all of your changes to upstream Linux. If appropriate, backport to the stable releases. T

GrapheneOS 13 Dec 14, 2022