Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 4 additions & 1 deletion config/99-realsense-libusb.rules
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,7 @@ DRIVER=="hid_sensor*", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b5b", RUN+="
KERNEL=="iio*", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b5c", MODE:="0777", GROUP:="plugdev", RUN+="/bin/sh -c 'chmod -R 0777 /sys/%p'"
DRIVER=="hid_sensor*", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b5c", RUN+="/bin/sh -c ' chmod -R 0777 /sys/%p && chmod 0777 /dev/%k'"
KERNEL=="iio*", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b64", MODE:="0777", GROUP:="plugdev", RUN+="/bin/sh -c 'chmod -R 0777 /sys/%p'"
DRIVER=="hid_sensor*", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b64", RUN+="/bin/sh -c ' chmod -R 0777 /sys/%p && chmod 0777 /dev/%k'"
DRIVER=="hid_sensor*", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b64", RUN+="/bin/sh -c ' chmod -R 0777 /sys/%p && chmod 0777 /dev/%k'"

# For products with motion_module, if (kernels is 4.15 and up) and (device name is "accel_3d") wait, in another process, until (enable flag is set to 1 or 200 mSec passed) and then set it to 0.
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 ])) && (enamefile=/sys/%p/name && [ `cat $enamefile` = \"accel_3d\" ]) && 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'"
2 changes: 2 additions & 0 deletions doc/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

👍


4. Build and apply patched kernel modules for: <br />
* **Ubuntu 14/16/18 with LTS kernel**
Expand Down
44 changes: 35 additions & 9 deletions scripts/setup_udev_rules.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,46 @@
#!/bin/bash -e

echo "Setting-up permissions for RealSense devices"
# USAGE:
# Normal usecase - without any parameters.
#
# [optional parameters]:
# --uninstall : remove permissions for realsense devices.

install=true

for var in "$@"
do
if [ "$var" = "--uninstall" ]; then
install=false
fi
done

if [ "$install" = true ]; then
echo "Setting-up permissions for RealSense devices"
else
echo "Remove permissions for RealSense devices"
fi

exec 3>&2
exec 2> /dev/null
con_dev=$(ls /dev/video* | wc -l)
exec 2>&3

if [ $con_dev -ne 0 ];
then
echo -e "\e[32m"
read -p "Remove all RealSense cameras attached. Hit any key when ready"
echo -e "\e[0m"
if [ "$install" = true ]; then
if [ $con_dev -ne 0 ];
then
echo -e "\e[32m"
read -p "Remove all RealSense cameras attached. Hit any key when ready"
echo -e "\e[0m"
fi
sudo cp config/99-realsense-libusb.rules /etc/udev/rules.d/
else
sudo rm /etc/udev/rules.d/99-realsense-libusb.rules
fi

sudo cp config/99-realsense-libusb.rules /etc/udev/rules.d/
sudo udevadm control --reload-rules && udevadm trigger

echo "udev-rules successfully installed"
if [ "$install" = true ]; then
echo "udev-rules successfully installed"
else
echo "udev-rules successfully uninstalled"
fi