aports/community/libcec/0001-Add-an-udev-rule-making-the-CEC-adapter-part-of-the-input-group.patch
Bart Ribbers 6ffc0f6f7f community/libcec: add udev rule to make USB adapter part of input group
The Pulse-Eight HDMI-CEC adapter by default appears as /dev/ttyACM0,
owned by the "dialout" user with 660 permissions. However this device is
used as an input device so it makes more sense to be owned by the
"input" group. This also allows any user part of that group to use the
device without having to be part of the dialout group, which is useful
for at least Plasma Bigscreen and probably also for Kodi
2022-01-03 07:45:02 +00:00

45 lines
1.9 KiB
Diff

From a3e9213b5e3ae2572390435e4b718fd7f3f49617 Mon Sep 17 00:00:00 2001
From: Bart Ribbers <bribbers@disroot.org>
Date: Thu, 23 Dec 2021 12:25:25 +0100
Subject: [PATCH] Add an udev rule making the CEC adapter part of the input
group
Without this, the HDMI CEC USB adapter appears as /dev/ttyACM0 owned by
the dialout group with mode 660. This means that any user that wants to
use this device needs to be part of the dialout group. This actually has
security concerns as all serial devices are owned by that group as well
and it would give the user too much control of them, meaning any rogue
process can cause harm without needing root access.
Since the CEC adapter is actually used as an input device, this udev
rule makes the device be part of the input group instead. This makes
sense as it _is_ an input device and any rogue process shouldn't be able
to do to much harm with that group. On most distributions the standard
user is part of that group by default anyway
---
CMakeLists.txt | 4 ++++
udev/90-hdmi-cec.rules | 2 ++
2 files changed, 6 insertions(+)
create mode 100644 udev/90-hdmi-cec.rules
diff --git a/CMakeLists.txt b/CMakeLists.txt
index abd42db2..42c8a52e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -44,3 +44,7 @@ if(WIN32)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/dotnet/src/CecSharpTester/netfx/Properties/AssemblyInfo.cs.in
${CMAKE_CURRENT_SOURCE_DIR}/src/dotnet/src/CecSharpTester/netfx/Properties/AssemblyInfo.cs)
endif()
+
+if(UNIX AND NOT APPLE)
+ install(FILES udev/90-hdmi-cec.rules DESTINATION ${CMAKE_INSTALL_LIBDIR}/udev/rules.d)
+endif()
diff --git a/udev/90-hdmi-cec.rules b/udev/90-hdmi-cec.rules
new file mode 100644
index 00000000..08cb14a1
--- /dev/null
+++ b/udev/90-hdmi-cec.rules
@@ -0,0 +1,2 @@
+# Pulse-Eight CEC adapter
+KERNEL=="ttyACM[0-9]*", SUBSYSTEM=="tty", ATTRS{idVendor}=="2548", ATTRS{idProduct}=="1002", GROUP="input"