Device Permissions

Except when using AMD's proprietary driver (see here) ddcutil requires write access to /dev/i2c-*.

On some distributions, package i2c-tools creates group i2c, and assigns that the group to /dev/i2c-* devices using a udev rule. In that case all that is necessary is to add your user name to group i2c:

$ sudo usermod your-user-name -aG i2c

For testing, it may be simpler to give everyone permission to write to /dev/i2c-* for the current boot:

$ sudo chmod a+rw /dev/i2c-*

If needed, a udev rule for giving group i2c RW permission on the /i2c-dev-* devices can be found in distributed file 45-ddcutils-i2c.rules. It can be copied to /etc/udev/rules.d, but do check that this rule does not conflict with others in that directory.

$ sudo cp /usr/share/ddcutil/data/etc/udev/rules.d/45-ddcutils-i2c.rules /etc/udev/rules.d

If using a monitor that transmits MCCS over USB, ddcutil requires read/write access to device /dev/usb/hiddevN, where N is the number for the device representing the monitor's USB connection.

ddcutil has to be careful when accessing the /dev/usb/hiddev* devices, as some of these can represent USB attached input devices such as keyboards or mice.

Distributed file 45-ddcutil-usb.rules shows a couple ways to give ddcutil the required access. This file can be copied to /etc/udev/rules.d. All but one of the command lines in that file should commented out.

The following rule gives group video access to the USB port of an Apple Cinema Display by specifying its USB device user id (aka uid) and product id (aka pid):

SUBSYSTEM=="usbmisc", ATTRS{idVendor}=="05ac", ATTRS{idProduct}=="9223",  MODE="0666" 

This line would of course have to edited for your monitor. One way to find its uid/pid is the lsusb command.

An alternative way to set proper device permissions is to call ddcutil from the udev rule to test whether a device is a HID compliant monitor:

SUBSYSTEM=="usbmisc",  KERNEL=="hiddev*", PROGRAM="/usr/local/bin/ddcutil chkusbmon $env{DEVNAME} -v", MODE="0660", GROUP="video"

Note that the path to the ddcutil executable will have be edited to the location where ddcutil installed on your system.

The -v option produces informational messages. These are lost when the rule is normally executed by udev, but can be helpful when rules are tested using the "udevadm test" command.

Distribution file 45-ddcutils-usb.rules contains sample udev rules to set permissions for USB connector monitors. It can be copied to /etc/udev/rules.d, but do check that this rule does not conflict with others in that directory.

$ sudo cp /usr/share/ddcutil/data/etc/udev/rules.d/45-ddcutils-usb.rules /etc/udev/rules.d

Bear in mind when looking at the variety of udev rules is that there are often several valid ways to identify a device.

The following section from the udev documentation (https://www.kernel.org/pub/linux/utils/kernel/hotplug/udev/udev.html) may be helpful:

The udev rules are read from the files located in the system rules directory /usr/lib/udev/rules.d, the volatile runtime directory /run/udev/rules.d and the local administration directory /etc/udev/rules.d. All rules files are collectively sorted and processed in lexical order, regardless of the directories in which they live. However, files with identical file names replace each other. Files in /etc have the highest priority, files in /run take precedence over files with the same name in /lib. This can be used to override a system-supplied rules file with a local file if needed; a symlink in /etc with the same name as a rules file in /lib, pointing to /dev/null, disables the rules file entirely.