EmixamPP / linux-enable-ir-emitter

Provides support for infrared cameras that are not directly enabled out-of-the box.
MIT License
242 stars 21 forks source link

Lenovo T14s (OpenRC) #110

Closed NicolaSmaniotto closed 1 year ago

NicolaSmaniotto commented 1 year ago

Output of linux-enable-ir-emitter boot status

# linux-enable-ir-emitter boot status
Traceback (most recent call last):
  File "/usr/bin/linux-enable-ir-emitter", line 93, in <module>
    boot(args.boot_status)
  File "/usr/lib64/linux-enable-ir-emitter/command/boot.py", line 37, in boot
    if Systemd.status():
       ^^^^^^^^^^^^^^^^
  File "/usr/lib64/linux-enable-ir-emitter/systemd/Systemd.py", line 73, in status
    exec = subprocess.run(["systemctl", "status", SYSTEMD_NAME], capture_output=True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/subprocess.py", line 548, in run
    with Popen(*popenargs, **kwargs) as process:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/subprocess.py", line 1024, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.11/subprocess.py", line 1917, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'systemctl'

I use Gentoo (OpenRC), so of course this fails.

*Output of `cat /etc/linux-enable-ir-emitter/`**

$ cat /etc/linux-enable-ir-emitter/*
device=/dev/v4l/by-path/pci-0000:34:00.0-usb-0:1:1.2-video-index0
unit=7
selector=6
size=9
control0=1
control1=3
control2=2
control3=0
control4=0
control5=0
control6=0
control7=0
control8=0
4 3

Give more information if you have The output of the configuration phase:

# linux-enable-ir-emitter configure
INFO: Ensure to not use the camera during the execution.
INFO: Warning to do not kill the process !
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? No
Is the ir emitter flashing (not just turn on) ? Yes/No ? Yes
INFO: The driver has been successfully generated.
Traceback (most recent call last):
  File "/usr/bin/linux-enable-ir-emitter", line 89, in <module>
    configure(device, args.emitters[0], args.limit[0])
  File "/usr/lib64/linux-enable-ir-emitter/command/configure.py", line 28, in configure
    boot("enable")
  File "/usr/lib64/linux-enable-ir-emitter/command/boot.py", line 27, in boot
    if systemd.enable():
       ^^^^^^^^^^^^^^^^
  File "/usr/lib64/linux-enable-ir-emitter/systemd/Systemd.py", line 60, in enable
    exit_code = subprocess.run(["systemctl", "enable", "--now", SYSTEMD_NAME], capture_output=True).returncode
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/subprocess.py", line 548, in run
    with Popen(*popenargs, **kwargs) as process:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/subprocess.py", line 1024, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.11/subprocess.py", line 1917, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'systemctl'

It took a while, but in the end the emitter did start flashing (the Yes answer). The driver "has been succesfully generated", but then of course it could not be activated because of the missing systemd.

I'm opening the issue because after running # linux-enable-ir-emitter run -v, the process immediately terminates with no output, but the test command suggested here on the arch wiki outputs:

$ gst-launch-1.0 v4l2src device=/dev/video2 num-buffers=10 ! image/jpeg ! multifilesink location="frame-%02d.jpg"
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data stream error.
Additional debug info:
../gstreamer-1.20.5/libs/gst/base/gstbasesrc.c(3127): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
streaming stopped, reason not-negotiated (-4)
Execution ended after 0:00:00.000090514
Setting pipeline to NULL ...
Freeing pipeline ...

Then returns with code 1

Additional info

$ v4l2-ctl --list-devices --all                                                                                  
Integrated RGB Camera: Integrat (usb-0000:34:00.0-1):
        /dev/video0
        /dev/video1
        /dev/video2
        /dev/video3
        /dev/media0
        /dev/media1

Driver Info:
        Driver name      : uvcvideo
        Card type        : Integrated RGB Camera: Integrat
        Bus info         : usb-0000:34:00.0-1
        Driver version   : 6.3.7
        Capabilities     : 0x84a00001
                Video Capture
                Metadata Capture
                Streaming
                Extended Pix Format
                Device Capabilities
        Device Caps      : 0x04200001
                Video Capture
                Streaming
                Extended Pix Format
Media Driver Info:
        Driver name      : uvcvideo
        Model            : Integrated RGB Camera: Integrat
        Serial           : 01.00.00
        Bus info         : usb-0000:34:00.0-1
        Media version    : 6.3.7
        Hardware revision: 0x00006717 (26391)
        Driver version   : 6.3.7
Interface Info:
        ID               : 0x03000002
        Type             : V4L Video
Entity Info:
        ID               : 0x00000001 (1)
        Name             : Integrated RGB Camera: Integrat
        Function         : V4L2 I/O
        Flags            : default
        Pad 0x01000007   : 0: Sink
          Link 0x02000016: from remote pad 0x100000a of entity 'Extension 5' (Video Pixel Formatter): Data, Enabled, Immutable
Priority: 2
Video input : 0 (Camera 1: ok)
Format Video Capture:
        Width/Height      : 1920/1080
        Pixel Format      : 'MJPG' (Motion-JPEG)
        Field             : None
        Bytes per Line    : 0
        Size Image        : 4147200
        Colorspace        : sRGB
        Transfer Function : Rec. 709
        YCbCr/HSV Encoding: ITU-R 601
        Quantization      : Default (maps to Full Range)
        Flags             : 
Crop Capability Video Capture:
        Bounds      : Left 0, Top 0, Width 1920, Height 1080
        Default     : Left 0, Top 0, Width 1920, Height 1080
        Pixel Aspect: 1/1
Selection Video Capture: crop_default, Left 0, Top 0, Width 1920, Height 1080, Flags: 
Selection Video Capture: crop_bounds, Left 0, Top 0, Width 1920, Height 1080, Flags: 
Streaming Parameters Video Capture:
        Capabilities     : timeperframe
        Frames per second: 30.000 (30/1)
        Read buffers     : 0

User Controls

                     brightness 0x00980900 (int)    : min=0 max=255 step=1 default=128 value=128
                       contrast 0x00980901 (int)    : min=0 max=100 step=1 default=32 value=32
                     saturation 0x00980902 (int)    : min=0 max=100 step=1 default=64 value=64
                            hue 0x00980903 (int)    : min=-180 max=180 step=1 default=0 value=0
        white_balance_automatic 0x0098090c (bool)   : default=1 value=1
                          gamma 0x00980910 (int)    : min=90 max=150 step=1 default=120 value=120
           power_line_frequency 0x00980918 (menu)   : min=0 max=3 default=1 value=1 (50 Hz)
                                0: Disabled
                                1: 50 Hz
                                2: 60 Hz
                                3: Auto
      white_balance_temperature 0x0098091a (int)    : min=2800 max=6500 step=1 default=4600 value=4600 flags=inactive
                      sharpness 0x0098091b (int)    : min=0 max=7 step=1 default=3 value=3
         backlight_compensation 0x0098091c (int)    : min=0 max=2 step=1 default=1 value=1

Camera Controls

                  auto_exposure 0x009a0901 (menu)   : min=0 max=3 default=3 value=3 (Aperture Priority Mode)
                                1: Manual Mode
                                3: Aperture Priority Mode
         exposure_time_absolute 0x009a0902 (int)    : min=2 max=1250 step=1 default=156 value=156 flags=inactive
     exposure_dynamic_framerate 0x009a0903 (bool)   : default=0 value=1
                        privacy 0x009a0910 (bool)   : default=0 value=0

EmixamPP commented 1 year ago

I'm opening the issue because after running # linux-enable-ir-emitter run -v, the process immediately terminates with no output,

$ linux-enable-ir-emitter run shows nothing if there is no error (also, the exit code is 0 if success).

but the test command suggested here on the arch wiki outputs: ... Then returns with code 1

After executing linux-enable-ir-emitter run, you can check if the emitter is working properly (i.e. blinks), by executing sudo howdy test (if installed, think to configure the ir camera path first in sudo howdy configure) or using ffplay /dev/video2 (usually provided by the ffmpeg package)

NicolaSmaniotto commented 1 year ago

$ linux-enable-ir-emitter run

Forgot to mention, the exit code is 0

$ ffplay /dev/video2

This works, yay! It opens a window and the ir flashes. There must be some other problem with the gstreamer command.

I don't have howdy installed yet, since it is not packaged for gentoo. Working to package it myself, so I can test the whole setup.

Closing this, since it was actually an issue with how I tested the emitter, rather than it not being enabled.