-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Udev rules power down #7635
Conversation
There was a problem hiding this 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
scripts/setup_udev_rules.sh
Outdated
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 |
There was a problem hiding this comment.
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?
scripts/setup_udev_rules.sh
Outdated
# --uninstall : remove permissions for realsense devices. | ||
|
||
install=true | ||
auto_power_off=false |
There was a problem hiding this comment.
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
scripts/setup_udev_rules.sh
Outdated
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 |
There was a problem hiding this comment.
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.
ad95948
to
a22be02
Compare
There was a problem hiding this 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
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`* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
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