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

Udev rules power down #7635

Merged
merged 15 commits into from
Nov 4, 2020
Merged

Conversation

doronhi
Copy link
Contributor

@doronhi doronhi commented Oct 22, 2020

On kernel 5.x.x.x there is an issue with iio sensors - some of them does not reduce power consumption after connection.
This udev-rules correction disables the sensor after it's initial connection.
Related to DSO-15863

@dorodnic dorodnic changed the base branch from master to development October 25, 2020 08:47
Copy link
Collaborator

@ev-mp ev-mp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The w/a amendment is injected to udev rules by script.
It also need to work with Debians

fi
sudo cp config/99-realsense-libusb.rules /etc/udev/rules.d/
echo | sudo tee -a /etc/udev/rules.d/99-realsense-libusb.rules > /dev/null
echo "KERNEL==\"iio*\", ATTRS{idVendor}==\"8086\", ATTRS{idProduct}==\"0ad5|0afe|0aff|0b00|0b01|0b3a|0b3d|0b64\", RUN+=\"/bin/sh -c '(major=\`uname -r | cut -d \\\".\\\" -f1\` && minor=\`uname -r | cut -d \\\".\\\" -f2\` && (([ \\\$major -eq 4 ] && [ \\\$minor -ge 15 ]) || [ \\\$major -ge 5 ])) && enfile=/sys/%p/buffer/enable && echo \\\"COUNTER=0; while [ \\\$COUNTER -lt 20 ] && grep -q 0 \$enfile; do sleep 0.01; COUNTER=\\\$((COUNTER+1)); done && echo 0 > \$enfile\\\" | at now'\"" | sudo tee -a /etc/udev/rules.d/99-realsense-libusb.rules > /dev/null
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pls add in-place description for what is doing on for maintainers.
One more thing - currently it will run for both Accel and Gyro, but we know that the issue occurs with Accel.
so even if accelerometer will be fixed immediately we'll still wait for 200 msec for gyro ( that won't start)
Can the condition "KERNEL=="iio*", ATTRS{idVendor}=="8086" be further fine-tuned?

# --uninstall : remove permissions for realsense devices.

install=true
auto_power_off=false
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is this set to true? I though it is a command line flag

fi
sudo cp config/99-realsense-libusb.rules /etc/udev/rules.d/
echo | sudo tee -a /etc/udev/rules.d/99-realsense-libusb.rules > /dev/null
echo "KERNEL==\"iio*\", ATTRS{idVendor}==\"8086\", ATTRS{idProduct}==\"0ad5|0afe|0aff|0b00|0b01|0b3a|0b3d|0b64\", RUN+=\"/bin/sh -c '(major=\`uname -r | cut -d \\\".\\\" -f1\` && minor=\`uname -r | cut -d \\\".\\\" -f2\` && (([ \\\$major -eq 4 ] && [ \\\$minor -ge 15 ]) || [ \\\$major -ge 5 ])) && enfile=/sys/%p/buffer/enable && echo \\\"COUNTER=0; while [ \\\$COUNTER -lt 20 ] && grep -q 0 \$enfile; do sleep 0.01; COUNTER=\\\$((COUNTER+1)); done && echo 0 > \$enfile\\\" | at now'\"" | sudo tee -a /etc/udev/rules.d/99-realsense-libusb.rules > /dev/null
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code segment need to be refactored into the udev-rules so it will be also picked up when the udev-rules are installed not by this script, such as in case with Debian or manual install

--uninstall : remove permissions for realsense devices.
--auto_power_off : add script for automatic power off.

Remove auto power off from config/99-realsense-libusb.rules
…t to 0. No hard code sleeping time.

remove power-down line from config/99-realsense-libusb.rules
scripts/setup_udev_rules.sh sets the power-down line to 99-realsense-libusb.rules file.
…sense-libusb.rules

increase timeout to 200mSec based on a NUC test.
Modify rule to apply for accel sensor only.
Copy link
Collaborator

@ev-mp ev-mp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put DSO into PR description

@doronhi
Copy link
Contributor Author

doronhi commented Oct 29, 2020

Put DSO into PR description

Done.

Test check if power is down for a newly connected device and after resetting it.
It also check that while the first camera is running, connecting a second camera wont interfere.
A flag '--help' prints a usage message.
Add timeout of 10 seconds for device to be connected.
@@ -57,6 +57,8 @@ The scripts and commands below invoke `wget, git, add-apt-repository` which may
3. Run Intel Realsense permissions script from librealsense root directory:<br />
`./scripts/setup_udev_rules.sh`
<br />
*Notice: One can always remove permissions by running:*
*`./scripts/setup_udev_rules.sh --uninstall`*
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Collaborator

@ev-mp ev-mp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ev-mp ev-mp merged commit 65a421a into IntelRealSense:development Nov 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants