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

Not working at boot #48

Closed benoe77 closed 2 years ago

benoe77 commented 3 years ago

Even if I ran the "linux-enable-ir-emitter boot enable" command and the status is:

● linux-enable-ir-emitter.service - enable the infrared emitter
     Loaded: loaded (/lib/systemd/system/linux-enable-ir-emitter.service; enabled; vendor preset: enabled)
     Active: inactive (dead) since Thu 2021-10-14 08:28:01 CEST; 3h 24min ago
   Main PID: 1477 (code=exited, status=0/SUCCESS)

okt 14 08:28:01 user-linux systemd[1]: Starting enable the infrared emitter...
okt 14 08:28:01 user-linux systemd[1]: linux-enable-ir-emitter.service: Succeeded.
okt 14 08:28:01 user-linux systemd[1]: Finished enable the infrared emitter.

It just doesn't enable the emitter during face scan. I need to run the command again to make it work at the current session. I'm on Ubuntu 20.4.3 LTS

EmixamPP commented 3 years ago

Yes there is an issue on Ubuntu distro based I think. Someone has open the same issue the previous week. Please look at the wiki I've wrote a small fix. https://github.com/EmixamPP/linux-enable-ir-emitter/wiki/Issues.

But the problem is that I don't have a clean fix for this problem. In other words, this fix need to be done manually for each configuration.

benoe77 commented 3 years ago

Unfortunately that fix is not working for me:

journalctl -xeu linux-enable-ir-emitter.service
-- Support: http://www.ubuntu.com/support
-- 
-- A start job for unit linux-enable-ir-emitter.service has finished successfully.
-- 
-- The job identifier is 5345.
-- Reboot --
okt 14 15:36:44 user-linux systemd[1]: Starting enable the infrared emitter...
-- Subject: A start job for unit linux-enable-ir-emitter.service has begun execution
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- A start job for unit linux-enable-ir-emitter.service has begun execution.
-- 
-- The job identifier is 166.
okt 14 15:36:45 benoe-ys7 systemd[1]: linux-enable-ir-emitter.service: Succeeded.
-- Subject: Unit succeeded
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- The unit linux-enable-ir-emitter.service has successfully entered the 'dead' state.
okt 14 15:36:45 benoe-ys7 systemd[1]: Finished enable the infrared emitter.
-- Subject: A start job for unit linux-enable-ir-emitter.service has finished successfully
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- A start job for unit linux-enable-ir-emitter.service has finished successfully.
-- 
-- The job identifier is 166.
EmixamPP commented 3 years ago

I don't think you have the last version of linux-eanble-ir-emiter, I'm right ? Because I see that there are something missing in your boot status command.

It is ExecStartPre=/sbin/modprobe uvcvideo (code=exited, status=0/SUCCESS)

benoe77 commented 3 years ago

Your fix removed that part from the service file if I'm right:

[Service] Type=oneshot ExecStart=/usr/bin/linux-enable-ir-emitter run

EmixamPP commented 3 years ago

Even if I ran the "linux-enable-ir-emitter boot enable" command and the status is:

     Loaded: loaded (/lib/systemd/system/linux-enable-ir-emitter.service; enabled; vendor preset: enabled)
     Active: inactive (dead) since Thu 2021-10-14 08:28:01 CEST; 3h 24min ago
   Main PID: 1477 (code=exited, status=0/SUCCESS)

okt 14 08:28:01 user-linux systemd[1]: Starting enable the infrared emitter...
okt 14 08:28:01 user-linux systemd[1]: linux-enable-ir-emitter.service: Succeeded.
okt 14 08:28:01 user-linux systemd[1]: Finished enable the infrared emitter.

It just doesn't enable the emitter during face scan. I need to run the command again to make it work at the current session. I'm on Ubuntu 20.4.3 LTS

But in your first message I don't see ExecStartPre=/sbin/modprobe uvcvideo (code=exited, status=0/SUCCESS). Or did you mean that you had already applied the wiki fix before opening the issue ?

Example with mine :

○ linux-enable-ir-emitter.service - enable the infrared emitter
     Loaded: loaded (/usr/lib/systemd/system/linux-enable-ir-emitter.service; enabled; vendor preset: disabled)
     Active: inactive (dead) since Thu 2021-10-14 17:53:42 CEST; 30min ago
    Process: 37344 ExecStartPre=/sbin/modprobe uvcvideo (code=exited, status=0/SUCCESS)
    Process: 37348 ExecStart=/usr/bin/linux-enable-ir-emitter run (code=exited, status=0/SUCCESS)
   Main PID: 37348 (code=exited, status=0/SUCCESS)
        CPU: 263ms

oct 14 17:53:42 fedora systemd[1]: Starting enable the infrared emitter...
oct 14 17:53:42 fedora systemd[1]: linux-enable-ir-emitter.service: Deactivated successfully.
oct 14 17:53:42 fedora systemd[1]: Finished enable the infrared emitter.
benoe77 commented 3 years ago

It seems to work on the latest version. Thanks.

EmixamPP commented 3 years ago

Your welcome ! Feel free to close the issue when you'r sure that your problem is fixed.

benoe77 commented 3 years ago

No, it is still not ok. I uninstalled, updated the repo, reinstalled, applied the workaround, and it is still not applied at boot.

linux-enable-ir-emitter boot status:

● linux-enable-ir-emitter.service - enable the infrared emitter
     Loaded: loaded (/lib/systemd/system/linux-enable-ir-emitter.service; enabled; vendor preset: enabled)
     Active: inactive (dead) since Fri 2021-10-22 14:49:31 CEST; 2min 44s ago
    Process: 1686 ExecStart=/usr/bin/linux-enable-ir-emitter run (code=exited, status=0/SUCCESS)
   Main PID: 1686 (code=exited, status=0/SUCCESS)

okt 22 14:49:31 user-linux systemd[1]: Starting enable the infrared emitter...
okt 22 14:49:31 user-linux systemd[1]: linux-enable-ir-emitter.service: Succeeded.
okt 22 14:49:31 user-linux systemd[1]: Finished enable the infrared emitter.

journalctl -xeu linux-enable-ir-emitter.service:

-- Subject: A start job for unit linux-enable-ir-emitter.service has finished successfully
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- A start job for unit linux-enable-ir-emitter.service has finished successfully.
-- 
-- The job identifier is 7533.
-- Reboot --
okt 22 14:49:31 user-linux systemd[1]: Starting enable the infrared emitter...
-- Subject: A start job for unit linux-enable-ir-emitter.service has begun execution
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- A start job for unit linux-enable-ir-emitter.service has begun execution.
-- 
-- The job identifier is 105.
okt 22 14:49:31 user-linux systemd[1]: linux-enable-ir-emitter.service: Succeeded.
-- Subject: Unit succeeded
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- The unit linux-enable-ir-emitter.service has successfully entered the 'dead' state.
okt 22 14:49:31 user-linux systemd[1]: Finished enable the infrared emitter.
-- Subject: A start job for unit linux-enable-ir-emitter.service has finished successfully
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- A start job for unit linux-enable-ir-emitter.service has finished successfully.
-- 
-- The job identifier is 105.

It works when I start manually with the run parameter.

EmixamPP commented 3 years ago

I think the problem is that the systemd service runs before the camera initialization is complete. I'll try to keep looking for a better solution: for example, not using systemd anymore, but I'm quite busy at the moment. If you have an idea, feel free to suggest it to me. (in this issue or in a pull request)

EmixamPP commented 3 years ago

https://github.com/EmixamPP/linux-enable-ir-emitter/issues/49#issuecomment-950371181 has solve the same issue than you. But I've no more information to give you sorry !

EmixamPP commented 3 years ago

https://github.com/EmixamPP/linux-enable-ir-emitter/issues/57#issuecomment-960600802

EmixamPP commented 3 years ago

The release 3.2.2 is out and I think this will be resolve your problem.

EmixamPP commented 3 years ago

https://github.com/EmixamPP/linux-enable-ir-emitter/issues/60#issuecomment-962477412 this comment means that this issue is also resolved ?

benoe77 commented 3 years ago

Even the previous version was working sometimes, sometimes wasn't. Let me test it for a few more days, then I will report back Now it seems to be working btw.

benoe77 commented 3 years ago

Unfortunately it is not 100% yet. It usually works after a simple reboot, but there are cold starts, usually after nightlong switched off states, when the emitter doesn't lights up. Just updated to the latest version, I'll keep watching

EmixamPP commented 3 years ago

The lastest version doens't modify the boot systemd (unfortunatly). When you said "usually after nightlong switched off states", you mean hibernate state ? Or a real shutdown ? An other issue have been open too for hibernate problem. (This hibernate feature isn't activate by default, right ?)

But thank you for your experiments.

benoe77 commented 3 years ago

I mean a real shutdown.

AndrejOrsula commented 3 years ago

I was having the same issue as described above. However, it seems to work on every boot after changing the type of the service to forking, i.e. Type=forking in /usr/lib/systemd/system/linux-enable-ir-emitter.service.

It is probably not an ideal solution, but it fixes some timing issue for me. With oneshot, my success rate was otherwise ~5%.

PS: Many thanks for the great work on this project.

EmixamPP commented 3 years ago

May be these two sets of rules can fix your problem, execute :

  1. Find in lsusb your camera device, for me it's Bus 001 Device 002: ID 13d3:5406 IMC Networks Integrated Camera
  2. Note for the next step, the two values after ID (value1:value2)
  3. Replace my two values with yours in the following command and then execute : echo 'ACTION=="add|change", ATTRS{idVendor}=="13d3", ATTRS{idProduct}=="5406", RUN+="/usr/bin/linux-enable-ir-emitter run"' | sudo tee -a /etc/udev/rules.d/99-linux-enable-ir-emitter.rules
  4. shutdown and start in order to test the solution

The idea of @AndrejOrsula shouldn't necessary in this case.

If someone of you can test it ? I hope I will a day find a solution which works on all Linux distribution :sweat_smile:

benoe77 commented 2 years ago

Currently testing this latest solution, seems all right so far.

nikfilippas commented 1 year ago

Changing to Type=forking from Type=oneshot as per @AndrejOrsula 's suggestion worked for me on XPS 9520 and Ubuntu 22.04 LTS.