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

feat(v5): fully automatic generation #121

Merged
merged 76 commits into from
Aug 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
0e76359
refactor to prepare new changes
EmixamPP Jul 9, 2023
0893bb1
fix CI warning
EmixamPP Jul 9, 2023
2079924
refactor part2
EmixamPP Jul 10, 2023
84bbfb8
skeleton auto generation
EmixamPP Jul 10, 2023
07391dc
add virtual destructor everywhere
EmixamPP Jul 10, 2023
f72f06b
move wiki to docs folder
EmixamPP Jul 10, 2023
7f4019a
update docs links
EmixamPP Jul 10, 2023
d2b19d7
doc: how to find ir camera
EmixamPP Jul 10, 2023
ab44476
doc: fix broken links
EmixamPP Jul 10, 2023
92b0a67
build: opencv-tiny v4.8.0
EmixamPP Jul 10, 2023
45d27cb
feat: draft auto detection emitter is working
EmixamPP Jul 10, 2023
d3dde0d
refactor: move camera related files
EmixamPP Jul 17, 2023
fce2042
feat: exhaustive configuration
EmixamPP Jul 17, 2023
2b7952e
fix(auto config): negative answer by default
EmixamPP Jul 17, 2023
9ce9b79
fix: unkown arguments
EmixamPP Jul 17, 2023
79534f6
fix(config): auto and manual was inversed
EmixamPP Jul 17, 2023
2766eb4
fix: corrupted driver file
EmixamPP Jul 17, 2023
8bd1726
refactor(camera): remove usless opencv import
EmixamPP Jul 17, 2023
1cbb659
refactor(finder): initialize nullptr in hpp
EmixamPP Jul 17, 2023
e84e05b
refactor(camera): use common methods for videocapture
EmixamPP Jul 17, 2023
f6fa9ba
build: use meson everything warning level
EmixamPP Jul 17, 2023
6453d03
refactor: comply to meson everything warning flags
EmixamPP Jul 17, 2023
30dbbf6
fix(CI): install meson through pip
EmixamPP Jul 18, 2023
d4a2871
fix(CI): remove unkown ignored warning for opencv
EmixamPP Jul 18, 2023
4f8eee1
Revert "fix(CI): remove unkown ignored warning for opencv"
EmixamPP Jul 18, 2023
f9c9825
fix(CI): unkown GCC pragmas
EmixamPP Jul 18, 2023
5c5229f
style: remove extra semicolon
EmixamPP Jul 18, 2023
6228f67
style: comply to all clang-tidy checks
EmixamPP Jul 18, 2023
004c718
doc: update readme
EmixamPP Jul 18, 2023
ffdfea3
fix: manual and exhaustive argument badly handled
EmixamPP Jul 18, 2023
147620f
refactor: usage of memory owner
EmixamPP Jul 20, 2023
baf042c
feat: find automatically ir camera
EmixamPP Jul 20, 2023
ddb917e
fix: executing driver
EmixamPP Jul 20, 2023
7e99c63
build(auto detect ir): remove useless link
EmixamPP Jul 21, 2023
ddb140f
perf: avoid copy
EmixamPP Jul 21, 2023
fb3e612
style: use smart pointer
EmixamPP Jul 22, 2023
d8931e8
build: add comment
EmixamPP Jul 22, 2023
326bf7e
feat: automatic configuration
EmixamPP Jul 22, 2023
edc7cc9
chore(workflow): change CI artifact name
EmixamPP Jul 23, 2023
f72a1fd
chore(workflow): artifact root owner
EmixamPP Jul 23, 2023
3e8d6b0
chore(workflow): fix sudo meson command not found
EmixamPP Jul 23, 2023
e18f057
chore(workflow): CI fix permission denied
EmixamPP Jul 23, 2023
1578b7c
fix(auto config): increase magic value to avoid false positive
EmixamPP Jul 24, 2023
4000cde
fix(auto config): increase magic value to avoid false positive
EmixamPP Jul 24, 2023
2699a13
fix(auto config): reduce risk of false positive
EmixamPP Jul 26, 2023
9dc8999
fix(auto config): ask for confirmation
EmixamPP Jul 27, 2023
84bab96
doc(readme): placement intrusction
EmixamPP Jul 27, 2023
0e70ebc
refactor: better search system
EmixamPP Jul 29, 2023
7e8b126
doc: update manual build requirements
EmixamPP Jul 29, 2023
7f19915
doc: update manual build requirements
EmixamPP Jul 29, 2023
26c363a
fix: little-endian convert
EmixamPP Jul 30, 2023
370ec5d
refactor: ignore limit of not manual mode
EmixamPP Jul 31, 2023
a8cb423
perf: remove useless camera reset between tries
EmixamPP Jul 31, 2023
c9afe61
refactor(auto config): capture time ms instead sec
EmixamPP Jul 31, 2023
e1e5133
fix: broken search system caused by 0e70ebc
EmixamPP Jul 31, 2023
045105a
style: fix CI
EmixamPP Jul 31, 2023
77e6361
Revert "refactor: ignore limit of not manual mode"
EmixamPP Aug 1, 2023
57d70f3
feat: always perform exhaustive search
EmixamPP Aug 1, 2023
b9b1c8b
chore: remove file pushed by mistake
EmixamPP Aug 1, 2023
d43f6c7
style: display details
EmixamPP Aug 1, 2023
19b5149
doc: update for v5
EmixamPP Aug 1, 2023
a750fa6
refactor: capture 0.5 sec instead 1
EmixamPP Aug 1, 2023
a2d354f
Revert "refactor: capture 0.5 sec instead 1"
EmixamPP Aug 1, 2023
9b53401
refactor: try max before skip pattern
EmixamPP Aug 2, 2023
2b2dee4
feat: video feedback
EmixamPP Aug 2, 2023
235f644
fix(CI): missing gtk3 dependency
EmixamPP Aug 2, 2023
25a0c5a
doc: update readme
EmixamPP Aug 2, 2023
328a359
style: remove useless cast
EmixamPP Aug 2, 2023
38af945
refactor: remove useless debug message
EmixamPP Aug 3, 2023
801eadc
fix: destroy video feedback window
EmixamPP Aug 3, 2023
afe24a0
doc: update readme
EmixamPP Aug 5, 2023
7dd1d45
chore: update issue template
EmixamPP Aug 5, 2023
3fd79ee
chore: v5.0.0
EmixamPP Aug 7, 2023
de3f491
chore(CI): ARM add python as dependency
EmixamPP Aug 7, 2023
b93c7e9
chore(CI): fix ARM python command not found
EmixamPP Aug 7, 2023
443e823
chore(CI): arm worflow fix pip not found
EmixamPP Aug 7, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 21 additions & 14 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
---
Checks: '
,readability-avoid-const-params-in-decls,
,readability-inconsistent-declaration-parameter-name,
,readability-non-const-parameter,
,readability-redundant-string-cstr,
,readability-redundant-string-init,
,readability-simplify-boolean-expr,
'
WarningsAsErrors: '
,readability-avoid-const-params-in-decls,
,readability-inconsistent-declaration-parameter-name,
,readability-non-const-parameter,
,readability-redundant-string-cstr,
,readability-redundant-string-init,
,readability-simplify-boolean-expr,
readability*,
-readability-identifier-length,
-readability-braces-around-statements,
-readability-magic-numbers,
-readability-named-parameter,
-readability-function-cognitive-complexity,
-readability-use-anyofallof,
cppcoreguidelines*,
-cppcoreguidelines-init-variables,
-cppcoreguidelines-avoid-magic-numbers,
-cppcoreguidelines-pro-type-vararg,
-cppcoreguidelines-pro-type-const-cast,
-cppcoreguidelines-pro-type-member-init,
-cppcoreguidelines-avoid-const-or-ref-data-members,
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
-cppcoreguidelines-avoid-c-arrays,
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
-cppcoreguidelines-non-private-member-variables-in-classes,
-cppcoreguidelines-avoid-non-const-global-variables,
-cppcoreguidelines-avoid-do-while
'
WarningsAsErrors: '*'
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ assignees: ''

---

<!--- Please look at the wiki before open an issue -->
<!--- https://github.com/EmixamPP/linux-enable-ir-emitter/wiki -->
<!--- Please look at the docs before open an issue -->
<!--- https://github.com/EmixamPP/linux-enable-ir-emitter/blob/master/docs/README.md -->

**Describe the bug**
<!--- explain here -->
Expand Down
14 changes: 9 additions & 5 deletions .github/ISSUE_TEMPLATE/configuration-has-failed.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ assignees: ''

---

<!--- Please look at the wiki before open an issue -->
<!--- https://github.com/EmixamPP/linux-enable-ir-emitter/wiki -->
<!--- Please look at the docs before open an issue -->
<!--- https://github.com/EmixamPP/linux-enable-ir-emitter/blob/master/docs/README.md -->

**Ouput of `linux-enable-ir-emitter -v -d /dev/videoX configure`**
<!-- replace /dev/videoX with your device (/dev/video2 for default)-->
**Ouput of `linux-enable-ir-emitter -v configure`**
<details><summary>configure command output</summary>

```
Expand All @@ -25,14 +24,19 @@ paste here
```

**Ouput of `v4l2-ctl -d /dev/videoX --list-formats-ext`**
<!-- replace /dev/videoX with your device (/dev/video2 for default)-->
<!-- replace /dev/videoX for each device shown by the previous command-->
<details><summary>v4l2 device output</summary>

```
paste here
```
</details>

**Output of `ls -l /dev/v4l/by-path`**
```
paste here
```

**Give more information if you have**
<!-- describe here if you have -->

Expand Down
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/does-not-work-at-boot.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ assignees: ''

---

<!--- Please look at the wiki before open an issue -->
<!--- https://github.com/EmixamPP/linux-enable-ir-emitter/wiki -->
<!--- Please look at the docs before open an issue -->
<!--- https://github.com/EmixamPP/linux-enable-ir-emitter/blob/master/docs/README.md -->

**Output of `linux-enable-ir-emitter boot status`**
```
Expand Down
18 changes: 11 additions & 7 deletions .github/workflows/arm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
workflow_call:

env:
OPENCV_TINY_VERSION: "4.7.0"
OPENCV_TINY_VERSION: "4.8.0"

jobs:
build:
Expand Down Expand Up @@ -35,21 +35,25 @@ jobs:
--volume "${PWD}/artifacts:/artifacts"
--volume "${PWD}/opencv-tiny:/opencv-tiny"
install: |
apt-get update -q -y
apt-get install -q -y g++ meson pkg-config curl cmake
apt-get update -y
apt-get install -y python3 python3-pip python3-setuptools python3-wheel ninja-build g++ pkg-config curl cmake libgtk-3-dev
python3 -m pip install --upgrade pip
python3 -m pip install meson

run: |
[ "$(ls /opencv-tiny)" ] || curl https://raw.githubusercontent.com/EmixamPP/opencv-tiny/main/build.sh | bash -s ${OPENCV_TINY_VERSION} /opencv-tiny

meson setup build --pkg-config-path=$(find opencv-tiny -name pkgconfig | tr '\n' ':')
meson configure build -Dlibdir=lib64
meson configure build -Dlibdir=lib64
meson compile -C build

DESTDIR=install_dir meson install -C build
tar -czvf /artifacts/linux-enable-ir-emitter_aarch64.tar.gz -C build/install_dir .
chown -R root:root build/install_dir
tar -czvf /artifacts/linux-enable-ir-emitter.aarch64.tar.gz -C build/install_dir .

- name: Upload tarball
uses: actions/upload-artifact@v3
with:
name: linux-enable-ir-emitter_aarch64.tar.gz
path: artifacts/linux-enable-ir-emitter_aarch64.tar.gz
name: linux-enable-ir-emitter.aarch64.tar.gz
path: artifacts/linux-enable-ir-emitter.aarch64.tar.gz
if-no-files-found: error
13 changes: 7 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
workflow_call:

env:
OPENCV_TINY_VERSION: "4.7.0"
OPENCV_TINY_VERSION: "4.8.0"

jobs:
ci:
Expand All @@ -21,9 +21,9 @@ jobs:
- name: Install dependencies
run: |
sudo apt-get update -y
sudo apt-get install -y g++ meson pkg-config curl clang-tidy
sudo apt-get install -y python3-setuptools python3-wheel ninja-build g++ pkg-config clang-tidy libgtk-3-dev
python -m pip install --upgrade pip
python -m pip install pyright
python -m pip install meson pyright

- name: Cache OpenCV dependency
id: cache-opencv
Expand Down Expand Up @@ -61,11 +61,12 @@ jobs:
- name: Create tarball
run: |
DESTDIR=install_dir meson install -C build
tar -czvf build/linux-enable-ir-emitter_x86-64.tar.gz -C build/install_dir .
sudo chown -R root:root build/install_dir
tar -czvf build/linux-enable-ir-emitter.x86-64.tar.gz -C build/install_dir .

- name: Upload tarball
uses: actions/upload-artifact@v3
with:
name: linux-enable-ir-emitter_x86-64.tar.gz
path: build/linux-enable-ir-emitter_x86-64.tar.gz
name: linux-enable-ir-emitter.x86-64.tar.gz
path: build/linux-enable-ir-emitter.x86-64.tar.gz
if-no-files-found: error
3 changes: 3 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: Pull Request

on:
pull_request:
paths-ignore:
- 'docs/**'
- 'README.md'

jobs:
ci:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ build

# OpenCV
opencv*
!sources/camera/opencv.hpp
zlib*

# Others
Expand Down
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# ? Aug ? 2023 - 5.0.0
- Automatic ir camera detection
- Automatic ir emitter configuration
- Exhaustive search
- Video feedback
# Fri Jun 23 2023 - 4.8.2
- Fix systemd hanging in some cases
- More appropriate installation paths
Expand All @@ -16,7 +21,6 @@
- Support multiple emitters camera
- Memorize broken instructions to skip them
- Usage of /dev/v4l/by-path for persistence
- Drop distribution repositories support
# Tue Sep 13 2022 - 4.1.5
- Fix boot service for custom device
# Thu Aug 11 2022 - 4.1.4
Expand Down Expand Up @@ -49,4 +53,4 @@
- New fix command, to resolve well know problems
- Systemd service file modified to prevent /dev/video file descriptor error
# Thu Aug 12 2021 - 2.0.1
- Initial package
- Initial release
31 changes: 17 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@ Provides support for infrared cameras that are not directly enabled out-of-the b

`linux-enable-ir-emitter` can automatically generate a lightweight driver (located in user space) for almost any (UVC) infrared emitter.

This tool was created to use [Howdy](https://github.com/boltgolt/howdy), a Windows Hello for linux.

## Installation
Directly refer to the manual buid [section](#manual-build) if your boot service manager is not Systemd but OpenRC. Stay here if you don't know. We support ARM architectures, just download the `aarch64` variant.

Download the latest `linux-enable-ir-emitter-x.x.x_x86-64.tar.gz` [here](https://github.com/EmixamPP/linux-enable-ir-emitter/releases/latest), then execute:
Download the latest `linux-enable-ir-emitter-x.x.x.x86-64.tar.gz` [here](https://github.com/EmixamPP/linux-enable-ir-emitter/releases/latest), then execute:
```
sudo tar -C / --no-same-owner -h -xzf linux-enable-ir-emitter-*.tar.gz
sudo tar -C / -h -xzf linux-enable-ir-emitter-*.tar.gz
```

It can be uninstalled by executing (remove the last line to keep the emitter configuration):
Expand All @@ -26,22 +24,27 @@ sudo rm -rf /usr/lib64/linux-enable-ir-emitter \
```

## How to enable your infrared emitter?
1. Ensure to not use the camera during the execution.
2. Be patient, do not kill the process, and whatever the reason. (Unless the execution is stuck for more than 10 minutes.)
3. Execute `sudo linux-enable-ir-emitter configure`.
* You can specify your infrared camera with the option `-d`, by default it is `-d /dev/video2`.
1. Stand in front of the camera and make sure the room is well lit.
2. Ensure to not use the camera during the execution.
3. Be patient, do not kill the process.
4. Execute `sudo linux-enable-ir-emitter configure`.
* If you have many emitters on the camera, specify it using the option `-e`. E.g. `-e 2` if you have 2 emitters.
4. Answer to the asked questions.
5. Sometimes, it can request you to shut down, then boot and retry ($\neq$ reboot)
5. Answer to the asked questions.
6. Sometimes, it can request you to shut down, then boot and retry ($\neq$ reboot)

If you like the project, do not hesitate to star the repository to support me, thank you!

If you like the project, do not hesitate to star the repository to support me, thank you !
Any criticims, ideas and contributions are welcome.

*Please consult the [wiki](https://github.com/EmixamPP/linux-enable-ir-emitter/wiki) before opening an issue.*
If the configuration failed:
1. But you saw the ir emitter flashing, switch to manual mode by using the `-m` option.
2. Also, try the exhaustive search by using the `-l -1` option (caution: this may take several hours; do not combine it `-m`).
3. Otherwise, feel free to open an issue, *but please consult the [docs](docs/README.md) first*.

The software supports the configuration of multiple devices, execute the configure command and specify each time which device to configure.

## Manual build
See [wiki](https://github.com/EmixamPP/linux-enable-ir-emitter/wiki/Requirements) for specification concerning build requirements.
See [docs](docs/requirements.md) for specification concerning build requirements.

Clone the git:
```
Expand All @@ -51,7 +54,7 @@ cd linux-enable-ir-emitter

Build my minimal version of OpenCV that will be statically linked. This is not required, you can use the shared opencv library of your distro. But it is recommanded in order to do not have issues after distro updates:
```
curl https://raw.githubusercontent.com/EmixamPP/opencv-tiny/main/build.sh | bash -s 4.7.0 "${PWD}/opencv-tiny"
curl https://raw.githubusercontent.com/EmixamPP/opencv-tiny/main/build.sh | bash -s 4.8.0 "${PWD}/opencv-tiny"
```

Setup build (remove `--pkg-config-path=...` if you skipped the previous step):
Expand Down
53 changes: 53 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
### In this documentations you can find help for:
* [Solve common problem and instruction for opening a new issue](issues.md)
* [System, manual build and hardware requirements](requirements.md)
* [Exit code meaning](exit-code.md)
* [Command line usage](#linux-enable-ir-emitter-usage)

### linux-enable-ir-emitter usage
```
usage: linux-enable-ir-emitter [-h] [-v] [-V] [-d device] {run,configure,boot,delete} ...

Provides support for infrared cameras.

positional arguments:
{run,configure,boot,delete}
run apply drivers
configure generate ir emitter driver
boot enable ir at boot
delete delete drivers

options:
-h, --help show this help message and exit
-v, --verbose print verbose information
-V, --version show version information and exit
-d device, --device device
specify the infrared camera, automatic detection by default
```
```
usage: linux-enable-ir-emitter configure [-h] [-m] [-e <count>] [-l <count>]

options:
-h, --help show this help message and exit
-m, --manual activate manual configuration
-e <count>, --emitters <count>
the number of emitters on the device, by default is 1
-l <count>, --limit <count>
the number of negative answer before the pattern is skipped, by default is 5. Use -1 for unlimited
```
```
usage: linux-enable-ir-emitter boot [-h] {enable,disable,status}

positional arguments:
{enable,disable,status}
specify the boot action to perform

optional arguments:
-h, --help show this help message and exit
```
```
usage: linux-enable-ir-emitter delete [-h]

options:
-h, --help show this help message and exit
```
8 changes: 8 additions & 0 deletions docs/exit-code.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## Exit code meaning

| Code | Meaning | How to fix |
|------|---------|------------|
| 0 | SUCCESS | |
| 1 | FAILURE | read the displayed logs output for more information |
| 2 | ROOT_REQUIRED | execute with root privilege |
| 126 | FILE_DESCRIPTOR_ERROR | check the -d option or your running processes which may use the camera|
23 changes: 23 additions & 0 deletions docs/issues.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
### Please, first, ensure that you have the last version. Compare the [latest release](https://github.com/EmixamPP/linux-enable-ir-emitter/releases/latest) with `linux-enable-ir-emitter -V`

## The configuration has failed
If you had the message `INFO: Please shut down your computer, then boot and retry.`, please follow these instructions first:
1. Shutdown your computer, (not just rebooting)
2. Remove the AC adapter and if possible the battery
3. Wait one minute
4. Boot
5. Retry

Otherwise, open an issue using the "Configuration has failed" template.

## The emitter does not work after successful configuration or after update.
1. If you use Howdy, be sure it uses the infrared camera configured; the path is printed after the message `INFO: Configuring the camera:`.
2. Execute `sudo linux-enable-ir-emitter boot enable`.
3. If none of the previous fix your problem, open an issue using the "Emitter does not work after successful configuration" template.

## Error with the systemd/openrc or udev boot service
1. Ensure you have `systemd` or `openrc` (and the related version installed)
2. Open an issue using the "Emitter does not work after successful configuration" template.

## Other bugs
Open an issue using the "Bug report" template.
16 changes: 16 additions & 0 deletions docs/requirements.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
## System requirements
* if you used chicony-ir-toggle, please remove it
* `python3 >= 3.10`
* `video4linux` as video capture devices framework
* `systemd` or `openrc` as service manager
* `glibc`, `libstdc++`, `libgcc`, `gtk3`

## Manual build requirements
* `meson >= 1.0.0`, `ninja-build`, `pkg-config`, `gtk3 devel`
* `cmake` only if you build OpenCV
* `g++`, `libstdc++-devel` (for `C++17`)
* `curl`

## Hardware requirements
* An infrared camera with at least one emitter.
* A camera compatible with the UVC standard. Typically, it has to be a USB camera (laptop camera are mostly USB).
Loading